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 char * title ()
 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 char * stationName ()
 

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

Member Function Documentation

◆ processCommand() [1/2]

bool processCommand ( const char *  input,
Print result 
)
inlineoverridevirtual

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

Implements AudioPlayerProtocol.

◆ processCommand() [2/2]

bool processCommand ( Stream input,
Print result 
)
inlineoverridevirtual

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

Reimplemented from AudioPlayerProtocol.

◆ setPlayer()

void setPlayer ( AudioPlayer player)
inlineoverridevirtual

Defines the player.

Reimplemented from AudioPlayerProtocol.


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