mmtty/cradio.h
Dave 60a60ddb4e Add files via upload
- limit PTT/FSK port selector and Radio port selector to display only 8 items
- add COM33-64 to PTT/FSK port selector and Radio port selector
- add 891 to Yaesu Group selector entry
- add 991 and 891 to Model selector for Yaesu Group
- provide "Hide FlexRadio Reserved and IQ Audio Devices" checkbox on the Options panel's Soundcard tab
- notify user if attempting to open FSK TxD port at low speed fails, as many serial port devices can't do this
- accept RXM_SOUNDSOURCE message to change soundcard source channel (mono, left, right)
2016-12-11 03:22:40 -05:00

175 lines
4.6 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//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コミニュケーションクラス
///
/// (C) JE3HHT Makoto.Mori
///
//---------------------------------------------------------------------------
#ifndef CradioH
#define CradioH
#include "ComLib.h"
#include "mmlink.h"
//---------------------------------------------------------------------------
#include <Classes.hpp>
typedef struct {
int change;
char StrPort[32]; // ポートの名前
int BaudRate; // ボーレート
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; // バイト間の送信ウエイト
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
RADIO_POLLFT991, //1.70E AA6YQ
RADIO_POLLFT891, //1.70E AA6YQ
};
class CCradio : public TThread
{
public:
BOOL m_CreateON; // クリエイトフラグ
DCB m_dcb; //
HANDLE m_fHnd; // ファイルハンドル
HWND m_wHnd; // 親のウインドウハンドル
UINT m_uMsg;
UINT m_ID; // メッセージのID番号
volatile int m_Command; // スレッドへのコマンド
BOOL m_TxAbort; // 送信中止フラグ
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