SYNOPSIS
#include <pcp.h>
Public Members
PCP (char *port=PCPDefaultPort, tcflag_t speed=PCPDefaultSpeed, const char *name=0)
PCP Object constructor.
~PCP ()
Your friendly destructor.
bool PCPInit (bool autoUpdate=false)
Initialise the radio.
bool PCPPowerUp ()
Powers the radio on.
bool PCPPowerDown ()
Powers the radio down.
bool PCPSetSpeed (tcflag_t)
Sets the speed for current session.
bool PCPSetPort (const char *)
Set the port for the current session.
bool PCPSetVolume (int)
Set the current session's volume.
bool PCPSetSquelch (int)
Set the current session's squelch.
bool PCPSetFreq (pcrfreq_t)
Set the current frequency.
bool PCPSetMode (const char *)
Set the current session's mode.
bool PCPSetFilter (const char *)
Sets current session's filter.
int PCPSigStrength ()
Querys the signal strength (int version).
const char* PCPSigStrengthStr ()
Signal strength query. (const char * version).
bool PCPSetToneSq (const char*)
Sets current session CTCSS.
bool PCPSetToneSq (float)
Sets session CTCSS based on a float value.
bool PCPSetAutoGain (bool)
Toggle autogain functionality.
bool PCPSetNB (bool)
Toggle Noiseblanking functionality.
bool PCPSetRFAttenuator (bool)
Toggle RF Attenuation functionality.
bool PCPIsOn ()
Inquire radio status.
bool PCPQueryOn ()
Querys radio acutator status.
bool PCPQuerySquelch ()
Querys radio's squelch status.
const char* PCPGetPort ()
Gets current port / serial device setting.
tcflag_t PCPGetSpeed_t ()
Gets current speed (tcflag_t version).
const char* PCPGetSpeed ()
Gets current speed (const char* version).
int PCPGetVolume ()
Gets current session's volume setting (int version).
const char* PCPGetVolumeStr ()
Gets current session's volume setting (const char* version).
int PCPGetSquelch ()
Gets current session's squelch setting (int version).
const char* PCPGetSquelchStr ()
Gets current session's squelch setting (const char* version).
pcrfreq_t PCPGetFreq ()
Gets current session's frequency setting (pcrfreq_t version).
const char* PCPGetFreqStr ()
Gets current session's frequency setting (const char* version).
const pcrcmd_t* PCPGetMode ()
Gets current session's mode setting (pcrcmd_t version).
const char* PCPGetModeStr ()
Gets current session's mode setting (const char* version).
const pcrcmd_t* PCPGetFilter ()
Gets current session's filter setting (pcrcmd_t version).
const char* PCPGetFilterStr ()
Get the current session's filter setting (const char* version).
const char* PCPGetToneSq ()
Gets the current session's tone squelch (undecoded version).
const char* PCPGetToneSqStr ()
Gets the current session's tone squelch (decoded version).
bool PCPGetAutoGain ()
Get current session's autogain value (bool version).
const char* PCPGetAutoGainStr ()
Get current session's autogain value (const char* version).
bool PCPGetNB ()
Get current session's noiseblank value (bool version).
const char* PCPGetNBStr ()
Get current session's noiseblank value (const char* version).
bool PCPGetRFAttenuator ()
Get current session's RF Attenuation value (bool version).
const char* PCPGetRFAttenuatorStr ()
Get current session's RF Attenuation value (const char* version).
const PRadInf PCPGetRadioInfo ()
Retrieves the current radio struct.
Private Members
bool PCPCheckResponse ()
Internally called method to check radio response.
PComm* PCPComm
The currently active Primitive Communication Object ( PComm ).
bool PCPStatus
The state of the PComm object (on or off).
bool PCPErrRead
Was there an error reading from the PComm object?
char PCPTemp [256]
Temporary buffer to hold PCP string data.
struct PRadInf* PCPRadio
Currently active radio data.
DETAILED DESCRIPTION
PCP is the Main API for documentation of the class.
PCP Is the actual object that interfaces with the GUI This API deals with the error handling and the calls that must be made to and from the radio, via the PComm serial i/o object.
See also: PComm pcrdef.h
Definition at line 82 of file pcp.h.
MEMBER FUNCTION DOCUMENTATION
PCP::PCP (char * port = PCPDefaultPort, tcflag_t speed = PCPDefaultSpeed, const char * name = 0)
PCP Object constructor.
Parameters:
- port the device to open
- speed the initial baudrate to open at
- name internal object name
Initialises the radio device and sets the default variables to:
- PCPSpeed to speed
- PCPVolume to 0
- PCPSquelch to 0
- PCPFreq to 146.000 MHz
- PCPMode to PCRMODNFM()
Definition at line 41 of file pcp.cpp.
PCP::~PCP ()
Your friendly destructor.
Deletes the Primitive Communication ( PComm ) object before exitting.
Definition at line 79 of file pcp.cpp.
bool PCP::PCPInit (bool autoUpdate = false)
Initialise the radio.
Parameters:
- autoUpdate Initialise the radio in autoUpdate mode
This function sends the initialsation command(s). Due to the hardware taking some time to initialize, we sleep for one second to let it catch up, then check to see if the radio was on. If it *was* on then it checks for a response.
After PCPCheckResponse tells it that the command succeeded, it sets PCPRadio->PCPAutoUpdate mode appropriately.
Returns: On success : true otherwise false.
See also: PCPAutoUpdate PCPCheckResponse() PCPStatus
Definition at line 90 of file pcp.cpp.
bool PCP::PCPPowerUp ()
Powers the radio on.
Turns the radio's receiver on. By sending the command code PCRPWRON()
Returns: true or false ( based on PCPCheckResponse() )
See also: PCPPowerDown() PCPCheckResponse() PCPStatus PCRPWRON() pcrdef.h
Definition at line 131 of file pcp.cpp.
bool PCP::PCPPowerDown ()
Powers the radio down.
Turns the radio's receiver off. By sending the command code PCRPWROFF
Returns: true or false ( based on PCPCheckResponse() )
See also: PCPPowerUp() PCPCheckResponse() PCPStatus PCRPWROFF() pcrdef.h
Definition at line 152 of file pcp.cpp.
bool PCP::PCPSetSpeed (tcflag_t speed)
Sets the speed for current session.
Parameters:
- speed baudrate as defined in termios.h
First we check to see if the baudrate passed in speed is right, if not then we just quietly return false. Then we decode speed and set PCPInitSpeed to pcrcmd_t version.
Then we tell the radio to switch speeds and set baudrate on the port by destroying PComm and reinitiating it with the new baud setting
Warning: follow these procedures to use this function.
- create the object (at last known baudrate).
- call init
- call power up
- call this function
- delete the object
- create the object with the new speed setting
Returns: true or false based on success.
See also: PCPGetSpeed() PCPGetSpeed_t() pcrcmd_t pcrdef.h PCPComm
Definition at line 173 of file pcp.cpp.
bool PCP::PCPSetPort (const char * port)
Set the port for the current session.
Sets port by closing the filedes and reopening it on the new port.
Returns: true or false if the serial device can be opened on the new port.
See also: PCPGetPort() PComm::PCOpen() PComm::PCClose()
Definition at line 246 of file pcp.cpp.
bool PCP::PCPSetVolume (int volume)
Set the current session's volume.
Parameters:
- volume an integer between 0 and 99
sprintf converts (and combines) the cmd PCRVOL() with the argument, such that the argument has a minimum field width of two chars. If the field is < 2 chars (ie: arg=5) then it pads the field with one zero.
Returns: true or false based on PCPCheckResponse() to indicate success or failure
See also: PCPVolume pcrcmd_t pcrdef.h
Definition at line 263 of file pcp.cpp.
bool PCP::PCPSetSquelch (int squelch)
Set the current session's squelch.
Parameters:
- squelch an integer between 0 and 99
sprintf converts (and combines) the cmd PCRSQL() with the argument squelch , such that the argument has a minimum field width of two chars. If the field is < 2 chars (ie: arg=5) then it pads the field with one zero.
Returns: true or false based on PCPCheckResponse() to indicate success or failure
See also: PCPSquelch pcrcmd_t pcrdef.h
Definition at line 292 of file pcp.cpp.
bool PCP::PCPSetFreq (pcrfreq_t freq)
Set the current frequency.
Parameters:
- freq passed frequency compliant to pcrfreq_t
check to see if the frequencies are within bounds. populate a string, with correctly padded 0's based on the frequency fed in.
This method, PCPSetMode() and PCPSetFilter() take the following steps
copy the header,
concat the newly converted/padded frequency,
concat mode,
concat filter,
concat suffix.
send the command to the radio, if it checks out set this as the new frequency
Returns: true or false based on success or failure
See also: pcrdef.h pcrfreq_t PCRFRQ()
Definition at line 322 of file pcp.cpp.
bool PCP::PCPSetMode (const char * mode)
Set the current session's mode.
Parameters:
- mode plain text string of mode (eg: "USB")
Valid arguments for mode:
- USB upper side band
- LSB lower side band
- AM amplitude modulated
- NFM narrow band FM
- WFM wide band FM
- CW continuous waveThe concept is the same as above ( PCPSetFreq() ) except it accepts standard text for "USB"/"LSB" etc... Use of the pcrdef codes are not necessary, they will be decoded based on mode.
Returns: true or false based on success or failure
See also: PCPRadio pcrdef.h
Definition at line 374 of file pcp.cpp.
bool PCP::PCPSetFilter (const char * filter)
Sets current session's filter.
Parameters:
- filter character string version of the filter
Valid arguments for filter:
- 3 3.0 kHz
- 6 6.0 kHz
- 15 15.0 kHz
- 50 50.0 kHz
- 230 230.0 kHzThe concept is the same as above ( PCPSetMode() ) it accepts standard text for "3"/"6" etc... Use of the pcrdef codes are not necessary, they will be decoded based on filter.
Returns: true or false based on success or failure
See also: PCPRadio pcrdef.h
Definition at line 441 of file pcp.cpp.
int PCP::PCPSigStrength ()
Querys the signal strength (int version).
Returns: integer value of 0-255 on signal strength.
See also: PCPSigStrengthStr() PCRQRST() pcrdef.h
Definition at line 766 of file pcp.cpp.
const char * PCP::PCPSigStrengthStr ()
Signal strength query. (const char * version).
Querys radio to read the current signal strength.
Returns: null on failure, otherwise a character string with the current signal strenth. This includes the I1 header, plus the last two characters which is the hex value from 00-99
See also: PCPSigStrength() PCRQRST() pcrdef.h
Definition at line 739 of file pcp.cpp.
bool PCP::PCPSetToneSq (const char * value)
Sets current session CTCSS.
Parameters:
- value character string of 01-35 hex
set's the tone squelch for the radio. The default is value 00 for off. The values are NOT the hz, but the pcrdef.h vals, 01=67.0 02=69.3 etc...
The valid for value are hex values from 00 for off through 35
Returns: true or false based on PCPCheckResponse() success or failure.
See also: pcrdef.h PCRTSQL()
Definition at line 503 of file pcp.cpp.
bool PCP::PCPSetToneSq (float passvalue)
Sets session CTCSS based on a float value.
Parameters:
- passvalue tone squelch in Hz
Since the previous method requires the programmer to remember the PCR-1000's internal number that corresponds to the tone squelch frequency, this overloaded method allows the programmer to pass a float, where the float is the frequency (Hz) in question.
Returns: true or false based on PCPCheckResponse() success or failure. On failure, it turns off CTCSS and returns false.
See also: pcrdef.h PCRTSQL()
Definition at line 537 of file pcp.cpp.
bool PCP::PCPSetAutoGain (bool value)
Toggle autogain functionality.
Parameters:
- value true or false for autogain on or off
Valid values for value are:
- true to activate autogain
- false to deactivate autogainSets the automagic gain control to value (on/off) true/false... checks the radio response if ok, then sets the value
Returns: true, on success otherwise returns false
See also: PCRAGC() PCRAGCON() PCRAGCOFF() pcrdef.h
Definition at line 623 of file pcp.cpp.
bool PCP::PCPSetNB (bool value)
Toggle Noiseblanking functionality.
Parameters:
- value true or false for noiseblanking on or off
Valid values for value are:
- true to activate noiseblanking
- false to deactivate noiseblankingSets the noise blanking to value (on/off) true/false... checks the radio response if ok, then sets the value
Returns: true, on success otherwise returns false
See also: PCPGetNB() PCPGetNBStr() PCRNB() PCRNBON() PCRNBOFF() pcrdef.h
Definition at line 655 of file pcp.cpp.
bool PCP::PCPSetRFAttenuator (bool value)
Toggle RF Attenuation functionality.
Parameters:
- value true or false for RF Attenuation on or off
Valid values for value are:
- true to activate RF Attenuation
- false to deactivate RF AttenuationSets the RF Attenuation to value (on/off) true/false... checks the radio response if ok, then sets the value
Returns: true, on success otherwise returns false
See also: PCPGetRFAttenuator() PCPGetRFAttenuatorStr() PCRRFA() PCRRFAON() PCRRFAOFF() pcrdef.h
Definition at line 687 of file pcp.cpp.
bool PCP::PCPIsOn ()
Inquire radio status.
Check to see if the radio is on based on the internally stored data. This function should only be called after the object has been initiated and is ready for use.
Returns: true or false for radio on or off.
See also: PCPQueryOn()
Definition at line 723 of file pcp.cpp.
PCP::PCPQueryOn ()
Querys radio acutator status.
Actually querys the radio for a status on it's receiver state (on or off). This differs from PCPIsOn() in that it makes a call to the radio, rather than checking a local variable
Returns: true if the radio's receiver is on, false otherwise.
See also: PCPIsOn()
Definition at line 802 of file pcp.cpp.
bool PCP::PCPQuerySquelch ()
Querys radio's squelch status.
Actually querys the radio for a status on it's squelch state (open or closed).
Returns: true if the radio's squelch is open or false otherwise.
See also: PCPIsOn()
Definition at line 832 of file pcp.cpp.
PCP::PCPGetPort ()
Gets current port / serial device setting.
Checks the PCPRadio struct for member PCPPort for the current port (serial) device setting (pathname).
Returns: character string consisting of the current session's device name (pathname)
See also: PCPSetPort()
Definition at line 862 of file pcp.cpp.
tcflag_t PCP::PCPGetSpeed_t ()
Gets current speed (tcflag_t version).
Checks PCPRadio struct for member PCPSpeed for the current speed (baudrate) setting.
Returns: tcflag_t baudrate.
See also: PCPGetSpeed()
Definition at line 882 of file pcp.cpp.
const char * PCP::PCPGetSpeed ()
Gets current speed (const char* version).
Checks PCPRadio struct for member PCPSpeed for the current speed (baudrate) setting. Decodes the tcflag_t baudrate in the struct
Returns: const character string baudrate
See also: PCPGetSpeed_t()
Definition at line 897 of file pcp.cpp.
int PCP::PCPGetVolume ()
Gets current session's volume setting (int version).
Checks PCPRadio struct for member PCPVolume for the current volume (hex) setting.
Returns: the integer value from 00-ff
See also: PCPGetVolumeStr()
Definition at line 927 of file pcp.cpp.
const char * PCP::PCPGetVolumeStr ()
Gets current session's volume setting (const char* version).
Checks PCPRadio struct for member PCPVolume for the current volume (hex) setting. Decodes the hex to a character string
Returns: the character string of current volume setting
See also: PCPGetVolume()
Definition at line 942 of file pcp.cpp.
int PCP::PCPGetSquelch ()
Gets current session's squelch setting (int version).
Checks PCPRadio struct for member PCPSquelch for the current squelch (hex) setting.
Returns: the integer value from 00-ff
See also: PCPGetSquelchStr()
Definition at line 959 of file pcp.cpp.
const char * PCP::PCPGetSquelchStr ()
Gets current session's squelch setting (const char* version).
Checks PCPRadio struct for member PCPSquelch for the current squelch (hex) setting. Decodes the integer into a character string
Returns: the character string of current squelch setting
See also: PCPGetSquelchStr()
Definition at line 974 of file pcp.cpp.
pcrfreq_t PCP::PCPGetFreq ()
Gets current session's frequency setting (pcrfreq_t version).
Checks PCPRadio struct for member PCPFreq for the current frequency setting.
Returns: the pcrfreq_t of current frequency setting
See also: PCPGetFreqStr()
Definition at line 991 of file pcp.cpp.
const char * PCP::PCPGetFreqStr ()
Gets current session's frequency setting (const char* version).
Checks PCPRadio struct for member PCPFreq for the current frequency setting. It converts the pcrfreq_t into a character string.
Returns: the character string of current frequency setting
See also: PCPGetFreq()
Definition at line 1008 of file pcp.cpp.
const pcrcmd_t * PCP::PCPGetMode ()
Gets current session's mode setting (pcrcmd_t version).
Checks PCPRadio struct for member PCPMode for the current mode setting.
Returns: the pcrcmd_t of current mode setting
See also: PCPGetModeStr()
Definition at line 1026 of file pcp.cpp.
const char * PCP::PCPGetModeStr ()
Gets current session's mode setting (const char* version).
Checks PCPRadio struct for member PCPMode for the current mode setting. Decodes the mode setting to plain english equivalent.
Returns: the plain english of current mode setting
See also: PCPGetMode() PCPSetMode()
Definition at line 1041 of file pcp.cpp.
const pcrcmd_t * PCP::PCPGetFilter ()
Gets current session's filter setting (pcrcmd_t version).
Checks PCPRadio struct for member PCPFilter for the current filter setting.
Returns: the pcrcmd_t of the current filter setting
See also: PCPGetFilterStr() PCPSetFilter()
Definition at line 1081 of file pcp.cpp.
const char * PCP::PCPGetFilterStr ()
Get the current session's filter setting (const char* version).
Checks PCPRadio struct for member PCPFilter for the current filter setting. It then decodes the pcrcmd_t version into standard string values.
Returns: the character string of the current filter setting
See also: PCPGetFilter() PCPSetFilter()
Definition at line 1096 of file pcp.cpp.
const char * PCP::PCPGetToneSq ()
Gets the current session's tone squelch (undecoded version).
Checks PCPRadio struct for member PCPToneSq for the current tone squelch setting.
Returns: the character string of the current tone squelch setting
See also: PCPGetToneSqStr() PCPSetToneSq()
Definition at line 1131 of file pcp.cpp.
const char * PCP::PCPGetToneSqStr ()
Gets the current session's tone squelch (decoded version).
Checks PCPRadio struct for member PCPToneSq for the current tone squelch setting. It is decoded into plain english and it's value returned.
Returns: the character string of the current tone squelch setting
See also: PCPGetToneSq() PCPSetToneSq()
Definition at line 1146 of file pcp.cpp.
bool PCP::PCPGetAutoGain ()
Get current session's autogain value (bool version).
Checks PCPRadio struct for member PCPAutoGain for the current auto-gain setting.
Returns: the boolean of the current setting. True/false :: On/off.
See also: PCPGetAutoGainStr() PCPSetAutoGain()
Definition at line 1164 of file pcp.cpp.
const char * PCP::PCPGetAutoGainStr ()
Get current session's autogain value (const char* version).
Checks PCPRadio struct for member PCPAutoGain for the current auto-gain setting. Decodes true and false into string values "1" and "0".
Returns: the character string of the current setting.
See also: PCPGetAutoGain() PCPSetAutoGain()
Definition at line 1179 of file pcp.cpp.
bool PCP::PCPGetNB ()
Get current session's noiseblank value (bool version).
Checks PCPRadio struct for member PCPNoiseBlank for the current auto-gain setting.
Returns: the boolean of the current setting. True/false :: On/off.
See also: PCPGetNBStr() PCPSetNB()
Definition at line 1197 of file pcp.cpp.
const char * PCP::PCPGetNBStr ()
Get current session's noiseblank value (const char* version).
Checks PCPRadio struct for member PCPNoiseBlank for the current auto-gain setting. Decodes the boolean value into the string "1" for true or "0" for false
Returns: the character string of the current setting. True/false :: "1"/"0"
See also: PCPGetNB() PCPSetNB()
Definition at line 1212 of file pcp.cpp.
bool PCP::PCPGetRFAttenuator ()
Get current session's RF Attenuation value (bool version).
Checks PCPRadio struct for member PCPRFAttenuator for the current RF Attenuation setting.
Returns: the boolean of the current setting. True/false :: On/off.
See also: PCPGetRFAttenuatorStr() PCPSetRFAttenuator()
Definition at line 1230 of file pcp.cpp.
const char * PCP::PCPGetRFAttenuatorStr ()
Get current session's RF Attenuation value (const char* version).
Checks PCPRadio struct for member PCPRFAttenuator for the current session's RF Attenuation setting. Decodes the boolean value into "1" for true or "0" for false.
Returns: the character string of the current setting. True/false :: "1"/"0"
See also: PCPGetRFAttenuator() PCPSetRFAttenuator()
Definition at line 1245 of file pcp.cpp.
const PRadInf PCP::PCPGetRadioInfo ()
Retrieves the current radio struct.
this gets the current radio information struct in case the user wants to save the state of the radio.
Returns: const PRadInf
See also: PRadInf
Definition at line 1263 of file pcp.cpp.
bool PCP::PCPCheckResponse () [private]
Internally called method to check radio response.
read from the radio for the PCRAOK() and PCRABAD() reply.
Returns: true - for PCRAOK false - for PCRABAD false - and sets ErrRead to true if garbage was read.
Definition at line 1268 of file pcp.cpp.
MEMBER DATA DOCUMENTATION
PComm* PCP::PCPComm [private]
The currently active Primitive Communication Object ( PComm ).
Definition at line 150 of file pcp.h.
bool PCP::PCPStatus [private]
The state of the PComm object (on or off).
Definition at line 152 of file pcp.h.
bool PCP::PCPErrRead [private]
Was there an error reading from the PComm object?
Definition at line 154 of file pcp.h.
char PCP::PCPTemp[256] [private]
Temporary buffer to hold PCP string data.
Definition at line 156 of file pcp.h.
struct PRadInf* PCP::PCPRadio [private]
Currently active radio data.
Definition at line 159 of file pcp.h.
AUTHOR
Generated automatically by Doxygen for Icom PCR-1000 Library from the source code.