mirror of
https://github.com/g4klx/MMDVMHost.git
synced 2026-04-06 06:53:42 +00:00
Merge branch 'master' into mqtt
This commit is contained in:
commit
86e96a389d
5 changed files with 197 additions and 200 deletions
|
|
@ -368,23 +368,21 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
// The sync is regenerated by the modem so can do exact match
|
||||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
||||
m_rfSlowData.start();
|
||||
m_rfN = 0U;
|
||||
m_rfState = RPT_RF_STATE::LATE_ENTRY;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((m_rfState == RPT_RF_STATE::AUDIO) || (m_rfState == RPT_RF_STATE::DATA)) {
|
||||
// The sync is regenerated by the modem so can do exact match
|
||||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
||||
m_rfSlowData.start();
|
||||
m_rfN = 0U;
|
||||
}
|
||||
// The sync is regenerated by the modem so can do exact match
|
||||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
||||
m_rfSlowData.start();
|
||||
m_rfN = 0U;
|
||||
} else {
|
||||
m_rfSlowData.add(data + 1U);
|
||||
}
|
||||
|
||||
if (m_rfState == RPT_RF_STATE::AUDIO) {
|
||||
m_rfSlowData.peakSlowData(data + 1U, m_rfN);
|
||||
unsigned char type = m_rfSlowData.getType();
|
||||
|
||||
if (type == DSTAR_SLOW_DATA_TYPE_FASTDATA_BEGIN) {
|
||||
|
|
@ -409,9 +407,7 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
if (m_duplex)
|
||||
writeQueueDataRF(data);
|
||||
|
||||
m_rfSlowData.peakSlowData(data + 1U, m_rfN);
|
||||
bool complete = m_rfSlowData.isComplete();
|
||||
|
||||
if (complete) {
|
||||
unsigned char type = m_rfSlowData.getType();
|
||||
if (type == DSTAR_SLOW_DATA_TYPE_FASTDATA_END) {
|
||||
|
|
@ -440,7 +436,7 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
m_rfFrames++;
|
||||
|
||||
if (m_rfN != 0U) {
|
||||
const unsigned char* text = m_rfSlowData.addText(data + 1U, m_rfN);
|
||||
const unsigned char* text = m_rfSlowData.getText();
|
||||
if (text != nullptr)
|
||||
LogMessage("D-Star, RF slow data text = \"%s\"", text);
|
||||
}
|
||||
|
|
@ -460,14 +456,11 @@ bool CDStarControl::writeModem(unsigned char *data, unsigned int len)
|
|||
// The sync is regenerated by the modem so can do exact match
|
||||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
||||
m_rfSlowData.reset();
|
||||
m_rfN = 0U;
|
||||
return false;
|
||||
} else {
|
||||
CDStarHeader* header = m_rfSlowData.addHeader(data + 1U, m_rfN);
|
||||
if (header == nullptr) {
|
||||
m_rfN = (m_rfN + 1U) % 21U;
|
||||
CDStarHeader* header = m_rfSlowData.getHeader();
|
||||
if (header == nullptr)
|
||||
return false;
|
||||
}
|
||||
|
||||
m_rfHeader = *header;
|
||||
delete header;
|
||||
|
|
@ -746,13 +739,13 @@ void CDStarControl::writeNetwork()
|
|||
writeEndNet();
|
||||
} else if (type == TAG_DATA) {
|
||||
if ((m_netState == RPT_NET_STATE::AUDIO) || (m_netState == RPT_NET_STATE::DATA)) {
|
||||
unsigned char n = data[1U];
|
||||
m_netN = data[1U];
|
||||
|
||||
// The sync is regenerated by the modem so can do exact match
|
||||
if (::memcmp(data + 1U + DSTAR_VOICE_FRAME_LENGTH_BYTES, DSTAR_SYNC_BYTES, DSTAR_DATA_FRAME_LENGTH_BYTES) == 0) {
|
||||
if (m_netN == 0U) {
|
||||
CSync::addDStarSync(data + 2U);
|
||||
m_netSlowData.start();
|
||||
} else {
|
||||
m_netSlowData.peakSlowData(data + 1U, n);
|
||||
m_netSlowData.add(data + 2U);
|
||||
|
||||
if (m_netState == RPT_NET_STATE::AUDIO) {
|
||||
unsigned char type = m_netSlowData.getType();
|
||||
|
|
@ -782,12 +775,8 @@ void CDStarControl::writeNetwork()
|
|||
|
||||
m_netBits += 48U;
|
||||
|
||||
// Regenerate the sync
|
||||
if (m_netN == 0U) {
|
||||
CSync::addDStarSync(data + 2U);
|
||||
m_netSlowData.start();
|
||||
} else {
|
||||
const unsigned char* text = m_netSlowData.addText(data + 2U, m_netN);
|
||||
if (m_netN != 0U) {
|
||||
const unsigned char* text = m_netSlowData.getText();
|
||||
if (text != nullptr)
|
||||
LogMessage("D-Star, network slow data text = \"%s\"", text);
|
||||
}
|
||||
|
|
@ -799,18 +788,11 @@ void CDStarControl::writeNetwork()
|
|||
}
|
||||
|
||||
if (m_netState == RPT_NET_STATE::DATA) {
|
||||
m_netN = data[1U];
|
||||
|
||||
data[1U] = TAG_DATA;
|
||||
|
||||
m_netBits += 48U;
|
||||
|
||||
// Regenerate the sync
|
||||
if (m_netN == 0U) {
|
||||
CSync::addDStarSync(data + 2U);
|
||||
m_netSlowData.start();
|
||||
} else {
|
||||
m_netSlowData.peakSlowData(data + 2U, m_netN);
|
||||
if (m_netN != 0U) {
|
||||
bool complete = m_netSlowData.isComplete();
|
||||
if (complete) {
|
||||
unsigned char type = m_netSlowData.getType();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue