mirror of
https://github.com/n5ac/mmtty.git
synced 2025-12-06 04:12:03 +01:00
173 lines
4.5 KiB
C
173 lines
4.5 KiB
C
|
|
//Copyright+LGPL
|
|||
|
|
|
|||
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|||
|
|
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba, Dave Bernstein
|
|||
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|||
|
|
// This file is part of MMTTY.
|
|||
|
|
|
|||
|
|
// MMTTY is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
|
|||
|
|
// as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|||
|
|
|
|||
|
|
// MMTTY is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|||
|
|
|
|||
|
|
// You should have received a copy of the GNU Lesser General Public License along with MMTTY. If not, see
|
|||
|
|
// <http://www.gnu.org/licenses/>.
|
|||
|
|
//-----------------------------------------------------------------------------------------------------------------------------------------------
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
///----------------------------------------------------------
|
|||
|
|
/// Radio<69>R<EFBFBD>~<7E>j<EFBFBD><6A><EFBFBD>P<EFBFBD>[<5B>V<EFBFBD><56><EFBFBD><EFBFBD><EFBFBD>N<EFBFBD><4E><EFBFBD>X
|
|||
|
|
///
|
|||
|
|
/// (C) JE3HHT Makoto.Mori
|
|||
|
|
///
|
|||
|
|
//---------------------------------------------------------------------------
|
|||
|
|
#ifndef CradioH
|
|||
|
|
#define CradioH
|
|||
|
|
#include "ComLib.h"
|
|||
|
|
#include "mmlink.h"
|
|||
|
|
//---------------------------------------------------------------------------
|
|||
|
|
#include <Classes.hpp>
|
|||
|
|
typedef struct {
|
|||
|
|
int change;
|
|||
|
|
|
|||
|
|
char StrPort[32]; // <20>|<7C>[<5B>g<EFBFBD>̖<EFBFBD><CC96>O
|
|||
|
|
int BaudRate; // <20>{<7B>[<5B><><EFBFBD>[<5B>g
|
|||
|
|
int BitLen; // 0-7Bit, 1-8Bit
|
|||
|
|
int Stop; // 0-1Bit, 1-2Bit
|
|||
|
|
int Parity; // 0-PN, 1-PE, 2-PO
|
|||
|
|
int flwXON; // Xon/Xoff ON
|
|||
|
|
int flwCTS; // CTS-RTS ON
|
|||
|
|
int usePTT;
|
|||
|
|
|
|||
|
|
long ByteWait; // <20>o<EFBFBD>C<EFBFBD>g<EFBFBD>Ԃ̑<D482><CC91>M<EFBFBD>E<EFBFBD>G<EFBFBD>C<EFBFBD>g
|
|||
|
|
|
|||
|
|
int Cmdxx;
|
|||
|
|
|
|||
|
|
AnsiString CmdInit;
|
|||
|
|
AnsiString CmdRx;
|
|||
|
|
AnsiString CmdTx;
|
|||
|
|
|
|||
|
|
AnsiString cmdGNR;
|
|||
|
|
int openGNR;
|
|||
|
|
|
|||
|
|
int PollType;
|
|||
|
|
int PollInterval;
|
|||
|
|
int PollOffset;
|
|||
|
|
|
|||
|
|
int PollScan;
|
|||
|
|
}CRADIOPARA;
|
|||
|
|
extern CRADIOPARA RADIO;
|
|||
|
|
//---------------------------------------------------------------------------
|
|||
|
|
void LoadRADIOSetup(TMemIniFile *pIniFile);
|
|||
|
|
void SaveRADIOSetup(TMemIniFile *pIniFile);
|
|||
|
|
//#define CR 0x0d
|
|||
|
|
//#define LF 0x0a
|
|||
|
|
#define CRADIO_CLOSE 1
|
|||
|
|
#define RADIO_COMBUFSIZE 4096
|
|||
|
|
#define RADIO_TXBUFSIZE 256
|
|||
|
|
#define RADIO_RXBUFSIZE 256
|
|||
|
|
|
|||
|
|
enum {
|
|||
|
|
RADIO_POLLNULL,
|
|||
|
|
RADIO_POLLYAESUHF,
|
|||
|
|
RADIO_POLLYAESUVU,
|
|||
|
|
RADIO_POLLICOM,
|
|||
|
|
RADIO_POLLICOMN,
|
|||
|
|
RADIO_POLLOMNIVI,
|
|||
|
|
RADIO_POLLOMNIVIN,
|
|||
|
|
RADIO_POLLKENWOOD,
|
|||
|
|
RADIO_POLLKENWOODN,
|
|||
|
|
RADIO_POLLFT1000D,
|
|||
|
|
RADIO_POLLFT920,
|
|||
|
|
RADIO_POLLJST245,
|
|||
|
|
RADIO_POLLJST245N,
|
|||
|
|
RADIO_POLLFT9000, //1.66B AA6YQ add new radios at end of list as this value is stored in mmtty.ini
|
|||
|
|
RADIO_POLLFT2000, //1.66B AA6YQ
|
|||
|
|
RADIO_POLLFT950, //1.66B AA6YQ
|
|||
|
|
RADIO_POLLFT450, //1.66B AA6YQ
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
class CCradio : public TThread
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
BOOL m_CreateON; // <20>N<EFBFBD><4E><EFBFBD>G<EFBFBD>C<EFBFBD>g<EFBFBD>t<EFBFBD><74><EFBFBD>O
|
|||
|
|
DCB m_dcb; // <20>c<EFBFBD>b<EFBFBD>a
|
|||
|
|
HANDLE m_fHnd; // <20>t<EFBFBD>@<40>C<EFBFBD><43><EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
|
HWND m_wHnd; // <20>e<EFBFBD>̃E<CC83>C<EFBFBD><43><EFBFBD>h<EFBFBD>E<EFBFBD>n<EFBFBD><6E><EFBFBD>h<EFBFBD><68>
|
|||
|
|
UINT m_uMsg;
|
|||
|
|
UINT m_ID; // <20><><EFBFBD>b<EFBFBD>Z<EFBFBD>[<5B>W<EFBFBD>̂h<CC82>c<EFBFBD>ԍ<EFBFBD>
|
|||
|
|
volatile int m_Command; // <20>X<EFBFBD><58><EFBFBD>b<EFBFBD>h<EFBFBD>ւ̃R<CC83>}<7D><><EFBFBD>h
|
|||
|
|
BOOL m_TxAbort; // <20><><EFBFBD>M<EFBFBD><4D><EFBFBD>~<7E>t<EFBFBD><74><EFBFBD>O
|
|||
|
|
AnsiString Name;
|
|||
|
|
CMMRadio *m_pRadio;
|
|||
|
|
|
|||
|
|
int m_PSKGNRId;
|
|||
|
|
int m_OpenGNR;
|
|||
|
|
|
|||
|
|
char m_txbuf[RADIO_TXBUFSIZE];
|
|||
|
|
int m_txcnt;
|
|||
|
|
int m_txwp;
|
|||
|
|
int m_txrp;
|
|||
|
|
|
|||
|
|
int m_PollCnt;
|
|||
|
|
unsigned char m_rxbuf[RADIO_RXBUFSIZE];
|
|||
|
|
int m_rxcnt;
|
|||
|
|
int m_FreqEvent;
|
|||
|
|
char m_Freq[32];
|
|||
|
|
int m_MarkFreq;
|
|||
|
|
|
|||
|
|
int m_ScanAddr;
|
|||
|
|
protected:
|
|||
|
|
void virtual __fastcall Execute();
|
|||
|
|
BOOL OpenPipe(CRADIOPARA *cp, HWND hwnd, UINT nID);
|
|||
|
|
void CatchPoll(BYTE c);
|
|||
|
|
void FreqYaesuHF(void);
|
|||
|
|
void FreqYaesuVU(void);
|
|||
|
|
void FreqICOM(void);
|
|||
|
|
void FreqKenwood(void);
|
|||
|
|
void FreqYaesu9K2K(void);
|
|||
|
|
void FreqJST245(void);
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
__fastcall CCradio(bool CreateSuspended);
|
|||
|
|
__fastcall ~CCradio(){
|
|||
|
|
Close();
|
|||
|
|
};
|
|||
|
|
inline BOOL IsOpen(void){
|
|||
|
|
return m_CreateON;
|
|||
|
|
};
|
|||
|
|
inline void UpdateHandle(HWND hwnd, UINT uMsg){
|
|||
|
|
m_wHnd = hwnd; m_uMsg = uMsg;
|
|||
|
|
};
|
|||
|
|
BOOL Open(CRADIOPARA *cp, HWND hwnd, UINT uMsg, UINT nID);
|
|||
|
|
void Close(void);
|
|||
|
|
void ReqClose(void);
|
|||
|
|
void WaitClose(void);
|
|||
|
|
DWORD RecvLen(void);
|
|||
|
|
int TxBusy(void);
|
|||
|
|
DWORD Read(BYTE *p, DWORD len);
|
|||
|
|
void Write(void *p, DWORD len);
|
|||
|
|
void PutChar(char c);
|
|||
|
|
void OutStr(LPCSTR fmt, ...);
|
|||
|
|
void OutLine(LPCSTR fmt, ...);
|
|||
|
|
void SendCommand(LPCSTR p);
|
|||
|
|
void SetPTT(int sw);
|
|||
|
|
void Timer(int tx, int interval);
|
|||
|
|
|
|||
|
|
inline LPCSTR GetFreq(void){
|
|||
|
|
m_FreqEvent = 0;
|
|||
|
|
return m_Freq;
|
|||
|
|
};
|
|||
|
|
inline void SetMarkFreq(int f){
|
|||
|
|
m_MarkFreq = f;
|
|||
|
|
};
|
|||
|
|
int IsFreqChange(LPCSTR p);
|
|||
|
|
void UpdateFreq(double freq);
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
void InitRADIOPara(void);
|
|||
|
|
#endif
|
|||
|
|
|