WebRadioApp  0.1
tcp_client.h
Go to the documentation of this file.
1 
21 #ifndef __TCP_CLIENT_H__
22 #define __TCP_CLIENT_H__
23 
24 #include "web_radio_config.h"
25 #include <iostream>
26 #include <iomanip>
27 #include "stations.h"
28 #include "ntpudp.h"
29 #include <mp3dec.h>
30 #include "mp3common.h"
31 #include "mp3player.h"
32 
43 };
44 
50 struct client {
52  struct tcp_pcb *pcb;
53  struct pbuf *p_tx;
54 };
55 
57 
58 /* Exported variables --------------------------------------------------------*/
59 extern char stationname[160];
60 extern char metaint[10];
61 extern volatile int metnum;
63 extern volatile uint8_t data_with_metainfo[12000];
64 extern volatile uint8_t metainfo_present;
65 
66 static long long int totaldatacount;
67 static long long int lencounter;
68 extern char *payloadtemp;
69 
70 extern int metainterval;
78 extern char *strptr;
79 extern char *startnameptr;
80 extern char *ptr2;
83 extern char httpstr[160];
84 
85 extern volatile uint64_t message_count;
86 extern long long unsigned int sent_len;
87 extern char initial_pipe[20000];
88 extern char meta_string[15 * 256];
89 extern volatile int insertion_point;
90 extern volatile int insertion_point_maximum;
91 extern volatile int inserted_len;
92 extern volatile int curr_len;
93 extern volatile int msg_len_max;
94 extern volatile int meta_start_index;
95 extern volatile int meta_info_len;
96 
97 extern volatile int items;
98 
100 
107 {
108  public:
112  struct netif *gnetif;
113 
122  TcpClient(Mp3Player *mp3, struct netif *connection)
123  {
124  this->m_mp3 = mp3;
125  this->gnetif = connection;
126  };
128  struct client *es = (struct client *)mem_malloc(sizeof(struct client));
129 
138  void connect(ip_addr_t DestIPaddr, uint16_t DEST_PORT);
139 
145  void disconnect(void);
146 
153  void connectionClose(struct tcp_pcb *tpcb, struct client *es);
154 
160  void process(void);
161 
167  void analysisOfMetaInfo(void);
168 
175  void updateStation(void);
176 
182  void gateActivities(void);
183 
190  void adjustBuffer();
191 
192  private:
199  static err_t connected(void *arg, struct tcp_pcb *tpcb, err_t err)
200  {
201  TcpClient *es = (TcpClient *)arg;
202 
203  std::cout << "CONNECTED = " << (int)err << std::endl;
204 
205  if (err == ERR_OK) {
206  if (es != NULL) {
207  // printf ("ES <> 0 \n\r");
208  es->es->state = ES_CONNECTED;
209  es->es->pcb = tpcb;
210 
211  /* allocate pbuf */
212  es->es->p_tx = pbuf_alloc(PBUF_TRANSPORT,
213  strlen((char *)httpstr), PBUF_POOL);
214  // printf ("pbuf allocated \n\r");
215 
216  if (es->es->p_tx) {
217  // printf (" es->p_tx \n\r");
218 
219  /* copy data to pbuf */
220  pbuf_take(es->es->p_tx, (char *)httpstr,
221  strlen((char *)httpstr));
222 
223  // printf (" pbuf_take \n\r");
224 
225  /* pass newly allocated es structure as argument to tpcb */
226  // tcp_arg(tpcb, es);
227 
228  // printf (" tpcb_arg \n\r");
229 
230  /* initialize LwIP tcp_recv callback function */
231  tcp_recv(tpcb, es->recv);
232 
233  // printf (" tcp_recv \n\r");
234 
235  /* initialize LwIP tcp_sent callback function */
236  tcp_sent(tpcb, es->sent);
237 
238  // printf (" tcp_sent \n\r");
239 
240  /* initialize LwIP tcp_poll callback function */
241  tcp_poll(tpcb, es->poll, 1);
242 
243  // printf (" tcp_poll \n\r");
244 
245  /* send data */
246  es->send(tpcb, es->es);
247  // printf ("HHTP REQUEST DATA SENT: %s \n\r", httpstr);
248 
249  return ERR_OK;
250  }
251  } else {
252  /* close connection */
253  es->connectionClose(tpcb, es->es);
254 
255  std::cout << " connectionClose top \n\r";
256 
257  /* return memory allocation error */
258  return ERR_MEM;
259  }
260  } else {
261  /* close connection */
262  es->connectionClose(tpcb, es->es);
263  std::cout << " connectionClose bottom\n\r";
264  }
265  return err;
266  }
267 
275  static err_t recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p,
276  err_t err)
277  {
278  err_t ret_err = 0;
279 
280  LWIP_ASSERT("arg != NULL", arg != NULL);
281 
282  TcpClient *es = (TcpClient *)arg;
283 
284  /* if we receive an empty tcp frame from server => close connection */
285  if (p == NULL) {
286  std::cout << " remote host closed \n\r";
287 
288  /* remote host closed connection */
289  es->es->state = ES_CLOSING;
290  if (es->es->p_tx == NULL) {
291  /* we're done sending, close connection */
292  es->connectionClose(tpcb, es->es);
293  std::cout << " done closing \n\r";
294 
295  } else {
296  /* send remaining data*/
297  es->send(tpcb, es->es);
298  // printf (" send remaining \n\r");
299  }
300  ret_err = ERR_OK;
301  }
302  /* else : a non empty frame was received from server but for some
303  reason err != ERR_OK */
304  else if (err != ERR_OK) {
305  /* free received pbuf*/
306  if (p != NULL) {
307  pbuf_free(p);
308  // printf (" pbuf free \n\r");
309  }
310  ret_err = err;
311  } else if ((es->es->state == ES_CONNECTED) &
312  (items <
313  TCPBUFF_MAXITEMS)) // & (items < 80000) can be ommitted
314  // if RAM size >> 3 MBytes
315  {
316  /* ***************** Successful reception of message
317  * ********************/
318  /* ************* WebRadio Message processing starts here
319  * ****************/
320  /* ***********************************************************************/
321 
322  message_count++;
323  sent_len += p->tot_len;
324 
325  if (msg_len_max < (p->tot_len)) // only for display
326  {
327  msg_len_max = p->tot_len;
328  }
329 
330  // special case for Linux shoutcast server 1.9.7 or 1.9.8:
331  // discard first package (typically 171 bytes long)
332  if (sent_len < 200) // for sure: message 1
333  {
334  message_count = 0;
335  sent_len = 0;
336  }
337 
338  // extract metainfo from first answer message
339  if (message_count == 1) {
340  pbuf_copy_partial(p, initial_pipe, p->tot_len, 0);
342 
343  // Extract station name
344  const char needle[] = "icy-name:";
345  strptr = strstr(initial_pipe, needle);
346  stationname[0] = 0;
347 
348  if (strptr != NULL) {
349  startnameptr = strptr + 9;
350  for (ptr2 = startnameptr; (ptr2 - startnameptr) < 160;
351  ptr2++) // 160 length stationname array
352  {
353  if (*ptr2 == '\r') {
354  break;
355  }
356  strncat((char *)stationname, ptr2, 1);
357  }
359  // printf ("ICY STATION NAME FOUND: >%s<\n\r", stationname);
360  }
361 
362  // Extract metainfo interval length
363  const char needle2[] = "icy-metaint:";
364  metnum = 0;
365  metaint[0] = 0;
366  strptr = strstr(initial_pipe, needle2);
367  if (strptr != NULL) {
368  startnameptr = strptr + 12;
369  for (ptr2 = startnameptr; (ptr2 - startnameptr) < 10;
370  ptr2++) // assume metainterval < 999999999
371  {
372  if (*ptr2 == '\r') {
373  break;
374  }
375  strncat((char *)metaint, ptr2, 1);
376  }
377  metaint[ptr2 - startnameptr] = 0; // letztes Byte ist Ende
378  // printf ("ICY METAINT INTERVAL LENGTH FOUND: >%s<END\n\r",
379  // metaint);
380  metnum = atoi(metaint);
381  // printf ("Numerical Value metaint: %d\n\r", metnum);
382  }
383 
384  // parse end of metainfo
385  for (int ii = 0; ii < (int)sent_len; ii++) {
386  strncat((char *)data_with_metainfo, payloadtemp, 1);
387  payloadtemp++;
388 
389  if ((*payloadtemp == '\r') & (*(payloadtemp + 1) == '\n') &
390  (*(payloadtemp + 2) == '\r') &
391  (*(payloadtemp + 3) == '\n')) {
392  strncat((char *)data_with_metainfo, payloadtemp, 4);
394  ii +
395  5; // + first byte after CRLFCRLF == first MP3 byte
396  break;
397  }
398  }
399 
400  // *** Store the first bytes of the MP3 Data (are always already
401  // in message 1!)
402  // *** in TCPBuffer
404  es->m_mp3->insertTcpBuffer(
405  (uint8_t *)(initial_pipe + totaldatacount), lencounter);
406  insertion_point = 0;
408 
409  metainterval = -1;
410  if (metnum) {
412  }
413 
414  } // end message 1 processing
415 
416  if (message_count > 1) {
417  // printf ("1: enter len %05d \n\r", p->tot_len);
418 
419  curr_len = p->tot_len;
420  pbuf_copy_partial(p, initial_pipe + insertion_point, p->tot_len,
421  0);
422 
423  // MP3Buf_insert (initial_pipe, p->tot_len); // could be
424  // last before one
425 
426  // printf ("1: ip:%05d ", insertion_point);
427 
429  lencounter += curr_len;
430 
431  // printf ("2: ip:%05d cl:%05d ", insertion_point,
432  // curr_len);
433 
434  // Check for metainfo if more than 10000 Bytes in pipe and cut
435  // it out if start of metainfo is lower than index 5000 note
436  // maximum message length is 5840 bytes
437 
438  if (insertion_point > 12000) {
441  }
442 
443  // printf ("3: ip:%05d ", insertion_point);
444  es->m_mp3->insertTcpBuffer(
445  (uint8_t *)initial_pipe,
446  curr_len); // could be last before one length, but will
447  // average out anyway over message lengths
450  curr_len); // shift content of initial
451  // pipe left by p->tot_len
453 
454  // -----------------------------------------------------------------------------------
456  if (metnum) {
458  // printf (" %03d ", meta_start_index);
459 
460  // printf ("m: %05d \n\r", meta_start_index);
461 
462  if (meta_start_index <
463  6000) // if startmetainfo is roughly in lower
464  // quarter of initial_pipe, 5840 is max msg
465  // size!!
466  {
467  es->m_mp3->insertTcpBuffer(
468  (uint8_t *)initial_pipe,
469  meta_start_index); // move MP3 data (before
470  // metainfo starts) to
471  // MP3Buffer
472 
473  memmove(
476  meta_start_index); // shift start of
477  // metainfo to beginning
478  // of intitial_pipe
481 
482  meta_info_len =
483  (*(uint8_t *)(initial_pipe)*16) +
484  1; // length of following metainfo now
485  // at element 0 of initial_pipe
486 
487  // printf ("\n\r --- %03d --- %03d
488  //----\n\r", meta_info_len, MP3errorcount);
489 
490  if (meta_info_len > 1) {
491  meta_string[0] = 0;
492  strncpy(meta_string, initial_pipe + 1,
493  meta_info_len);
495  // printf ("string: %s \n\r",
496  // meta_string);
497  metainfo_present = 1;
498  }
499 
502  meta_info_len); // shift metainfo out of
503  // stream
505  inserted_len = 0;
506  }
507  }
508  }
509  }
510  /* ************* WebRadio Message processing ends here ***********
511  */
512  /* ****************************************************************
513  */
514 
515  /* Acknowledge data reception */
516  tcp_recved(tpcb, p->tot_len);
517  // //printf ("*");
518 
519  /* free pbuf and do nothing */
520  pbuf_free(p);
521  // //printf ("_");
522  ret_err = ERR_OK;
523  }
524 
525  /* data received when connection already closed */
526  else if (items < TCPBUFF_MAXITEMS) {
527  /* Acknowledge data reception */
528  tcp_recved(tpcb, p->tot_len);
529  // printf ("ack_\n\r");
530  /* free pbuf and do nothing */
531  pbuf_free(p);
532 
533  // printf ("freed_\n\r");
534  ret_err = ERR_OK;
535  }
536  return ret_err;
537  }
538 
546  static void send(struct tcp_pcb *tpcb, struct client *es)
547  {
548  struct pbuf *ptr;
549  err_t wr_err = ERR_OK;
550 
551  while ((wr_err == ERR_OK) && (es->p_tx != NULL) &&
552  (es->p_tx->len <= tcp_sndbuf(tpcb))) {
553  /* get pointer on pbuf from es structure */
554  ptr = es->p_tx;
555 
556  /* enqueue data for transmission */
557  wr_err = tcp_write(tpcb, ptr->payload, ptr->len, 1);
558 
559  tcp_output(tpcb); // to make it send the data immediately
560 
562 
563  if (wr_err == ERR_OK) {
564  /* continue with next pbuf in chain (if any) */
565  es->p_tx = ptr->next;
566 
567  if (es->p_tx != NULL) {
568  /* increment reference count for es->p */
569  pbuf_ref(es->p_tx);
570  }
571 
572  /* free pbuf: will free pbufs up to es->p (because es->p has a
573  * reference count > 0) */
574  pbuf_free(ptr);
575  } else if (wr_err == ERR_MEM) {
576  /* we are low on memory, try later, defer to poll */
577  es->p_tx = ptr;
578  } else {
579  /* other problem ?? */
580  }
581  }
582  }
583 
590  static err_t poll(void *arg, struct tcp_pcb *tpcb)
591  {
592  err_t ret_err;
593  TcpClient *es = (TcpClient *)arg;
594  if (es->es != NULL) {
595  if (es->es->p_tx != NULL) {
596  /* there is a remaining pbuf (chain) , try to send data */
597  es->send(tpcb, es->es);
598  } else {
599  /* no remaining pbuf (chain) */
600  if (es->es->state == ES_CLOSING) {
601  /* close tcp connection */
602  es->connectionClose(tpcb, es->es);
603  }
604  }
605  ret_err = ERR_OK;
606  } else {
607  /* nothing to be done */
608  tcp_abort(tpcb);
609  ret_err = ERR_ABRT;
610  }
611  return ret_err;
612  }
613 
622  static err_t sent(void *arg, struct tcp_pcb *tpcb, u16_t len)
623  {
624  LWIP_UNUSED_ARG(len);
625  TcpClient *es = (TcpClient *)arg;
626 
627  if (es->es->p_tx != NULL) {
628  /* still got pbufs to send */
629  es->send(tpcb, es->es);
630  }
631 
632  return ERR_OK;
633  }
639  void clearAudioBuffer(void)
640  {
641  for (int i = 0; i < AUDIO_BUFFER_SIZE; i++) {
642  BufferCtl.buff[i] = 0;
643  }
644  }
651  {
652  for (int i = 0; i < FILE_READ_BUFFER_SIZE; i++) {
653  file_read_buffer[i] = 0;
654  }
655  }
656 };
657 
658 #endif /* __TCP_CLIENT_H__ */
659 
XTAL_Sec1
int XTAL_Sec1
Definition: tcp_client.cpp:85
ntpudp.h
station_id
int16_t station_id
Definition: tcp_client.cpp:46
TcpClient::clearAudioBuffer
void clearAudioBuffer(void)
Definition: tcp_client.h:639
getKalenderwoche
char getKalenderwoche(const int uTag, const int uMonat, const int uJahr)
Definition: calend.c:156
buffer_underrunning
int buffer_underrunning
Definition: tcp_client.cpp:115
TcpClient::gateActivities
void gateActivities(void)
Gate for all activites that are admitted every 1s.
FILE_READ_BUFFER_SIZE
#define FILE_READ_BUFFER_SIZE
Definition: web_radio_config.h:42
state_connected
int state_connected
Definition: tcp_client.cpp:27
Server
DNS_desc_t Server[MaxStation]
Definition: stations.cpp:24
client::state
enum client_states state
Definition: tcp_client.h:51
DNS_desc_t
Definition: stations.h:334
message_count
volatile uint64_t message_count
Definition: tcp_client.cpp:60
buffer_overrunning
int buffer_overrunning
Definition: tcp_client.cpp:114
TcpClient::process
void process(void)
Process object.
err
volatile int err
Definition: mp3player.cpp:51
meta_info_len
volatile int meta_info_len
Definition: tcp_client.cpp:70
TCP_buff_start
int TCP_buff_start
Definition: tcp_client.cpp:82
MS_TIMER1
volatile uint64_t MS_TIMER1
Definition: main.cpp:97
connectionInfo
char connectionInfo[240]
Definition: tcp_client.cpp:35
XTAL_Weekday
int XTAL_Weekday
Definition: tcp_client.cpp:86
radioInfo
char radioInfo[240]
Definition: tcp_client.cpp:35
XTAL_Min
int XTAL_Min
Definition: main.cpp:48
sendNTP
void sendNTP(ip_addr_t *ipaddr)
Definition: ntpudp.c:119
check_stations_DNS
void check_stations_DNS(void)
Definition: stations.cpp:115
stationInfo
char stationInfo[160]
Definition: tcp_client.cpp:35
StreamURL
char StreamURL[500]
Definition: tcp_client.cpp:39
s3
char s3[80]
Definition: tcp_client.cpp:41
startnameptr
char * startnameptr
Definition: tcp_client.cpp:57
sent_len
long long unsigned int sent_len
Definition: tcp_client.cpp:61
client::pcb
struct tcp_pcb * pcb
Definition: tcp_client.h:52
file_read_buffer
uint8_t file_read_buffer[FILE_READ_BUFFER_SIZE]
Definition: mp3player.cpp:64
TcpClient::stations
Station * stations
Definition: tcp_client.h:110
DEST_IP_ADDR3
int DEST_IP_ADDR3
Definition: tcp_client.cpp:24
TCP_extract_idx
volatile uint32_t TCP_extract_idx
Definition: tcp_client.cpp:30
TCPBUFF_MAXITEMS
#define TCPBUFF_MAXITEMS
Definition: web_radio_config.h:56
mp3player.h
Mp3 Player.
stationname
char stationname[160]
Definition: tcp_client.cpp:32
XTAL_Sec
int XTAL_Sec
Definition: tcp_client.cpp:85
TcpClient::disconnect
void disconnect(void)
disconnects the TCP server
ES_RECEIVED
@ ES_RECEIVED
Definition: tcp_client.h:41
StreamTitle
char StreamTitle[500]
Definition: tcp_client.cpp:37
inserted_len
volatile int inserted_len
Definition: tcp_client.cpp:66
httpstr
char httpstr[160]
Definition: tcp_client.cpp:25
ntpsyncd
int ntpsyncd
Definition: tcp_client.cpp:101
XTAL_Hour
int XTAL_Hour
Definition: tcp_client.cpp:85
TcpClient::es
struct client * es
Definition: tcp_client.h:128
items
volatile int items
Definition: tcp_client.cpp:72
TcpClient::connected
static err_t connected(void *arg, struct tcp_pcb *tpcb, err_t err)
Function called when TCP connection established.
Definition: tcp_client.h:199
Scratch1
char Scratch1[500]
Definition: tcp_client.cpp:40
strptr
char * strptr
Definition: tcp_client.cpp:56
TcpClient::sent
static err_t sent(void *arg, struct tcp_pcb *tpcb, u16_t len)
This function implements the tcp_sent LwIP callback (called when ACK is received from remote host for...
Definition: tcp_client.h:622
TcpClient::adjustBuffer
void adjustBuffer()
Adjust speed of danger of buffer overfill: consume items slower
__attribute__
uint8_t TCP_Buffer[TCPBUFF_MAXITEMS] __attribute__((section(".tcpBuffer")))
TcpClient::server
DNS_desc_t * server
Definition: tcp_client.h:111
payloadtemp
char * payloadtemp
Definition: tcp_client.cpp:51
MP3errorcount
int MP3errorcount
Definition: mp3player.cpp:42
meta_start_index
volatile int meta_start_index
Definition: tcp_client.cpp:69
unFramesDecoded
int unFramesDecoded
Definition: mp3player.cpp:30
XTAL_Month
int XTAL_Month
Definition: tcp_client.cpp:86
AUDIO_BUFFER_SIZE
#define AUDIO_BUFFER_SIZE
Definition: web_radio_config.h:41
Servers_ptr
DNS_desc_t * Servers_ptr
Definition: stations.cpp:25
DEST_IP_ADDR0
int DEST_IP_ADDR0
Definition: tcp_client.cpp:24
number_timeouts
int number_timeouts
Definition: tcp_client.cpp:92
CurrNTPserver
ip_addr_t CurrNTPserver
Definition: main.cpp:98
haudio_out_sai
SAI_HandleTypeDef haudio_out_sai
XTAL_Day
int XTAL_Day
Definition: tcp_client.cpp:86
day_of_year
int day_of_year
Definition: tcp_client.cpp:119
metainterval
int metainterval
Definition: tcp_client.cpp:53
data_with_metainfo
volatile uint8_t data_with_metainfo[12000]
Definition: tcp_client.cpp:48
lencounter
static long long int lencounter
Definition: tcp_client.h:67
getTagDesJahres
int getTagDesJahres(const int uTag, const int uMonat, const int uJahr)
Definition: calend.c:136
metainfo_present
volatile uint8_t metainfo_present
Definition: tcp_client.cpp:49
XTAL_Min2
int XTAL_Min2
Definition: tcp_client.cpp:85
p
struct pbuf * p
Definition: ntpudp.c:48
TcpClient::recv
static err_t recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
tcp_receiv callback
Definition: tcp_client.h:275
meta_string
char meta_string[15 *256]
Definition: tcp_client.cpp:63
msg_len_max
volatile int msg_len_max
Definition: tcp_client.cpp:68
connection_timeout
volatile uint64_t connection_timeout
Definition: tcp_client.cpp:91
tcp_client.h
tcp client application using LwIP RAW API
metnum
volatile int metnum
Definition: tcp_client.cpp:34
metaint
char metaint[10]
Definition: tcp_client.cpp:33
DEST_IP_ADDR1
int DEST_IP_ADDR1
Definition: tcp_client.cpp:24
laststation
int laststation
Definition: tcp_client.cpp:44
XTAL_Min1
int XTAL_Min1
Definition: tcp_client.cpp:85
XTAL_Year
int XTAL_Year
Definition: tcp_client.cpp:86
TcpClient::TcpClient
TcpClient(Mp3Player *mp3, struct netif *connection)
Construct a new Tcp Client object.
Definition: tcp_client.h:122
currstation
int currstation
Definition: tcp_client.cpp:43
initial_pipe
char initial_pipe[20000]
Definition: tcp_client.cpp:62
totaldatacount
static long long int totaldatacount
Definition: tcp_client.h:66
TcpClient::clearFileReadBuffer
void clearFileReadBuffer(void)
Definition: tcp_client.h:650
ES_CLOSING
@ ES_CLOSING
Definition: tcp_client.h:42
insertion_point_maximum
volatile int insertion_point_maximum
Definition: tcp_client.cpp:65
curr_len
volatile int curr_len
Definition: tcp_client.cpp:67
client
structure to be passed as argument to the tcp callbacks
Definition: tcp_client.h:50
TcpClient
TcpClient Object.
Definition: tcp_client.h:106
MaxStation
#define MaxStation
Definition: web_radio_config.h:66
DEST_IP_ADDR2
int DEST_IP_ADDR2
Definition: tcp_client.cpp:24
ES_NOT_CONNECTED
@ ES_NOT_CONNECTED
Definition: tcp_client.h:39
client::p_tx
struct pbuf * p_tx
Definition: tcp_client.h:53
Stationlist
static Station Stationlist[MaxStation]
Definition: stations.h:48
web_radio_config.h
Web Radio Framework configuration.
metainfo_present_LCD
volatile uint8_t metainfo_present_LCD
Definition: tcp_client.cpp:50
Stations
Definition: stations.h:37
MP3errorreason
int MP3errorreason
Definition: mp3player.cpp:43
maxbuf
uint32_t maxbuf
Definition: tcp_client.cpp:96
TcpClient::send
static void send(struct tcp_pcb *tpcb, struct client *es)
function used to send data
Definition: tcp_client.h:546
stations.h
Stations.
XTAL_Sec2
int XTAL_Sec2
Definition: tcp_client.cpp:86
s4
char s4[80]
Definition: tcp_client.cpp:41
calender_week
unsigned char calender_week
Definition: tcp_client.cpp:118
TcpClient::gnetif
struct netif * gnetif
Definition: tcp_client.h:112
display_state
int display_state
Definition: tcp_client.cpp:103
ES_CONNECTED
@ ES_CONNECTED
Definition: tcp_client.h:40
TcpClient::analysisOfMetaInfo
void analysisOfMetaInfo(void)
Analyse and display metainfo, if present.
mp3FrameInfo
MP3FrameInfo mp3FrameInfo
Definition: mp3player.cpp:40
Mp3Player
Mp3Player Object.
Definition: mp3player.h:59
TcpClient::updateStation
void updateStation(void)
On station change disconnect and delete all buffers, then reconnect with new station.
Server
DNS_desc_t Server[MaxStation]
Definition: stations.cpp:24
TcpClient::connect
void connect(ip_addr_t DestIPaddr, uint16_t DEST_PORT)
Tcp Client object and Connects to the TCP server.
client_states
client_states
protocol states
Definition: tcp_client.h:38
TCP_Buffer
uint8_t TCP_Buffer[TCPBUFF_MAXITEMS]
TcpClient::connectionClose
void connectionClose(struct tcp_pcb *tpcb, struct client *es)
This function is used to close the tcp connection with server.
DEST_PORT
int DEST_PORT
Definition: tcp_client.cpp:24
TcpClient::m_mp3
Mp3Player * m_mp3
Definition: tcp_client.h:109
TCP_insert_idx
volatile uint32_t TCP_insert_idx
Definition: tcp_client.cpp:29
metaInfo
char metaInfo[240]
Definition: tcp_client.cpp:35
ptr2
char * ptr2
Definition: tcp_client.cpp:58
insertion_point
volatile int insertion_point
Definition: tcp_client.cpp:64
TcpClient::poll
static err_t poll(void *arg, struct tcp_pcb *tpcb)
This function implements the tcp_poll callback function.
Definition: tcp_client.h:590