Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

userif.h File Reference

#include "webradio.h"

Include dependency graph for userif.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Display Status

#define DIST_NONE   0
 Initial status, displays program banner.
#define DIST_WAIT   1
 Waiting?
#define DIST_CONNECTING   2
 Waiting for connection.
#define DIST_CONNECTED   3
 Successfully connected to a radio station.
#define DIST_BUFFER   4
 Buffering MP3 data.
#define DIST_TITLE   5
 Used?
#define DIST_STATION   6
 Used?
#define DIST_VOLUME   7
 Display volume.
#define DIST_DEAD   8
 Currently selected station is dead.
#define DIST_FORCE   9
 Force display update.

Functions

int UserIfInit (char *name)
 Start background thread for display updates.
void UserIfShowStatus (u_char status)
 Display a specified status.
void UserIfShowMessage (u_char row, u_char secs, CONST char *fmt,...)
 Display a specified text.
void UserIfEntry (u_char rs)


Define Documentation

#define DIST_NONE   0
 

Initial status, displays program banner.

Definition at line 49 of file userif.h.

#define DIST_WAIT   1
 

Waiting?

Definition at line 51 of file userif.h.

#define DIST_CONNECTING   2
 

Waiting for connection.

Definition at line 53 of file userif.h.

#define DIST_CONNECTED   3
 

Successfully connected to a radio station.

Definition at line 55 of file userif.h.

#define DIST_BUFFER   4
 

Buffering MP3 data.

Definition at line 57 of file userif.h.

#define DIST_TITLE   5
 

Used?

Definition at line 59 of file userif.h.

#define DIST_STATION   6
 

Used?

Definition at line 61 of file userif.h.

#define DIST_VOLUME   7
 

Display volume.

Definition at line 63 of file userif.h.

#define DIST_DEAD   8
 

Currently selected station is dead.

Definition at line 65 of file userif.h.

#define DIST_FORCE   9
 

Force display update.

Definition at line 67 of file userif.h.


Function Documentation

int UserIfInit char *  name  ) 
 

Start background thread for display updates.

Parameters:
name Display device name.
Returns:
0 on success or -1 in case of a failure.

Definition at line 368 of file userif.c.

00370 {
00371     /* Initialize button interface. */
00372     ButtonInit();
00373 
00374     if ((display.dpi_stream = fopen(name, "w")) == 0) {
00375         return -1;
00376     }
00377     display.dpi_scrolling = LCD_ROWS;
00378 
00379     if (NutThreadCreate("displ", UserIfThread, 0, UI_THREAD_STACK) == 0) {
00380         fclose(display.dpi_stream);
00381         display.dpi_stream = NULL;
00382         return -1;
00383     }
00384     radio.rc_cstatus = DIST_NONE;
00385     UserIfShowStatus(DIST_FORCE);
00386 
00387     return 0;

void UserIfShowStatus u_char  status  ) 
 

Display a specified status.

Parameters:
status Status to be displayed.

Definition at line 326 of file userif.c.

00328 {
00329     if (radio.rc_cstatus != status) {
00330         if (status == DIST_FORCE)
00331             status = radio.rc_cstatus;
00332         else
00333             radio.rc_cstatus = status;
00334 
00335         if (status == DIST_NONE) {
00336             strcpy(display.dpi_line[0].dln_status, "Internet Radio");
00337             strcpy(display.dpi_line[1].dln_status, "Version ");
00338             strcat(display.dpi_line[1].dln_status, VERSION);
00339         } else if (status == DIST_DEAD) {
00340             UserIfShowStationConf(&station[radio.rc_cstation]);
00341             UserIfShowMessage(1, 2, "not available");
00342         } else if (status == DIST_CONNECTING) {
00343             UserIfShowStationConf(&station[radio.rc_cstation]);
00344             strcpy(display.dpi_line[1].dln_status, "Connecting...");
00345         } else if (status == DIST_CONNECTED) {
00346             UserIfShowStationInfo(radio.rc_sip);
00347             if (radio.rc_rip) {
00348                 SHOUTCASTINFO *sci = (SHOUTCASTINFO *) radio.rc_rip->ri_bcast;
00349                 if (sci) {
00350                     if (sci->sci_metatitle && sci->sci_metatitle[0]) {
00351                         strncpy(display.dpi_line[1].dln_status, sci->sci_metatitle, LCD_VCOLS);
00352                     }
00353                     else if (radio.rc_sip && radio.rc_sip->si_genre && radio.rc_sip->si_genre[0]) {
00354                         strncpy(display.dpi_line[1].dln_status, radio.rc_sip->si_genre, LCD_VCOLS);
00355                     }
00356                 }
00357             }
00358         }
00359     }

void UserIfShowMessage u_char  row,
u_char  secs,
CONST char *  fmt,
  ...
 

Display a specified text.

Parameters:
row Row position of the message.
secs Number of seconds to display the message. Set to 0 for permanent display.
fmt Format string containing conversion specifications.

Definition at line 308 of file userif.c.

00310 {
00311     va_list ap;
00312 
00313     va_start(ap, fmt);
00314     if (secs) {
00315         vsprintf(display.dpi_line[row].dln_msg, fmt, ap);
00316         display.dpi_line[row].dln_msgticks = secs * (1000 / UI_REFRESH_RATE);
00317     } else
00318         vsprintf(display.dpi_line[row].dln_status, fmt, ap);
00319     va_end(ap);

void UserIfEntry u_char  rs  ) 
 


Generated on Fri Feb 23 17:29:01 2007 for SAM Internet Radio by  doxygen 1.4.4