webradio/favlist.c File Reference

Go to the source code of this file.

Defines

#define FAVLIST_MAGIC   "FL1"
#define FAVLIST_SECTOR   16

Functions

static void FavListClear (void)
 Clear favorites list.
int FavListSet (int idx, CONST char *name, CONST char *uri)
 Set favorite list entry.
int FavListCopy (int src, int dst)
 Copy a favorites list entry.
int FavListSearch (int idx, int dir)
 Search favorite radio station.
size_t FavListSize (void)
 Calculate total size of the favorites list.
int FavListSave (void)
 Save favorites list in non-volatile memory.
int FavListLoad (void)
 Load favorites list from non-volatile memory.
void FavListResetFactory (void)
 Set pre-configured favorites list.

Variables

RADIOSTATION favlist [MAX_FAVORITES]


Define Documentation

#define FAVLIST_MAGIC   "FL1"

Definition at line 80 of file favlist.c.

Referenced by FavListLoad(), and FavListSave().

#define FAVLIST_SECTOR   16

Definition at line 81 of file favlist.c.

Referenced by FavListLoad(), and FavListSave().


Function Documentation

static void FavListClear ( void   )  [static]

Clear favorites list.

Will be called by FavListLoad() before loading a new list.

Definition at line 91 of file favlist.c.

References MAX_FAVORITES, and RADIOSTATION::rs_streams.

Referenced by FavListLoad(), and FavListResetFactory().

int FavListSet ( int  idx,
CONST char *  name,
CONST char *  uri 
)

Set favorite list entry.

Parameters:
idx Index of the entry. Use MAX_FAVORITES to add a new entry.
name Name of the station. Must be provided, if a new station is added. May be NULL when adding a URI. When used with an existing entry, the current name will be replaced.
uri URI of the stream, that will be added. If NULL, then all existing entries are cleared. If both, the name and the URI are NULL, then the list entry is cleared.
Returns:
Entry index on success, -1 otherwise.

Definition at line 123 of file favlist.c.

Referenced by AddStationUris(), CgiFavoritesControl(), FavListResetFactory(), main(), and ShoutCastAddStation().

int FavListCopy ( int  src,
int  dst 
)

Copy a favorites list entry.

Parameters:
src Index of the source entry.
dst Index of the destination entry.
Returns:
0 on success, -1 otherwise.

Definition at line 178 of file favlist.c.

Referenced by CgiFavoritesControl(), FavListResetFactory(), main(), and UserIfMainMenu().

int FavListSearch ( int  idx,
int  dir 
)

Search favorite radio station.

Parameters:
idx Start index.
dir Direction to search, 1 (forward) or -1 (backwards).
Returns:
Index of the new station or -1 if none available.

Definition at line 219 of file favlist.c.

Referenced by UserIfMainMenu().

size_t FavListSize ( void   ) 

Calculate total size of the favorites list.

Returns:
Number of bytes used.

Definition at line 249 of file favlist.c.

int FavListSave ( void   ) 

Save favorites list in non-volatile memory.

Returns:
0 on success, -1 otherwise.

Definition at line 275 of file favlist.c.

Referenced by CgiSettings(), and main().

int FavListLoad ( void   ) 

Load favorites list from non-volatile memory.

Returns:
0 on success, -1 otherwise.

Definition at line 316 of file favlist.c.

Referenced by main().

void FavListResetFactory ( void   ) 

Set pre-configured favorites list.

Definition at line 356 of file favlist.c.

Referenced by CgiSettings(), and main().


Variable Documentation

RADIOSTATION favlist[MAX_FAVORITES]

Definition at line 84 of file favlist.c.

Referenced by CgiStationFavorites(), ConfigSize(), main(), UserIfMainMenu(), and UserIfShowStatus().


© 2008 by egnite GmbH - visit www.ethernut.de