pcp.h Source File

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

# pcp.h

    00001 #ifndef PCP_H_
    00002 #define PCP_H_
    00003 /*
    00004    Copyright (C) 1999 PolyWog and Javaman for Ghetto.Org
    00005    This file is part of the PCR-1000 API Library.
    00006
    00007    The PCR-1000 API Library is free software; you can redistribute it and/or
    00008    modify it under the terms of the GNU Library General Public License as
    00009    published by the Free Software Foundation; either version 2 of the
    00010    License, or (at your option) any later version.
    00011
    00012    The PCR-1000 API Library is distributed in the hope that it will be useful,
    00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015    Library General Public License for more details.
    00016
    00017    You should have received a copy of the GNU Library General Public
    00018    License along with the PCR-1000 API Library; see the file LICENSE.  If not,
    00019    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00020    Boston, MA 02111-1307, USA.
    00021  */
    00022
    00023
    00024 #include <pcrdef.h>
    00025 #include <pcomm.h>
    00026 #include <sys/termios.h> /* for tcflag_t */
    00027
    00029 #define PCPDefaultPort "/dev/pcr1000"
    00031 #define PCPDefaultSpeed B9600
    00032
    00034
    00038 struct PRadInf {
    00040         char        PCPPort[64];
    00042         tcflag_t    PCPSpeed;
    00044         char        PCPInitSpeed[8];
    00046         int         PCPVolume;
    00048         int         PCPSquelch;
    00050
    00051         pcrfreq_t   PCPFreq;
    00053
    00054         pcrcmd_t    PCPMode[128];
    00056
    00057         pcrcmd_t    PCPFilter[128];
    00059         bool            PCPAutoUpdate;
    00060
    00062         const char      *PCPToneSq;
    00064         float       PCPToneSqFloat;
    00066         bool            PCPAutoGain;
    00068         bool            PCPNoiseBlank;
    00070         bool            PCPRFAttenuator;
    00071 };
    00072
    00074
    00082 class PCP {
    00083     public:
    00084         PCP(char *port=PCPDefaultPort, tcflag_t speed=PCPDefaultSpeed,
    00085             const char *name=0);
    00086         ~PCP();
    00087
    00088         bool PCPInit(bool autoUpdate=false);
    00089         bool PCPPowerUp();
    00090         bool PCPPowerDown();
    00091
    00092         // basic radio methods
    00093         bool PCPSetSpeed(tcflag_t);
    00094         bool PCPSetPort(const char *);
    00095         bool PCPSetVolume(int);
    00096         bool PCPSetSquelch(int);
    00097         bool PCPSetFreq(pcrfreq_t);
    00098         bool PCPSetMode(const char *);
    00099         bool PCPSetFilter(const char *);
    00100         int  PCPSigStrength();
    00101         const char *PCPSigStrengthStr();
    00102
    00103         // advanced radio methods
    00104         bool PCPSetToneSq(const char*);
    00105         bool PCPSetToneSq(float);
    00106         bool PCPSetAutoGain(bool);
    00107         bool PCPSetNB(bool);
    00108         bool PCPSetRFAttenuator(bool);
    00109
    00110         bool             PCPIsOn();
    00111         bool             PCPQueryOn();
    00112         bool             PCPQuerySquelch();
    00113         const char      *PCPGetPort();
    00114         tcflag_t         PCPGetSpeed_t();
    00115         const char      *PCPGetSpeed();
    00116         int              PCPGetVolume();
    00117         const char      *PCPGetVolumeStr();
    00118         int              PCPGetSquelch();
    00119         const char      *PCPGetSquelchStr();
    00120         pcrfreq_t        PCPGetFreq();
    00121         const char      *PCPGetFreqStr();
    00122         const pcrcmd_t  *PCPGetMode();
    00123         const char      *PCPGetModeStr();
    00124         const pcrcmd_t  *PCPGetFilter();
    00125         const char      *PCPGetFilterStr();
    00126
    00127         const char  *PCPGetToneSq();
    00128         const char  *PCPGetToneSqStr();
    00129         bool             PCPGetAutoGain();
    00130         const char  *PCPGetAutoGainStr();
    00131         bool             PCPGetNB();
    00132         const char  *PCPGetNBStr();
    00133         bool             PCPGetRFAttenuator();
    00134         const char  *PCPGetRFAttenuatorStr();
    00135
    00137
    00144         const PRadInf PCPGetRadioInfo();
    00145
    00146     private:
    00147         bool            PCPCheckResponse();
    00148
    00150         PComm           *PCPComm;
    00152         bool        PCPStatus;
    00154         bool            PCPErrRead;
    00156         char            PCPTemp[256];
    00157
    00159         struct PRadInf *PCPRadio;
    00160 };
    00161
    00162
    00163 #endif /* PCP_H_ */