#include <hdcommands.h>
Public Member Functions | |
HDCommands () | |
void | setdefs (HDVals *) |
void | setioport (LinuxPort *) |
void | setlisten (HDListen *) |
void | setverbose (bool) |
void | setstreamwait (int) |
void | hd_power (string) |
void | hd_mute (string) |
void | hd_setitem (string, int, int) |
bool | hd_tune (string) |
bool | hd_tune (string, string) |
bool | hd_tune (int, string) |
bool | hd_tune (string, string, string) |
bool | hd_tune (int, int, string) |
void | hd_tuneupdown (string) |
void | hd_seekupdown (string) |
void | hdget (string) |
void | hd_seekall () |
void | hd_seekhd () |
Private Member Functions | |
void | sendcommand (list< string >) |
string | removedecimal (string) |
string | getnum (string, int) |
Private Attributes | |
bool | seekall |
bool | verbose |
int | streamlockwait |
LinuxPort * | ioport |
HDListen * | hdlisten |
HDVals * | hdvals |
HDCommands::HDCommands | ( | ) |
void HDCommands::setdefs | ( | HDVals * | hdv | ) |
Set the HDValue object so this class can access common variables.
hdv | the HDValue object needed |
void HDCommands::setioport | ( | LinuxPort * | iop | ) |
Specify the LinuxPort object for writing to the port and the radio.
iop | the port object needed to write to the serial port and radio |
void HDCommands::setlisten | ( | HDListen * | hdl | ) |
Provide a listener object -- needed to find out if we have streamlock in some cases.
hdl | the HDListen object we need to get data |
void HDCommands::setverbose | ( | bool | verbosity | ) |
Set the verbosity of this class to true if debugging statements are desired.
verbosity | true for debugging output to the console |
void HDCommands::setstreamwait | ( | int | wait | ) |
Specify how long to wait for the HDStreamlock when setting a subchannel.
wait | number of seconds to wait before returning with a false when trying to set the hdsubchannel |
void HDCommands::hd_power | ( | string | pmode | ) |
Turn the power on or off.
pmode | Either "on" or "off" to turn the power to that state. |
void HDCommands::hd_mute | ( | string | mmode | ) |
Turn the mute on or off.
mmode | Either "on" or "off" to turn the mute to that state. |
void HDCommands::hd_setitem | ( | string | setname, | |
int | level, | |||
int | scale | |||
) |
Set an item in the radio to a specific value.
setname | the name of the item to set | |
level | the level (or other number) to set a value to | |
scale | 0 if no scale is used, otherwise the top number in the scale |
bool HDCommands::hd_tune | ( | string | tuneinfo | ) |
Overloaded version of tune that takes the same format string as saved as the "tune" setting in the listener. It's specified as the frequency, an optional colon and subchannel, a space, and the band. The decimal in the number is optional.
tuneinfo | tune info in a form like "88.9:0 FM" |
bool HDCommands::hd_tune | ( | string | newfreq, | |
string | newband | |||
) |
Overloaded version of tuen that takes just frequency and band in string format. The subchannel will be defaulted to 0, which means no subchannel.
newfreq | the frequency to turn to | |
newband | the band for the new station |
bool HDCommands::hd_tune | ( | int | newfreq, | |
string | newband | |||
) |
Overloaded version of tuen that takes just frequency and band in int and string format. The subchannel will be defaulted to 0, which means no subchannel.
newfreq | the frequency to turn to | |
newband | the band for the new station |
bool HDCommands::hd_tune | ( | string | newfreq, | |
string | newchan, | |||
string | newband | |||
) |
Overloaded version of tuen with only string arguments. Basically we convert these arguments to the forms used by the main hd_tune() function.
newfreq | the frequency to turn to | |
newchan | the new subchannel to turn to | |
newband | the band for the new station |
bool HDCommands::hd_tune | ( | int | newfreq, | |
int | newchannel, | |||
string | newband | |||
) |
The main tune routine to tune the radio to a frequency, band, and subchannel.
newfreq | the frequency to turn to | |
newchannel | the new subchannel to turn to | |
newband | the band for the new station |
void HDCommands::hd_tuneupdown | ( | string | tunedir | ) |
Adjust the tuner up or down either to the next frequency or the next subchannel in the specified direction.
tunedir | either "up" or "down" for the direction to tune |
void HDCommands::hd_seekupdown | ( | string | seek_dir | ) |
Seek a new station. Other functions can be used to specify whether to seek only HD stations or seek all stations.
seek_dir | direction ("up" or "down") to seek for a new station |
void HDCommands::hdget | ( | string | mode | ) |
Send a command to the radio to return data for a particular mode or value, such as the state of power or mute or the volume level or the current frequency info.
mode | the mode to ask the radio to return |
void HDCommands::hd_seekall | ( | ) |
Specify to seek ALL stations when seeking.
void HDCommands::hd_seekhd | ( | ) |
Specify to seek ONLY HD stations and avoid stopping at non-HD stations when seeking.
void HDCommands::sendcommand | ( | list< string > | inlist | ) | [private] |
Send the actual command to the radio. The data is passed to us in a list of strings. We go through each string, add all the hex numbers into a long string and total their values to use in the checksum. (We use them in a string because it's easier to enter them into maps and other info as humans and it lets us easily print them out for reference, as well as defining one standard way to store them.)
inlist | list of different hex strings to send to the radio |
string HDCommands::removedecimal | ( | string | num | ) | [private] |
Remove the decimal point from a number stored as a string.
num | number in string form |
string HDCommands::getnum | ( | string | str, | |
int | ipos | |||
) | [private] |
Get a number (in string form) from within a string starting at a specific position.
str | the string with the number (and probably more data as well) | |
ipos | the position to start the extraction at |
bool HDCommands::seekall [private] |
bool HDCommands::verbose [private] |
int HDCommands::streamlockwait [private] |
LinuxPort* HDCommands::ioport [private] |
HDListen* HDCommands::hdlisten [private] |
HDVals* HDCommands::hdvals [private] |