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

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 wave
The 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.

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

{
    char freqConv[32];
    char temp[8];

    memset(PCPTemp, '\0', sizeof(PCPTemp));
    sprintf(freqConv, "%0.10lu", PCPRadio->PCPFreq);
    strcpy(PCPTemp, PCRFRQ);
    strcat(PCPTemp, freqConv);

    if ( strncmp(mode, "AM", 2)==0 ) {
      strcat(PCPTemp, PCRMODAM);
      strcpy(temp, PCRMODAM);
    } else if ( strncmp(mode, "CW", 2)== 0 ) {
      strcat(PCPTemp, PCRMODCW);
      strcpy(temp, PCRMODCW);
    } else if ( strncmp(mode, "LSB", 3)==0 ) {
      strcat(PCPTemp, PCRMODLSB);
      strcpy(temp, PCRMODLSB);
    } else if ( strncmp(mode, "USB", 3)==0 ) {
      strcat(PCPTemp, PCRMODUSB);
      strcpy(temp, PCRMODUSB);
    } else if ( strncmp(mode, "NFM", 3)==0 ) {
      strcat(PCPTemp, PCRMODNFM);
      strcpy(temp, PCRMODNFM);
    } else if ( strncmp(mode, "WFM", 3)==0 ) {
      strcat(PCPTemp, PCRMODWFM);
      strcpy(temp, PCRMODWFM);
    } else {
      return false;
    }

    strcat(PCPTemp, PCPRadio->PCPFilter);
    strcat(PCPTemp, "00");
    PCPComm->PCTell(PCPTemp);
    if (PCPCheckResponse()) {
#ifdef DEBUG_VER_
      fprintf(stderr, "Storing PCPRadio->PCPMode: %s\n", temp);
#endif // DEBUG_VER_
        strcpy(PCPRadio->PCPMode,temp);
        return true;
    }
    
    return false;

}


Generated by  Doxygen 1.6.0   Back to index