code cleanup (no functional change);

pull/114/head
Bryan Biedenkapp 1 month ago
parent abe1cc5948
commit 43cf2530d3

@ -18,6 +18,12 @@
#include <errno.h> #include <errno.h>
#endif #endif
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/* Initializes a new instance of the CtsCorController class. */
CtsCorController::CtsCorController(const std::string& port) CtsCorController::CtsCorController(const std::string& port)
: m_port(port), m_isOpen(false), m_ownsFd(true) : m_port(port), m_isOpen(false), m_ownsFd(true)
#if defined(_WIN32) #if defined(_WIN32)
@ -28,11 +34,15 @@ CtsCorController::CtsCorController(const std::string& port)
{ {
} }
/* Finalizes a instance of the RtsPttController class. */
CtsCorController::~CtsCorController() CtsCorController::~CtsCorController()
{ {
close(); close();
} }
/* Opens the serial port for CTS control. */
bool CtsCorController::open(int reuseFd) bool CtsCorController::open(int reuseFd)
{ {
if (m_isOpen) if (m_isOpen)
@ -155,6 +165,8 @@ bool CtsCorController::open(int reuseFd)
return true; return true;
} }
/* Closes the serial port. */
void CtsCorController::close() void CtsCorController::close()
{ {
if (!m_isOpen) if (!m_isOpen)
@ -180,6 +192,8 @@ void CtsCorController::close()
::LogInfo(LOG_HOST, "CTS COR Controller closed"); ::LogInfo(LOG_HOST, "CTS COR Controller closed");
} }
/* Return wether the CTS signal is high (asserted CTS) to trigger COR detection. */
bool CtsCorController::isCtsAsserted() bool CtsCorController::isCtsAsserted()
{ {
if (!m_isOpen) if (!m_isOpen)
@ -202,6 +216,12 @@ bool CtsCorController::isCtsAsserted()
#endif // defined(_WIN32) #endif // defined(_WIN32)
} }
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/* Sets the termios settings on the serial port. */
bool CtsCorController::setTermios() bool CtsCorController::setTermios()
{ {
#if !defined(_WIN32) #if !defined(_WIN32)

@ -56,7 +56,7 @@ public:
void close(); void close();
/** /**
* @brief Reads the current CTS signal state. * @brief Return wether the CTS signal is high (asserted CTS) to trigger COR detection.
* @returns bool True if CTS is asserted (active), otherwise false. * @returns bool True if CTS is asserted (active), otherwise false.
*/ */
bool isCtsAsserted(); bool isCtsAsserted();

@ -161,23 +161,6 @@ HostBridge::HostBridge(const std::string& confFile) :
m_confFile(confFile), m_confFile(confFile),
m_conf(), m_conf(),
m_network(nullptr), m_network(nullptr),
m_udpAudioSocket(nullptr),
m_udpAudio(false),
m_udpMetadata(false),
m_udpSendPort(34001),
m_udpSendAddress("127.0.0.1"),
m_udpReceivePort(32001),
m_udpReceiveAddress("127.0.0.1"),
m_udpRTPFrames(false),
m_udpIgnoreRTPTiming(false),
m_udpUseULaw(false),
m_udpUsrp(false),
m_udpFrameTiming(false),
m_udpFrameCnt(0U),
m_tekAlgoId(P25DEF::ALGO_UNENCRYPT),
m_tekKeyId(0U),
m_requestedTek(false),
m_p25Crypto(nullptr),
m_srcId(P25DEF::WUID_FNE), m_srcId(P25DEF::WUID_FNE),
m_srcIdOverride(0U), m_srcIdOverride(0U),
m_overrideSrcIdFromMDC(false), m_overrideSrcIdFromMDC(false),
@ -186,12 +169,20 @@ HostBridge::HostBridge(const std::string& confFile) :
m_dstId(1U), m_dstId(1U),
m_slot(1U), m_slot(1U),
m_identity(), m_identity(),
m_netId(P25DEF::WACN_STD_DEFAULT),
m_sysId(P25DEF::SID_STD_DEFAULT),
m_grantDemand(false),
m_txMode(1U),
m_rxAudioGain(1.0f), m_rxAudioGain(1.0f),
m_vocoderDecoderAudioGain(3.0f), m_vocoderDecoderAudioGain(3.0f),
m_vocoderDecoderAutoGain(false), m_vocoderDecoderAutoGain(false),
m_txAudioGain(1.0f), m_txAudioGain(1.0f),
m_vocoderEncoderAudioGain(3.0), m_vocoderEncoderAudioGain(3.0),
m_txMode(1U), m_tekAlgoId(P25DEF::ALGO_UNENCRYPT),
m_tekKeyId(0U),
m_requestedTek(false),
m_p25Crypto(nullptr),
m_localAudio(false),
m_voxSampleLevel(30.0f), m_voxSampleLevel(30.0f),
m_dropTimeMS(180U), m_dropTimeMS(180U),
m_localDropTime(1000U, 0U, 180U), m_localDropTime(1000U, 0U, 180U),
@ -200,8 +191,6 @@ HostBridge::HostBridge(const std::string& confFile) :
m_preambleLeaderTone(false), m_preambleLeaderTone(false),
m_preambleTone(2175), m_preambleTone(2175),
m_preambleLength(200U), m_preambleLength(200U),
m_grantDemand(false),
m_localAudio(false),
m_maContext(), m_maContext(),
m_maPlaybackDevices(nullptr), m_maPlaybackDevices(nullptr),
m_maCaptureDevices(nullptr), m_maCaptureDevices(nullptr),
@ -213,6 +202,19 @@ HostBridge::HostBridge(const std::string& confFile) :
m_decoder(nullptr), m_decoder(nullptr),
m_encoder(nullptr), m_encoder(nullptr),
m_mdcDecoder(nullptr), m_mdcDecoder(nullptr),
m_udpAudioSocket(nullptr),
m_udpAudio(false),
m_udpMetadata(false),
m_udpSendPort(34001),
m_udpSendAddress("127.0.0.1"),
m_udpReceivePort(32001),
m_udpReceiveAddress("127.0.0.1"),
m_udpRTPFrames(false),
m_udpIgnoreRTPTiming(false),
m_udpUseULaw(false),
m_udpUsrp(false),
m_udpFrameTiming(false),
m_udpFrameCnt(0U),
m_dmrEmbeddedData(), m_dmrEmbeddedData(),
m_rxDMRLC(), m_rxDMRLC(),
m_rxDMRPILC(), m_rxDMRPILC(),
@ -225,9 +227,20 @@ HostBridge::HostBridge(const std::string& confFile) :
m_netLDU2(nullptr), m_netLDU2(nullptr),
m_p25SeqNo(0U), m_p25SeqNo(0U),
m_p25N(0U), m_p25N(0U),
m_netId(P25DEF::WACN_STD_DEFAULT),
m_sysId(P25DEF::SID_STD_DEFAULT),
m_analogN(0U), m_analogN(0U),
m_rtsPttEnable(false),
m_rtsPttPort(),
m_rtsPttController(nullptr),
m_rtsPttActive(false),
m_lastAudioOut(),
m_rtsPttHoldoffMs(250U),
m_ctsCorEnable(false),
m_ctsCorPort(),
m_ctsCorController(nullptr),
m_ctsCorActive(false),
m_ctsCorInvert(false),
m_ctsPadTimeout(1000U, 0U, 22U),
m_ctsCorHoldoffMs(250U),
m_audioDetect(false), m_audioDetect(false),
m_trafficFromUDP(false), m_trafficFromUDP(false),
m_udpSrcId(0U), m_udpSrcId(0U),
@ -242,19 +255,6 @@ HostBridge::HostBridge(const std::string& confFile) :
m_networkWatchdog(1000U, 0U, 1500U), m_networkWatchdog(1000U, 0U, 1500U),
m_trace(false), m_trace(false),
m_debug(false), m_debug(false),
m_rtsPttEnable(false),
m_rtsPttPort(),
m_rtsPttController(nullptr),
m_rtsPttActive(false),
m_lastAudioOut(),
m_rtsPttHoldoffMs(250U),
m_ctsCorEnable(false),
m_ctsCorPort(),
m_ctsCorController(nullptr),
m_ctsCorActive(false),
m_ctsCorInvert(false),
m_ctsPadTimeout(1000U, 0U, 22U),
m_ctsCorHoldoffMs(250U),
m_rtpSeqNo(0U), m_rtpSeqNo(0U),
m_rtpTimestamp(INVALID_TS), m_rtpTimestamp(INVALID_TS),
m_udpNetPktSeq(0U), m_udpNetPktSeq(0U),

@ -152,27 +152,6 @@ private:
network::PeerNetwork* m_network; network::PeerNetwork* m_network;
network::udp::Socket* m_udpAudioSocket; network::udp::Socket* m_udpAudioSocket;
bool m_udpAudio;
bool m_udpMetadata;
uint16_t m_udpSendPort;
std::string m_udpSendAddress;
uint16_t m_udpReceivePort;
std::string m_udpReceiveAddress;
bool m_udpRTPFrames;
bool m_udpIgnoreRTPTiming;
bool m_udpUseULaw;
bool m_udpUsrp;
bool m_udpFrameTiming;
uint32_t m_udpFrameTimeout;
uint32_t m_udpFrameCnt;
uint8_t m_tekAlgoId;
uint16_t m_tekKeyId;
bool m_requestedTek;
p25::crypto::P25Crypto* m_p25Crypto;
uint32_t m_srcId; uint32_t m_srcId;
uint32_t m_srcIdOverride; uint32_t m_srcIdOverride;
bool m_overrideSrcIdFromMDC; bool m_overrideSrcIdFromMDC;
@ -182,13 +161,31 @@ private:
uint8_t m_slot; uint8_t m_slot;
std::string m_identity; std::string m_identity;
uint32_t m_netId;
uint32_t m_sysId;
bool m_grantDemand;
uint8_t m_txMode;
float m_rxAudioGain; float m_rxAudioGain;
float m_vocoderDecoderAudioGain; float m_vocoderDecoderAudioGain;
bool m_vocoderDecoderAutoGain; bool m_vocoderDecoderAutoGain;
float m_txAudioGain; float m_txAudioGain;
float m_vocoderEncoderAudioGain; float m_vocoderEncoderAudioGain;
uint8_t m_txMode; bool m_trace;
bool m_debug;
uint8_t m_tekAlgoId;
uint16_t m_tekKeyId;
bool m_requestedTek;
p25::crypto::P25Crypto* m_p25Crypto;
bool m_localAudio;
float m_voxSampleLevel; float m_voxSampleLevel;
uint16_t m_dropTimeMS; uint16_t m_dropTimeMS;
@ -201,10 +198,6 @@ private:
uint16_t m_preambleTone; uint16_t m_preambleTone;
uint16_t m_preambleLength; uint16_t m_preambleLength;
bool m_grantDemand;
bool m_localAudio;
ma_context m_maContext; ma_context m_maContext;
ma_device_info* m_maPlaybackDevices; ma_device_info* m_maPlaybackDevices;
ma_device_info* m_maCaptureDevices; ma_device_info* m_maCaptureDevices;
@ -222,6 +215,25 @@ private:
vocoder::MBEEncoder* m_encoder; vocoder::MBEEncoder* m_encoder;
mdc_decoder_t* m_mdcDecoder; mdc_decoder_t* m_mdcDecoder;
bool m_udpAudio;
bool m_udpMetadata;
uint16_t m_udpSendPort;
std::string m_udpSendAddress;
uint16_t m_udpReceivePort;
std::string m_udpReceiveAddress;
bool m_udpRTPFrames;
bool m_udpIgnoreRTPTiming;
bool m_udpUseULaw;
bool m_udpUsrp;
bool m_udpFrameTiming;
uint32_t m_udpFrameTimeout;
uint32_t m_udpFrameCnt;
/*
** Digital Mobile Radio
*/
dmr::data::EmbeddedData m_dmrEmbeddedData; dmr::data::EmbeddedData m_dmrEmbeddedData;
dmr::lc::LC m_rxDMRLC; dmr::lc::LC m_rxDMRLC;
@ -231,36 +243,22 @@ private:
uint32_t m_dmrSeqNo; uint32_t m_dmrSeqNo;
uint8_t m_dmrN; uint8_t m_dmrN;
/*
** Project 25
*/
p25::lc::LC m_rxP25LC; p25::lc::LC m_rxP25LC;
uint8_t* m_netLDU1; uint8_t* m_netLDU1;
uint8_t* m_netLDU2; uint8_t* m_netLDU2;
uint32_t m_p25SeqNo; uint32_t m_p25SeqNo;
uint8_t m_p25N; uint8_t m_p25N;
uint32_t m_netId; /*
uint32_t m_sysId; ** Analog
*/
uint8_t m_analogN; uint8_t m_analogN;
bool m_audioDetect;
bool m_trafficFromUDP;
uint32_t m_udpSrcId;
uint32_t m_udpDstId;
bool m_callInProgress;
bool m_ignoreCall;
uint8_t m_callAlgoId;
uint64_t m_rxStartTime;
uint32_t m_rxStreamId;
uint32_t m_txStreamId;
uint8_t m_detectedSampleCnt;
Timer m_networkWatchdog;
static bool s_running;
bool m_trace;
bool m_debug;
// RTS PTT Control // RTS PTT Control
bool m_rtsPttEnable; bool m_rtsPttEnable;
std::string m_rtsPttPort; std::string m_rtsPttPort;
@ -279,6 +277,23 @@ private:
Timer m_ctsPadTimeout; // drives silence padding while CTS is active Timer m_ctsPadTimeout; // drives silence padding while CTS is active
uint32_t m_ctsCorHoldoffMs; // hold-off time before clearing COR after it deasserts uint32_t m_ctsCorHoldoffMs; // hold-off time before clearing COR after it deasserts
bool m_audioDetect;
bool m_trafficFromUDP;
uint32_t m_udpSrcId;
uint32_t m_udpDstId;
bool m_callInProgress;
bool m_ignoreCall;
uint8_t m_callAlgoId;
uint64_t m_rxStartTime;
uint32_t m_rxStreamId;
uint32_t m_txStreamId;
uint8_t m_detectedSampleCnt;
Timer m_networkWatchdog;
static bool s_running;
uint16_t m_rtpSeqNo; uint16_t m_rtpSeqNo;
uint32_t m_rtpTimestamp; uint32_t m_rtpTimestamp;

Loading…
Cancel
Save

Powered by TurnKey Linux.