arduino-audio-tools
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KARadioProtocol Class Reference

KA-Radio Protocol: We can use the KA-Radio protocol to control the audio player provided by the audiotools. Supported commands: play, instant, volume, volume+, volume-, pause, resume, stop, start, next, prev, mute, infos, version. Example: volume=50&play=128&infos See https://github.com/karawin/Ka-Radio32/blob/master/Interface.md. More...

#include <KARadioProtocol.h>

Inheritance diagram for KARadioProtocol:
AudioPlayerProtocol

Classes

struct  Action
 

Public Member Functions

 KARadioProtocol ()
 Empty constructor: call setPlayer to define the player.
 
 KARadioProtocol (AudioPlayer &player)
 Default constructor.
 
void addCommand (const char *cmd, bool(*cb)(AudioPlayer &player, Str &cmd, Str &par, Print &out, KARadioProtocol *self))
 Add a new command.
 
int index ()
 Provides the actual index.
 
bool processCommand (const char *input, Print &result) override
 
bool processCommand (Str &name, Str &arg, Print &result)
 Processes a single command.
 
bool processCommand (Stream &input, Print &result) override
 Proceess commands passed by Stream (e.g. Serial)
 
void setMaxInputBufferSize (int size)
 Defines the input buffer size used by the readLine function (default 256)
 
void setPlayer (AudioPlayer &player) override
 Defines the player.
 
const chartitle ()
 Provides the actual title.
 

Protected Member Functions

int getEndPos (StrView &line, int start)
 
int readLine (Stream &in, char *str, int max)
 Reads a line delimited by '
' from the stream.
 
const charstationName ()
 

Protected Attributes

Vector< Actionactions
 
int max_input_buffer_size = 256
 
AudioPlayerp_player = nullptr
 
Str title_str = "n/a"
 
int volume = 0
 

Detailed Description

KA-Radio Protocol: We can use the KA-Radio protocol to control the audio player provided by the audiotools. Supported commands: play, instant, volume, volume+, volume-, pause, resume, stop, start, next, prev, mute, infos, version. Example: volume=50&play=128&infos See https://github.com/karawin/Ka-Radio32/blob/master/Interface.md.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ KARadioProtocol() [1/2]

KARadioProtocol ( )
inline

Empty constructor: call setPlayer to define the player.

◆ KARadioProtocol() [2/2]

KARadioProtocol ( AudioPlayer player)
inline

Default constructor.

Member Function Documentation

◆ addCommand()

void addCommand ( const char cmd,
bool(*)(AudioPlayer &player, Str &cmd, Str &par, Print &out, KARadioProtocol *self)  cb 
)
inline

Add a new command.

◆ getEndPos()

int getEndPos ( StrView line,
int  start 
)
inlineprotected

◆ index()

int index ( )
inline

Provides the actual index.

◆ processCommand() [1/3]

bool processCommand ( const char input,
Print result 
)
inlineoverridevirtual

processes the commands and returns the result output via the Print object

Implements AudioPlayerProtocol.

◆ processCommand() [2/3]

bool processCommand ( Str name,
Str arg,
Print result 
)
inline

Processes a single command.

◆ processCommand() [3/3]

bool processCommand ( Stream input,
Print result 
)
inlineoverridevirtual

Proceess commands passed by Stream (e.g. Serial)

Reimplemented from AudioPlayerProtocol.

◆ readLine()

int readLine ( Stream in,
char str,
int  max 
)
inlineprotectedinherited

Reads a line delimited by '
' from the stream.

◆ setMaxInputBufferSize()

void setMaxInputBufferSize ( int  size)
inlineinherited

Defines the input buffer size used by the readLine function (default 256)

◆ setPlayer()

void setPlayer ( AudioPlayer player)
inlineoverridevirtual

Defines the player.

Reimplemented from AudioPlayerProtocol.

◆ stationName()

const char * stationName ( )
inlineprotected

◆ title()

const char * title ( )
inline

Provides the actual title.

Member Data Documentation

◆ actions

Vector<Action> actions
protected

◆ max_input_buffer_size

int max_input_buffer_size = 256
protectedinherited

◆ p_player

AudioPlayer* p_player = nullptr
protectedinherited

◆ title_str

Str title_str = "n/a"
protected

◆ volume

int volume = 0
protected

The documentation for this class was generated from the following file: