Main Page   Compound List   File List   Header Files   Sources   Compound Members   File Members  

pcp.cpp

00001 /*
00002    Copyright (C) 1999 PolyWog and Javaman for Ghetto.Org
00003    This file is part of the PCR-1000 API Library.
00004 
00005    The PCR-1000 API Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public License as
00007    published by the Free Software Foundation; either version 2 of the
00008    License, or (at your option) any later version.
00009 
00010    The PCR-1000 API Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with the PCR-1000 API Library; see the file LICENSE.  If not,
00017    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.
00019  */
00020 
00021 /*
00022  *  This file declares PCP.
00023  *  PCP Is the actual object that interfaces with the GUI
00024  *  This API deals with the error handling and the calls
00025  *  that must be made to and from the radio, via the PComm
00026  *  serial i/o object.
00027  */
00028 
00029 #include "pcp.h"
00030 
00031 #include <stdio.h>
00032 #include <unistd.h>
00033 #include <stdlib.h>
00034 
00035 #if defined (SunOS) || defined (Irix)
00036 #include <strings.h>
00037 #else // def SunOs/Irix
00038 #include <string.h>
00039 #endif // def SunOs/Irix
00040 
00041 PCP :: PCP(char *port, tcflag_t speed, const char *name)
00042 {
00043     PCPRadio = new PRadInf;
00044     PCPComm = new PComm(port, speed, name);
00045 
00046     bzero(PCPRadio, sizeof( PRadInf));
00047     bzero(PCPTemp, sizeof(PCPTemp));
00048 
00049     strncpy(PCPRadio->PCPPort, port, 0xff);
00050     PCPRadio->PCPSpeed = speed;
00051     PCPRadio->PCPVolume = 0;
00052     PCPRadio->PCPSquelch = 0;
00053     PCPRadio->PCPFreq = 146000000;
00054     strncpy(PCPRadio->PCPMode, PCRMODNFM, sizeof(PCPRadio->PCPMode));
00055     strncpy(PCPRadio->PCPFilter, PCRFLTR15, sizeof(PCPRadio->PCPFilter));
00056     PCPRadio->PCPToneSq=0;
00057     PCPRadio->PCPToneSqFloat=0.0;
00058     PCPRadio->PCPAutoGain=false;
00059     PCPRadio->PCPNoiseBlank=false;
00060     PCPRadio->PCPRFAttenuator=false;
00061     PCPRadio->PCPAutoUpdate = false;
00062     PCPStatus = false;
00063 }
00079 PCP :: ~PCP()
00080 {
00081     delete PCPComm;
00082 }
00090 bool PCP :: PCPInit(bool autoUpdate)
00091 {
00092     if (autoUpdate==false) {
00093         PCPComm->PCTell(PCRINITM);
00094         fprintf(stderr, "Radio is coming up. Please wait...\n");
00095         sleep(1); 
00096         if (PCPStatus) 
00097         if (PCPCheckResponse()) {
00098             PCPRadio->PCPAutoUpdate=false;
00099             return true;
00100         }
00101     } else {
00102         PCPComm->PCTell(PCRINITA);
00103         sleep(1);
00104         if (PCPStatus)
00105         if (PCPCheckResponse()) {
00106             PCPRadio->PCPAutoUpdate=true;
00107             return true;
00108         }
00109     }
00110 
00111     return false;
00112 }
00131 bool PCP :: PCPPowerUp()
00132 {
00133     PCPComm->PCTell(PCRPWRON);
00134     if (PCPCheckResponse()) {
00135 //      PCPCheckResponse();
00136         PCPStatus=true;
00137         return true;
00138     } 
00139     return false;
00140 }
00152 bool PCP :: PCPPowerDown()
00153 {
00154     PCPComm->PCTell(PCRPWROFF);
00155     // if (PCPCheckResponse()) {
00156         PCPCheckResponse();
00157         PCPStatus=false;
00158         return true;
00159     // } 
00160     // return false;
00161 }
00173 bool PCP :: PCPSetSpeed(tcflag_t speed)
00174 {
00175     if ( (B300<=speed)&&(speed<=B38400) ) {
00176         bzero(PCPRadio->PCPInitSpeed, sizeof(PCPRadio->PCPInitSpeed));
00177         switch (speed) {
00178                 case B38400:
00179                         // you probably want to set the speed
00180                         // to fastest available, so let's put
00181                         // this here first
00182                         strncpy(PCPRadio->PCPInitSpeed, PCRBD38400,
00183                                 sizeof(PCPRadio->PCPInitSpeed)-1);
00184                         break;
00185                 case B19200:
00186                         strncpy(PCPRadio->PCPInitSpeed, PCRBD19200,
00187                                 sizeof(PCPRadio->PCPInitSpeed)-1);
00188                         break;
00189                 case B300:
00190                         strncpy(PCPRadio->PCPInitSpeed, PCRBD300,
00191                                 sizeof(PCPRadio->PCPInitSpeed)-1);
00192                         break;
00193                 case B1200:
00194                         strncpy(PCPRadio->PCPInitSpeed, PCRBD1200,
00195                                 sizeof(PCPRadio->PCPInitSpeed)-1);
00196                         break;
00197                 case B2400:
00198                         strncpy(PCPRadio->PCPInitSpeed, PCRBD2400,
00199                                 sizeof(PCPRadio->PCPInitSpeed)-1);
00200                         break;
00201                 default:
00202                         // if all else fails, we'll always
00203                         // have paris! ~=^)
00204                         strncpy(PCPRadio->PCPInitSpeed, PCRBD9600,
00205                                 sizeof(PCPRadio->PCPInitSpeed)-1);
00206         }
00207         PCPComm->PCTell(PCPRadio->PCPInitSpeed);
00208         delete PCPComm;
00209         PCPComm = new PComm(PCPRadio->PCPPort, speed, "PCPComm_R");
00210 // investigate possible responses, i dont think one is given.
00211 //      PCPCheckResponse();
00212                 PCPRadio->PCPSpeed = speed;
00213                 return true;
00214     }
00215 
00216     return false;
00217 }
00246 bool PCP :: PCPSetPort(const char *port) 
00247 {
00248     PCPComm->PCClose();
00249     return(PCPComm->PCOpen(port));
00250 }
00263 bool PCP :: PCPSetVolume(int volume) 
00264 {
00265     if ((0<=volume)&&(volume<=99)) {
00266         bzero(PCPTemp, sizeof(PCPTemp));
00267         sprintf(PCPTemp, "%s%0.2d", PCRVOL, volume);
00268         PCPComm->PCTell(PCPTemp);
00269         if (PCPCheckResponse()) {
00270             PCPRadio->PCPVolume=volume;
00271             return true;
00272         }
00273     }
00274 
00275     return false;
00276 }
00292 bool PCP :: PCPSetSquelch(int squelch) 
00293 {
00294     if ((0<=squelch)&&(squelch<=99)) {
00295         bzero(PCPTemp, sizeof(PCPTemp));
00296         sprintf(PCPTemp, "%s%0.2d", PCRSQL, squelch);
00297         PCPComm->PCTell(PCPTemp);
00298         if (PCPCheckResponse()) {
00299             PCPRadio->PCPSquelch=squelch;
00300             return true;
00301         }
00302     }
00303 
00304     return false;
00305 }
00322 bool PCP :: PCPSetFreq(pcrfreq_t freq)
00323 {
00324     char freqConv[32];
00325     bzero(freqConv, sizeof(freqConv));
00326 
00327     if ((LOWERFRQ<=freq)&&(freq<=UPPERFRQ)) {
00328         bzero(PCPTemp, sizeof(PCPTemp));
00329         sprintf(freqConv, "%0.10lu", freq);
00330         strcpy(PCPTemp, PCRFRQ);
00331         strcat(PCPTemp, freqConv);
00332         strcat(PCPTemp, PCPRadio->PCPMode);
00333         strcat(PCPTemp, PCPRadio->PCPFilter);
00334         strcat(PCPTemp, "00");
00335         PCPComm->PCTell(PCPTemp);
00336         if (PCPCheckResponse()) {
00337             PCPRadio->PCPFreq=freq;
00338 #ifdef DEBUG_VER_
00339             fprintf(stderr, "PCP: PCPSETFREQ - Success\n");
00340 #endif
00341             return true;
00342         }
00343     }
00344 #ifdef DEBUG_VER_
00345         fprintf(stderr, "PCP: PCPSETFREQ - Failed\n");
00346 #endif
00347     return false;
00348 }
00374 bool PCP :: PCPSetMode(const char *mode)
00375 {
00376     char freqConv[32];
00377     char temp[8];
00378 
00379     bzero(PCPTemp, sizeof(PCPTemp));
00380     sprintf(freqConv, "%0.10lu", PCPRadio->PCPFreq);
00381     strcpy(PCPTemp, PCRFRQ);
00382     strcat(PCPTemp, freqConv);
00383 
00384     if ( strncmp(mode, "AM", 2)==0 ) {
00385         strcat(PCPTemp, PCRMODAM);
00386         strcpy(temp, PCRMODAM);
00387     } else if ( strncmp(mode, "CW", 2)== 0 ) {
00388         strcat(PCPTemp, PCRMODCW);
00389         strcpy(temp, PCRMODCW);
00390     } else if ( strncmp(mode, "LSB", 3)==0 ) {
00391         strcat(PCPTemp, PCRMODLSB);
00392         strcpy(temp, PCRMODLSB);
00393     } else if ( strncmp(mode, "USB", 3)==0 ) {
00394         strcat(PCPTemp, PCRMODUSB);
00395         strcpy(temp, PCRMODUSB);
00396     } else if ( strncmp(mode, "NFM", 3)==0 ) {
00397         strcat(PCPTemp, PCRMODNFM);
00398         strcpy(temp, PCRMODNFM);
00399     } else if ( strncmp(mode, "WFM", 3)==0 ) {
00400         strcat(PCPTemp, PCRMODWFM);
00401         strcpy(temp, PCRMODWFM);
00402     } else {
00403         return false;
00404     }
00405 
00406     strcat(PCPTemp, PCPRadio->PCPFilter);
00407     strcat(PCPTemp, "00");
00408     PCPComm->PCTell(PCPTemp);
00409     if (PCPCheckResponse()) {
00410 #ifdef DEBUG_VER_
00411         fprintf(stderr, "Storing PCPRadio->PCPMode: %s\n", temp);
00412 #endif // DEBUG_VER_
00413         strcpy(PCPRadio->PCPMode,temp);
00414         return true;
00415     }
00416     
00417     return false;
00418 
00419 }
00441 bool PCP :: PCPSetFilter(const char *filter)
00442 {
00443     char freqConv[32];
00444     char temp[8];
00445 
00446     bzero(PCPTemp, sizeof(PCPTemp));
00447     sprintf(freqConv, "%0.10lu", PCPRadio->PCPFreq);
00448     strcpy(PCPTemp, PCRFRQ);
00449     strcat(PCPTemp, freqConv);
00450     strcat(PCPTemp, PCPRadio->PCPMode);
00451 
00452     if ( strncmp(filter, "3", 1)==0 ) {
00453         strcat(PCPTemp, PCRFLTR3);
00454         strcpy(temp, PCRFLTR3);
00455     } else if ( strncmp(filter, "6", 1)== 0 ) {
00456         strcat(PCPTemp, PCRFLTR6);
00457         strcpy(temp, PCRFLTR6);
00458     } else if ( strncmp(filter, "15", 2)==0 ) {
00459         strcat(PCPTemp, PCRFLTR15);
00460         strcpy(temp, PCRFLTR15);
00461     } else if ( strncmp(filter, "50", 2)==0 ) {
00462         strcat(PCPTemp, PCRFLTR50);
00463         strcpy(temp, PCRFLTR50);
00464     } else if ( strncmp(filter, "230", 3)==0 ) {
00465         strcat(PCPTemp, PCRFLTR230);
00466         strcpy(temp, PCRFLTR230);
00467     } else {
00468         return false;
00469     }
00470 
00471     strcat(PCPTemp, "00");
00472     PCPComm->PCTell(PCPTemp);
00473     if (PCPCheckResponse()) {
00474 #ifdef DEBUG_VER_
00475         fprintf(stderr, "Storing PCPRadio->PCPFilter: %s\n", temp);
00476 #endif DEBUG_VER_
00477         strcpy(PCPRadio->PCPFilter,temp);
00478         return true;
00479     }
00480 
00481     return false;
00482 }
00503 bool PCP :: PCPSetToneSq(const char *value)
00504 {
00505 #ifdef DEBUG_VER_
00506         fprintf(stderr, "PCP: PCPSETTONESQ (string) - %s\n", value);
00507 #endif // DEBUG_VER_ 
00508 
00509         bzero(PCPTemp, sizeof(PCPTemp));
00510         strncpy(PCPTemp, PCRTSQL, sizeof(PCPTemp));
00511         strncat(PCPTemp, value, sizeof(PCPTemp));
00512         PCPComm->PCTell(PCPTemp);
00513         if (PCPCheckResponse()) {
00514                 PCPRadio->PCPToneSq=value;
00515                 return true;
00516         }
00517 
00518         return false;
00519 }
00537 bool PCP :: PCPSetToneSq(float passvalue)
00538 {
00539 #ifdef DEBUG_VER_
00540         fprintf(stderr, "PCP: PCPSETTONESQ (float) - %f\n", passvalue);
00541 #endif // DEBUG_VER_ 
00542 
00543         int tone;
00544 
00545         tone = (int)(passvalue * 10.0 + .1);  // Hack to remove truncating errors.
00546         PCPRadio->PCPToneSqFloat=passvalue;             
00547 
00548         switch (tone)
00549         {
00550                 case 0: return PCPSetToneSq("00"); break;
00551                 case 670: return PCPSetToneSq("01"); break;
00552                 case 693: return PCPSetToneSq("02"); break;
00553                 case 710: return PCPSetToneSq("03"); break;
00554                 case 719: return PCPSetToneSq("04"); break;
00555                 case 744: return PCPSetToneSq("05"); break;
00556                 case 770: return PCPSetToneSq("06"); break;
00557                 case 797: return PCPSetToneSq("07"); break;
00558                 case 825: return PCPSetToneSq("08"); break;
00559                 case 854: return PCPSetToneSq("09"); break;
00560                 case 885: return PCPSetToneSq("0A"); break;
00561                 case 915: return PCPSetToneSq("0B"); break;
00562                 case 948: return PCPSetToneSq("0C"); break;
00563                 case 974: return PCPSetToneSq("0D"); break;
00564                 case 1000: return PCPSetToneSq("0E"); break;
00565                 case 1035: return PCPSetToneSq("0F"); break;
00566                 case 1072: return PCPSetToneSq("10"); break;
00567                 case 1109: return PCPSetToneSq("11"); break;
00568                 case 1148: return PCPSetToneSq("12"); break;
00569                 case 1188: return PCPSetToneSq("13"); break;
00570                 case 1230: return PCPSetToneSq("14"); break;
00571                 case 1273: return PCPSetToneSq("15"); break;
00572                 case 1318: return PCPSetToneSq("16"); break;
00573                 case 1365: return PCPSetToneSq("17"); break;
00574                 case 1413: return PCPSetToneSq("18"); break;
00575                 case 1462: return PCPSetToneSq("19"); break;
00576                 case 1514: return PCPSetToneSq("1A"); break;
00577                 case 1567: return PCPSetToneSq("1B"); break;
00578                 case 1598: return PCPSetToneSq("1C"); break;
00579                 case 1622: return PCPSetToneSq("1D"); break;
00580                 case 1655: return PCPSetToneSq("1E"); break;
00581                 case 1679: return PCPSetToneSq("1F"); break;
00582                 case 1713: return PCPSetToneSq("20"); break;
00583                 case 1738: return PCPSetToneSq("21"); break;
00584                 case 1773: return PCPSetToneSq("22"); break;
00585                 case 1799: return PCPSetToneSq("23"); break;
00586                 case 1835: return PCPSetToneSq("24"); break;
00587                 case 1862: return PCPSetToneSq("25"); break;
00588                 case 1899: return PCPSetToneSq("26"); break;
00589                 case 1928: return PCPSetToneSq("27"); break;
00590                 case 1966: return PCPSetToneSq("28"); break;
00591                 case 1995: return PCPSetToneSq("29"); break;
00592                 case 2035: return PCPSetToneSq("2A"); break;
00593                 case 2065: return PCPSetToneSq("2B"); break;
00594                 case 2107: return PCPSetToneSq("2C"); break;
00595                 case 2181: return PCPSetToneSq("2D"); break;
00596                 case 2257: return PCPSetToneSq("2E"); break;
00597                 case 2291: return PCPSetToneSq("2F"); break;
00598                 case 2336: return PCPSetToneSq("30"); break;
00599                 case 2418: return PCPSetToneSq("31"); break;
00600                 case 2503: return PCPSetToneSq("32"); break;
00601                 case 2541: return PCPSetToneSq("33"); break;
00602                 default: PCPSetToneSq("00"); break;
00603         }
00604         return false;
00605 }
00623 bool PCP :: PCPSetAutoGain(bool value)
00624 {
00625 #ifdef DEBUG_VER_
00626         fprintf(stderr, "PCP: PCPSETAUTOGAIN - %d\n", value);
00627 #endif // DEBUG_VER_ 
00628 
00629         (value)?(PCPComm->PCTell(PCRAGCON)):(PCPComm->PCTell(PCRAGCOFF));
00630 
00631         if (PCPCheckResponse()) {
00632                 PCPRadio->PCPAutoGain=value;
00633                 return true;
00634         }
00635 
00636         return false;
00637 }
00655 bool PCP :: PCPSetNB(bool value)
00656 {
00657 #ifdef DEBUG_VER_
00658         fprintf(stderr, "PCP: PCPSETNB - %d\n", value);
00659 #endif // DEBUG_VER_ 
00660 
00661         (value)?(PCPComm->PCTell(PCRNBON)):(PCPComm->PCTell(PCRNBOFF));
00662         
00663         if (PCPCheckResponse()) {
00664                 PCPRadio->PCPNoiseBlank=value;
00665                 return true;
00666         }
00667 
00668         return false;
00669 }
00687 bool PCP :: PCPSetRFAttenuator ( bool value )
00688 {
00689 #ifdef DEBUG_VER_
00690         fprintf(stderr, "PCP: PCPSETRFATTENUATOR - %d\n", value);
00691 #endif // DEBUG_VER_ 
00692 
00693         (value)?(PCPComm->PCTell(PCRRFAON)):(PCPComm->PCTell(PCRRFAOFF));
00694 
00695         if (PCPCheckResponse()) {
00696                 PCPRadio->PCPRFAttenuator=value;
00697                 return true;
00698         }
00699 
00700         return false;
00701 }
00719 
00720  // getter methods //
00722 
00723 bool PCP :: PCPIsOn()
00724 {
00725     return PCPStatus;
00726 }
00739 const char *PCP :: PCPSigStrengthStr()
00740 {
00741 #ifdef DEBUG_VER_
00742         fprintf(stderr, "PCP: PCPSIGSTRENGTH (string) Called\n");
00743 #endif // DEBUG_VER_ 
00744         if(PCPComm->PCAsk(PCRQRST)) {
00745                 if(PCPComm->PCHear(PCPTemp)) {
00746                         return (const char*)PCPTemp;
00747                 }
00748         }
00749 
00750         return 0;
00751 }
00766 int PCP :: PCPSigStrength()
00767 {
00768 #ifdef DEBUG_VER_
00769         fprintf(stderr, "PCP: PCPSIGSTRENGTH (int) Called\n");
00770 #endif // DEBUG_VER_
00771 
00772         int sigstr;
00773         char digit;
00774         if(PCPComm->PCAsk(PCRQRST)) {
00775                 if(PCPComm->PCHear(PCPTemp)) {
00776                         digit = PCPTemp[2];
00777                         if((digit >= 'A') && (digit <= 'F'))
00778                                 sigstr = (digit - 'A' + 1) * 16;
00779                         else
00780                                 sigstr = atoi(&digit) * 16;
00781 
00782                         digit = PCPTemp[3];
00783                         if((digit >= 'A') && (digit <= 'F'))
00784                                 sigstr += digit - 'A' + 1;
00785                         else
00786                                 sigstr += atoi(&digit);
00787 
00788                         return sigstr;
00789                 }
00790         }
00791 
00792         return 0;
00793 }
00802 bool PCP :: PCPQueryOn()
00803 {
00804 #ifdef DEBUG_VER_
00805         fprintf(stderr, "PCP: PCPQUERYON Called\n");
00806 #endif // DEBUG_VER_
00807         if(PCPComm->PCAsk("H1")) {
00808                 if(PCPComm->PCHear(PCPTemp)) {
00809                         if(strcmp(PCPTemp, "H101") == 0)
00810                                 return true;
00811                         else
00812                                 return false;
00813                 }
00814         }
00815 
00816         return false;
00817 }
00832 bool PCP :: PCPQuerySquelch()
00833 {
00834         char __tempvar1[8];
00835         bzero(__tempvar1, sizeof(__tempvar1));
00836         strncpy(__tempvar1, PCRASQL, sizeof(__tempvar1)-1);
00837         strncat(__tempvar1, PCRASQLCL, sizeof(__tempvar1)-strlen(__tempvar1)-1);
00838 
00839         if (PCPComm->PCAsk(PCRQSQL)) {
00840                 if(PCPComm->PCHear(PCPTemp)) {
00841                         if (strncmp(PCPTemp, __tempvar1, 4)==0) {
00842                                 return false;
00843                         } else {
00844                                 return true;
00845                         }
00846                 }
00847         }
00848         return false;
00849 }
00862 const char *PCP :: PCPGetPort()
00863 // return a character string representing the current
00864 // port setting /dev/*
00865 {
00866     return PCPRadio->PCPPort;
00867 }
00882 tcflag_t PCP :: PCPGetSpeed_t()
00883 {
00884         return PCPRadio->PCPSpeed;
00885 }
00897 const char *PCP :: PCPGetSpeed()
00898 {
00899         switch(PCPRadio->PCPSpeed) {
00900                 case B300: return "300"; break;
00901                 case B600: return "600"; break;
00902                 case B1200: return "1200"; break;
00903                 case B1800: return "1800"; break;
00904                 case B2400: return "2400"; break;
00905                 case B4800: return "4800"; break;
00906                 case B9600: return "9600"; break;
00907                 case B19200: return "19200"; break;
00908                 case B38400: return "38400"; break;
00909                 case B57600: return "57600"; break;
00910                 default: return "unknown"; break;
00911         }
00912         return "unknown";
00913 }
00927 int PCP :: PCPGetVolume()
00928 {
00929     return (PCPRadio->PCPVolume);
00930 }
00942 const char *PCP :: PCPGetVolumeStr()
00943 {
00944     sprintf(PCPTemp, "%d", PCPRadio->PCPVolume);
00945     return (PCPTemp);
00946 }
00959 int PCP :: PCPGetSquelch()
00960 {
00961     return (PCPRadio->PCPSquelch);
00962 }
00974 const char *PCP :: PCPGetSquelchStr()
00975 {
00976     sprintf(PCPTemp, "%d", PCPRadio->PCPSquelch);
00977     return (PCPTemp);
00978 }
00991 pcrfreq_t PCP :: PCPGetFreq()
00992 {
00993     return PCPRadio->PCPFreq;
00994 }
01008 const char *PCP :: PCPGetFreqStr()
01009 {
01010     sprintf(PCPTemp, "%0.10lu", PCPRadio->PCPFreq);
01011     return PCPTemp;
01012 }
01026 const pcrcmd_t *PCP :: PCPGetMode()
01027 {
01028     return (PCPRadio->PCPMode);
01029 }
01041 const char *PCP :: PCPGetModeStr()
01042 {
01043     bzero(PCPTemp, sizeof(PCPTemp));
01044 
01045     if (strcmp(PCRMODWFM, PCPRadio->PCPMode)==0) {
01046         strcpy(PCPTemp, "WFM");
01047         return PCPTemp;
01048     } else if (strcmp(PCRMODNFM, PCPRadio->PCPMode)==0) {
01049         strcpy(PCPTemp, "NFM");
01050         return PCPTemp;
01051     } else if (strcmp(PCRMODCW, PCPRadio->PCPMode)==0) {
01052         strcpy(PCPTemp, "CW");
01053         return PCPTemp;
01054     } else if (strcmp(PCRMODAM, PCPRadio->PCPMode)==0) {
01055         strcpy(PCPTemp, "AM");
01056         return PCPTemp;
01057     } else if (strcmp(PCRMODUSB, PCPRadio->PCPMode)==0) {
01058         strcpy(PCPTemp, "USB");
01059         return PCPTemp;
01060     } else if (strcmp(PCRMODLSB, PCPRadio->PCPMode)==0) {
01061         strcpy(PCPTemp, "LSB");
01062         return PCPTemp;
01063     } 
01064     
01065     strcpy(PCPTemp, "UNKNOWN");
01066     return PCPTemp;
01067 
01068 }
01081 const pcrcmd_t *PCP :: PCPGetFilter()
01082 {
01083     return (PCPRadio->PCPFilter);
01084 }
01096 const char *PCP :: PCPGetFilterStr()
01097 {
01098     bzero(PCPTemp, sizeof(PCPTemp));
01099 
01100     if (strcmp(PCRFLTR230, PCPRadio->PCPFilter)==0) {
01101         strcpy(PCPTemp, "230");
01102         return PCPTemp;
01103     } else if (strcmp(PCRFLTR50, PCPRadio->PCPFilter)==0) {
01104         strcpy(PCPTemp, "50");
01105         return PCPTemp;
01106     } else if (strcmp(PCRFLTR15, PCPRadio->PCPFilter)==0) {
01107         strcpy(PCPTemp, "15");
01108         return PCPTemp;
01109     } else if (strcmp(PCRFLTR6, PCPRadio->PCPFilter)==0) {
01110         strcpy(PCPTemp, "6");
01111         return PCPTemp;
01112     } else if (strcmp(PCRFLTR3, PCPRadio->PCPFilter)==0) {
01113         strcpy(PCPTemp, "3");
01114         return PCPTemp;
01115     } 
01116 
01117     return PCPRadio->PCPFilter;
01118 }
01131 const char *PCP :: PCPGetToneSq()
01132 {
01133     return PCPRadio->PCPToneSq;
01134 }
01146 const char *PCP :: PCPGetToneSqStr()
01147 {
01148     bzero(PCPTemp, sizeof(PCPTemp));
01149     sprintf(PCPTemp, "%f", PCPRadio->PCPToneSqFloat);
01150     return PCPTemp;
01151 }
01164 bool PCP :: PCPGetAutoGain()
01165 {
01166     return PCPRadio->PCPAutoGain;
01167 }       
01179 const char *PCP :: PCPGetAutoGainStr()
01180 {
01181     bzero(PCPTemp, sizeof(PCPTemp));
01182     (PCPGetAutoGain())?(strcpy(PCPTemp,"1")):(strcpy(PCPTemp,"0"));
01183     return PCPTemp;
01184 }
01197 bool PCP :: PCPGetNB()
01198 {
01199     return PCPRadio->PCPNoiseBlank;
01200 }
01212 const char *PCP :: PCPGetNBStr()
01213 {
01214     bzero(PCPTemp, sizeof(PCPTemp));
01215     (PCPGetNB())?(strcpy(PCPTemp,"1")):(strcpy(PCPTemp,"0"));
01216     return PCPTemp;
01217 }
01230 bool PCP :: PCPGetRFAttenuator()
01231 {
01232     return PCPRadio->PCPRFAttenuator;
01233 }
01245 const char *PCP :: PCPGetRFAttenuatorStr()
01246 {
01247     bzero(PCPTemp, sizeof(PCPTemp));
01248     (PCPGetRFAttenuator())?(strcpy(PCPTemp,"1")):(strcpy(PCPTemp,"0"));
01249     return PCPTemp;
01250 }
01263 const PRadInf PCP :: PCPGetRadioInfo()
01264 {
01265     return *PCPRadio;
01266 }
01267 
01268 bool PCP :: PCPCheckResponse()
01269 {
01270     PCPComm->PCHear(PCPTemp);
01271     if (strncmp(PCPTemp, PCRAOK, 4)==0) {
01272         PCPErrRead=false;
01273         return true;
01274     } else if (strncmp(PCPTemp, PCRABAD, 4)==0) {
01275         PCPErrRead=false;
01276         return false;
01277     }
01278 
01279     PCPErrRead = true;
01280     return false;
01281 }

Generated at Mon Jan 17 00:45:27 2000 for Icom PCR-1000 Library by doxygen 1.0.0 written by Dimitri van Heesch, © 1997-1999