mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-24 09:35:40 +08:00
Merge pull request #453 from on7lds/devel
Better YSF image + New option SendFrameType (Transparent data section)
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -114,6 +114,7 @@ m_transparentEnabled(false),
|
||||
m_transparentRemoteAddress(),
|
||||
m_transparentRemotePort(0U),
|
||||
m_transparentLocalPort(0U),
|
||||
m_transparentSendFrameType(0U),
|
||||
m_umpEnabled(false),
|
||||
m_umpPort(),
|
||||
m_dstarEnabled(false),
|
||||
@@ -464,6 +465,8 @@ bool CConf::read()
|
||||
m_transparentRemotePort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "LocalPort") == 0)
|
||||
m_transparentLocalPort = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "SendFrameType") == 0)
|
||||
m_transparentSendFrameType = (unsigned int)::atoi(value);
|
||||
} else if (section == SECTION_UMP) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_umpEnabled = ::atoi(value) == 1;
|
||||
@@ -1054,6 +1057,11 @@ unsigned int CConf::getTransparentLocalPort() const
|
||||
return m_transparentLocalPort;
|
||||
}
|
||||
|
||||
unsigned int CConf::getTransparentSendFrameType() const
|
||||
{
|
||||
return m_transparentSendFrameType;
|
||||
}
|
||||
|
||||
bool CConf::getUMPEnabled() const
|
||||
{
|
||||
return m_umpEnabled;
|
||||
|
||||
2
Conf.h
2
Conf.h
@@ -99,6 +99,7 @@ public:
|
||||
std::string getTransparentRemoteAddress() const;
|
||||
unsigned int getTransparentRemotePort() const;
|
||||
unsigned int getTransparentLocalPort() const;
|
||||
unsigned int getTransparentSendFrameType() const;
|
||||
|
||||
// The UMP section
|
||||
bool getUMPEnabled() const;
|
||||
@@ -322,6 +323,7 @@ private:
|
||||
std::string m_transparentRemoteAddress;
|
||||
unsigned int m_transparentRemotePort;
|
||||
unsigned int m_transparentLocalPort;
|
||||
unsigned int m_transparentSendFrameType;
|
||||
|
||||
bool m_umpEnabled;
|
||||
std::string m_umpPort;
|
||||
|
||||
BIN
Images/YSF.bmp
BIN
Images/YSF.bmp
Binary file not shown.
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 30 KiB |
@@ -74,6 +74,7 @@ Enable=0
|
||||
RemoteAddress=127.0.0.1
|
||||
RemotePort=40094
|
||||
LocalPort=40095
|
||||
# SendFrameType=0
|
||||
|
||||
[UMP]
|
||||
Enable=0
|
||||
|
||||
@@ -315,15 +315,18 @@ int CMMDVMHost::run()
|
||||
unsigned int transparentPort = 0U;
|
||||
CUDPSocket* transparentSocket = NULL;
|
||||
|
||||
unsigned int sendFrameType = 0U;
|
||||
if (m_conf.getTransparentEnabled()) {
|
||||
std::string remoteAddress = m_conf.getTransparentRemoteAddress();
|
||||
unsigned int remotePort = m_conf.getTransparentRemotePort();
|
||||
unsigned int localPort = m_conf.getTransparentLocalPort();
|
||||
sendFrameType = m_conf.getTransparentSendFrameType();
|
||||
|
||||
LogInfo("Transparent Data");
|
||||
LogInfo(" Remote Address: %s", remoteAddress.c_str());
|
||||
LogInfo(" Remote Port: %u", remotePort);
|
||||
LogInfo(" Local Port: %u", localPort);
|
||||
LogInfo(" Send Frame Type: %u", sendFrameType);
|
||||
|
||||
transparentAddress = CUDPSocket::lookup(remoteAddress);
|
||||
transparentPort = remotePort;
|
||||
@@ -884,7 +887,7 @@ int CMMDVMHost::run()
|
||||
unsigned int port = 0U;
|
||||
len = transparentSocket->read(data, 200U, address, port);
|
||||
if (len > 0U)
|
||||
m_modem->writeTransparentData(data, len);
|
||||
m_modem->writeTransparentData(data, len, sendFrameType);
|
||||
}
|
||||
|
||||
unsigned int ms = stopWatch.elapsed();
|
||||
|
||||
16
Modem.cpp
16
Modem.cpp
@@ -1085,7 +1085,7 @@ bool CModem::writePOCSAGData(const unsigned char* data, unsigned int length)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CModem::writeTransparentData(const unsigned char* data, unsigned int length)
|
||||
bool CModem::writeTransparentData(const unsigned char* data, unsigned int length, unsigned int sendFrameType)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(length > 0U);
|
||||
@@ -1096,7 +1096,19 @@ bool CModem::writeTransparentData(const unsigned char* data, unsigned int length
|
||||
buffer[1U] = length + 3U;
|
||||
buffer[2U] = MMDVM_TRANSPARENT;
|
||||
|
||||
::memcpy(buffer + 3U, data, length);
|
||||
if (sendFrameType>0) {
|
||||
::memcpy(buffer + 2U, data, length);
|
||||
length--;
|
||||
buffer[1U]--;
|
||||
//when sendFrameType==1 , only 0x80 and 0x90 (MMDVM_SERIAL and MMDVM_TRANSPARENT) are allowed
|
||||
// and reverted to default (MMDVM_TRANSPARENT) for any other value
|
||||
//when >1, frame type is not checked
|
||||
if (sendFrameType==1) {
|
||||
if ((buffer[2U] & 0xE0) != 0x80) buffer[2U] = MMDVM_TRANSPARENT;
|
||||
}
|
||||
} else {
|
||||
::memcpy(buffer + 3U, data, length);
|
||||
}
|
||||
|
||||
unsigned char len = length + 3U;
|
||||
m_txTransparentData.addData(&len, 1U);
|
||||
|
||||
2
Modem.h
2
Modem.h
@@ -77,7 +77,7 @@ public:
|
||||
bool writeP25Data(const unsigned char* data, unsigned int length);
|
||||
bool writeNXDNData(const unsigned char* data, unsigned int length);
|
||||
bool writePOCSAGData(const unsigned char* data, unsigned int length);
|
||||
bool writeTransparentData(const unsigned char* data, unsigned int length);
|
||||
bool writeTransparentData(const unsigned char* data, unsigned int length, unsigned int sendFrameType);
|
||||
|
||||
bool writeDMRStart(bool tx);
|
||||
bool writeDMRShortLC(const unsigned char* lc);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user