mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 16:55:52 +08:00
Add the repeater callsign to the FM start message.
This commit is contained in:
@@ -32,7 +32,8 @@
|
|||||||
|
|
||||||
const unsigned int BUFFER_LENGTH = 1500U;
|
const unsigned int BUFFER_LENGTH = 1500U;
|
||||||
|
|
||||||
CFMNetwork::CFMNetwork(const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) :
|
CFMNetwork::CFMNetwork(const std::string& callsign, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug) :
|
||||||
|
m_callsign(callsign),
|
||||||
m_socket(localAddress, localPort),
|
m_socket(localAddress, localPort),
|
||||||
m_addr(),
|
m_addr(),
|
||||||
m_addrLen(0U),
|
m_addrLen(0U),
|
||||||
@@ -42,11 +43,17 @@ m_buffer(2000U, "FM Network"),
|
|||||||
m_seqNo(0U),
|
m_seqNo(0U),
|
||||||
m_timer(1000U, 5U)
|
m_timer(1000U, 5U)
|
||||||
{
|
{
|
||||||
|
assert(!callsign.empty());
|
||||||
assert(gatewayPort > 0U);
|
assert(gatewayPort > 0U);
|
||||||
assert(!gatewayAddress.empty());
|
assert(!gatewayAddress.empty());
|
||||||
|
|
||||||
if (CUDPSocket::lookup(gatewayAddress, gatewayPort, m_addr, m_addrLen) != 0)
|
if (CUDPSocket::lookup(gatewayAddress, gatewayPort, m_addr, m_addrLen) != 0)
|
||||||
m_addrLen = 0U;
|
m_addrLen = 0U;
|
||||||
|
|
||||||
|
// Remove any trailing spaces/letters from the callsign
|
||||||
|
size_t pos = callsign.find_first_of(' ');
|
||||||
|
if (pos != std::string::npos)
|
||||||
|
m_callsign = callsign.substr(0U, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFMNetwork::~CFMNetwork()
|
CFMNetwork::~CFMNetwork()
|
||||||
@@ -113,14 +120,21 @@ bool CFMNetwork::writeStart()
|
|||||||
{
|
{
|
||||||
uint8_t buffer[5U];
|
uint8_t buffer[5U];
|
||||||
|
|
||||||
buffer[0U] = 'F';
|
unsigned int length = 0U;
|
||||||
buffer[1U] = 'M';
|
|
||||||
buffer[2U] = 'S';
|
buffer[length++] = 'F';
|
||||||
|
buffer[length++] = 'M';
|
||||||
|
buffer[length++] = 'S';
|
||||||
|
|
||||||
|
for (unsigned int i = 0U; i < m_callsign.size(); i++)
|
||||||
|
buffer[length++] = m_callsign.at(i);
|
||||||
|
|
||||||
|
buffer[length++] = '\0';
|
||||||
|
|
||||||
if (m_debug)
|
if (m_debug)
|
||||||
CUtils::dump(1U, "FM Network Data Sent", buffer, 3U);
|
CUtils::dump(1U, "FM Network Data Sent", buffer, length);
|
||||||
|
|
||||||
return m_socket.write(buffer, 3U, m_addr, m_addrLen);
|
return m_socket.write(buffer, length, m_addr, m_addrLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFMNetwork::writeEnd()
|
bool CFMNetwork::writeEnd()
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
class CFMNetwork {
|
class CFMNetwork {
|
||||||
public:
|
public:
|
||||||
CFMNetwork(const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug);
|
CFMNetwork(const std::string& callsign, const std::string& localAddress, unsigned short localPort, const std::string& gatewayAddress, unsigned short gatewayPort, bool debug);
|
||||||
~CFMNetwork();
|
~CFMNetwork();
|
||||||
|
|
||||||
bool open();
|
bool open();
|
||||||
@@ -52,6 +52,7 @@ public:
|
|||||||
void clock(unsigned int ms);
|
void clock(unsigned int ms);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string m_callsign;
|
||||||
CUDPSocket m_socket;
|
CUDPSocket m_socket;
|
||||||
sockaddr_storage m_addr;
|
sockaddr_storage m_addr;
|
||||||
unsigned int m_addrLen;
|
unsigned int m_addrLen;
|
||||||
|
|||||||
@@ -284,12 +284,6 @@ Debug=0
|
|||||||
|
|
||||||
[FM Network]
|
[FM Network]
|
||||||
Enable=1
|
Enable=1
|
||||||
# Protocol may be USRP or RAW
|
|
||||||
Protocol=USRP
|
|
||||||
# SampleRate is only used in RAW mode
|
|
||||||
SampleRate=48000
|
|
||||||
# The squelch file is optional and only used in RAW mode
|
|
||||||
SquelchFile=/tmp/sql
|
|
||||||
LocalAddress=127.0.0.1
|
LocalAddress=127.0.0.1
|
||||||
LocalPort=3810
|
LocalPort=3810
|
||||||
GatewayAddress=127.0.0.1
|
GatewayAddress=127.0.0.1
|
||||||
|
|||||||
@@ -2230,6 +2230,7 @@ bool CMMDVMHost::createPOCSAGNetwork()
|
|||||||
#if defined(USE_FM)
|
#if defined(USE_FM)
|
||||||
bool CMMDVMHost::createFMNetwork()
|
bool CMMDVMHost::createFMNetwork()
|
||||||
{
|
{
|
||||||
|
std::string callsign = m_conf.getFMCallsign();
|
||||||
std::string gatewayAddress = m_conf.getFMGatewayAddress();
|
std::string gatewayAddress = m_conf.getFMGatewayAddress();
|
||||||
unsigned short gatewayPort = m_conf.getFMGatewayPort();
|
unsigned short gatewayPort = m_conf.getFMGatewayPort();
|
||||||
std::string localAddress = m_conf.getFMLocalAddress();
|
std::string localAddress = m_conf.getFMLocalAddress();
|
||||||
@@ -2252,7 +2253,7 @@ bool CMMDVMHost::createFMNetwork()
|
|||||||
LogInfo(" RX Audio Gain: %.2f", rxAudioGain);
|
LogInfo(" RX Audio Gain: %.2f", rxAudioGain);
|
||||||
LogInfo(" Mode Hang: %us", m_fmNetModeHang);
|
LogInfo(" Mode Hang: %us", m_fmNetModeHang);
|
||||||
|
|
||||||
m_fmNetwork = new CFMNetwork(localAddress, localPort, gatewayAddress, gatewayPort, debug);
|
m_fmNetwork = new CFMNetwork(callsign, localAddress, localPort, gatewayAddress, gatewayPort, debug);
|
||||||
|
|
||||||
bool ret = m_fmNetwork->open();
|
bool ret = m_fmNetwork->open();
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|||||||
Reference in New Issue
Block a user