Logo Search packages:      
Sourcecode: icomlib version File versions  Download package

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.

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.

References PCPCheckResponse(), PCPComm, PRadInf::PCPFilter, PRadInf::PCPFreq, PRadInf::PCPMode, PCPRadio, PCPTemp, and PComm::PCTell().

{
    char freqConv[32];
    memset(freqConv, '\0', sizeof(freqConv));

    if ((LOWERFRQ<=freq)&&(freq<=UPPERFRQ)) {
        memset(PCPTemp, '\0', sizeof(PCPTemp));
        sprintf(freqConv, "%0.10lu", freq);
        strcpy(PCPTemp, PCRFRQ);
        strcat(PCPTemp, freqConv);
        strcat(PCPTemp, PCPRadio->PCPMode);
        strcat(PCPTemp, PCPRadio->PCPFilter);
        strcat(PCPTemp, "00");
        PCPComm->PCTell(PCPTemp);
        if (PCPCheckResponse()) {
            PCPRadio->PCPFreq=freq;
#ifdef DEBUG_VER_
          fprintf(stderr, "PCP: PCPSETFREQ - Success\n");
#endif
            return true;
        }
    }
#ifdef DEBUG_VER_
      fprintf(stderr, "PCP: PCPSETFREQ - Failed\n");
#endif
    return false;
}


Generated by  Doxygen 1.6.0   Back to index