mirror of
https://github.com/ShaYmez/NXDNClients.git
synced 2024-11-22 07:24:49 -05:00
Fix small issues.
This commit is contained in:
parent
6762f2713f
commit
11b6cd7cf5
@ -268,6 +268,9 @@ void CNXDNGateway::run()
|
||||
if (currentId != 9999U) {
|
||||
LogMessage("Unlinked from reflector %u by %s", currentId, callsign.c_str());
|
||||
|
||||
if (voice != NULL && dstId == 9999U)
|
||||
voice->unlinked();
|
||||
|
||||
remoteNetwork.writeUnlink(currentAddr, currentPort);
|
||||
remoteNetwork.writeUnlink(currentAddr, currentPort);
|
||||
remoteNetwork.writeUnlink(currentAddr, currentPort);
|
||||
@ -277,9 +280,6 @@ void CNXDNGateway::run()
|
||||
lostTimer.stop();
|
||||
}
|
||||
|
||||
if (voice != NULL)
|
||||
voice->linkedTo(dstId);
|
||||
|
||||
currentId = dstId;
|
||||
}
|
||||
|
||||
@ -292,6 +292,9 @@ void CNXDNGateway::run()
|
||||
std::string callsign = lookup->find(srcId);
|
||||
LogMessage("Linked to reflector %u by %s", currentId, callsign.c_str());
|
||||
|
||||
if (voice != NULL)
|
||||
voice->linkedTo(currentId);
|
||||
|
||||
remoteNetwork.writePoll(currentAddr, currentPort);
|
||||
remoteNetwork.writePoll(currentAddr, currentPort);
|
||||
remoteNetwork.writePoll(currentAddr, currentPort);
|
||||
|
@ -49,7 +49,7 @@ bool CNXDNNetwork::writeData(const unsigned char* data, unsigned int length, uns
|
||||
assert(length > 0U);
|
||||
assert(port > 0U);
|
||||
|
||||
unsigned char buffer[20U];
|
||||
unsigned char buffer[50U];
|
||||
|
||||
buffer[0U] = 'N';
|
||||
buffer[1U] = 'X';
|
||||
|
@ -30,7 +30,7 @@
|
||||
const unsigned char HEADER[] = { 0x83U, 0x01U, 0x10U, 0x00U, 0x0FU, 0x01U, 0x00U, 0x20U };
|
||||
const unsigned char TRAILER[] = { 0x83U, 0x01U, 0x10U, 0x00U, 0x0FU, 0x08U, 0x00U, 0x20U };
|
||||
|
||||
const unsigned char SILENCE[] = {0xACU, 0xAAU, 0x40U, 0x20U, 0x00U, 0x44U, 0x40U, 0x80U, 0x80U};
|
||||
const unsigned char SILENCE[] = { 0xF0U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x78U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U };
|
||||
|
||||
const unsigned char NXDN_FRAME_LENGTH = 33U;
|
||||
|
||||
@ -53,9 +53,9 @@ m_timer(1000U, 1U),
|
||||
m_stopWatch(),
|
||||
m_sent(0U),
|
||||
m_ambe(NULL),
|
||||
m_positions(),
|
||||
m_voiceData(NULL),
|
||||
m_voiceLength(0U)
|
||||
m_voiceLength(0U),
|
||||
m_positions()
|
||||
{
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
m_indxFile = directory + "\\" + language + ".indx";
|
||||
@ -172,12 +172,9 @@ void CVoice::createVoice(unsigned int tg, const std::vector<std::string>& words)
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that the AMBE is an integer number of DMR frames
|
||||
if ((ambeLength % (2U * AMBE_LENGTH)) != 0U) {
|
||||
unsigned int frames = ambeLength / (2U * AMBE_LENGTH);
|
||||
frames++;
|
||||
ambeLength = frames * (2U * AMBE_LENGTH);
|
||||
}
|
||||
// Ensure that the AMBE is an integer number of NXDN frames
|
||||
if ((ambeLength % (2U * AMBE_LENGTH)) != 0U)
|
||||
ambeLength++;
|
||||
|
||||
// Add space for silence before and after the voice
|
||||
ambeLength += SILENCE_LENGTH * AMBE_LENGTH;
|
||||
@ -189,7 +186,7 @@ void CVoice::createVoice(unsigned int tg, const std::vector<std::string>& words)
|
||||
for (unsigned int i = 0U; i < ambeLength; i += AMBE_LENGTH)
|
||||
::memcpy(ambeData + i, SILENCE, AMBE_LENGTH);
|
||||
|
||||
// Put offset in for silence at the beginning
|
||||
// Put offset in for silence at the beginning
|
||||
unsigned int pos = SILENCE_LENGTH * AMBE_LENGTH;
|
||||
for (std::vector<std::string>::const_iterator it = words.begin(); it != words.end(); ++it) {
|
||||
if (m_positions.count(*it) > 0U) {
|
||||
@ -207,7 +204,7 @@ void CVoice::createVoice(unsigned int tg, const std::vector<std::string>& words)
|
||||
|
||||
unsigned char sacch[12U];
|
||||
::memset(sacch, 0x00U, 12U);
|
||||
|
||||
sacch[0U] = 0x01U;
|
||||
sacch[2U] = 0x20U;
|
||||
|
||||
sacch[3U] = (m_srcId >> 8) & 0xFFU;
|
||||
@ -268,6 +265,8 @@ bool CVoice::read(unsigned char* data)
|
||||
if (m_sent < count) {
|
||||
unsigned int offset = m_sent * NXDN_FRAME_LENGTH;
|
||||
::memcpy(data, m_voiceData + offset, NXDN_FRAME_LENGTH);
|
||||
|
||||
offset += NXDN_FRAME_LENGTH;
|
||||
m_sent++;
|
||||
|
||||
if (offset >= m_voiceLength) {
|
||||
@ -282,6 +281,13 @@ bool CVoice::read(unsigned char* data)
|
||||
return false;
|
||||
}
|
||||
|
||||
void CVoice::abort()
|
||||
{
|
||||
m_status = VS_NONE;
|
||||
m_voiceLength = 0U;
|
||||
m_sent = 0U;
|
||||
}
|
||||
|
||||
void CVoice::clock(unsigned int ms)
|
||||
{
|
||||
m_timer.clock(ms);
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
|
||||
bool read(unsigned char* data);
|
||||
|
||||
void abort();
|
||||
|
||||
void clock(unsigned int ms);
|
||||
|
||||
private:
|
||||
|
@ -29,7 +29,7 @@ const unsigned int BUFFER_LENGTH = 200U;
|
||||
const unsigned int NXCORE_PORT = 41300U;
|
||||
|
||||
CNXCoreNetwork::CNXCoreNetwork(const std::string& address, bool debug) :
|
||||
m_socket("", NXCORE_PORT),
|
||||
m_socket(NXCORE_PORT),
|
||||
m_address(),
|
||||
m_debug(debug),
|
||||
m_buffer(1000U, "NXCore Network")
|
||||
|
@ -18,5 +18,6 @@ Debug=0
|
||||
|
||||
[NXCore]
|
||||
Enabled=0
|
||||
Address=127.0.0.1
|
||||
# Address=208.111.3.45
|
||||
Address=44.131.4.1
|
||||
Debug=0
|
||||
|
@ -2,7 +2,9 @@ These programs are clients for the NXDN networking now built into the MMDVM Host
|
||||
|
||||
The Parrot is very simple minded and can only handle one client at a time and is therefore not suitable for use as a shared resource via the Internet.
|
||||
|
||||
The Gateway allows for use of NXDN Talk Groups to control the access to the various NXDN reflectors.
|
||||
The Reflector is used as a single talk group in the same way that it is with P25. It also includes the option to link it to NXCore to allow for interchange of audio between the two. At the NXCore end, it should be set up to receive the traffic from only one talk group.
|
||||
|
||||
The Gateway allows for use of NXDN Talk Groups to control the access to the various NXDN reflectors. It speaks the same language as Icom repeaters to the MMDVM so could theoretically be used as a gateway for a real Icom NXDN repeater. This has not been tested.
|
||||
|
||||
The Gateway has an ini file that contain the parameters for running the software. The filename of the ini file is passed as a parameter on the command line. The Parrot takes the UDP port number to listen on as an argument.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user