mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 16:55:52 +08:00
Regenerate the rate 1/2 data payload.
This commit is contained in:
25
DMRSlot.cpp
25
DMRSlot.cpp
@@ -15,6 +15,7 @@
|
|||||||
#include "DMRSlotType.h"
|
#include "DMRSlotType.h"
|
||||||
#include "DMRShortLC.h"
|
#include "DMRShortLC.h"
|
||||||
#include "DMRFullLC.h"
|
#include "DMRFullLC.h"
|
||||||
|
#include "BPTC19696.h"
|
||||||
#include "DMRSlot.h"
|
#include "DMRSlot.h"
|
||||||
#include "DMRCSBK.h"
|
#include "DMRCSBK.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
@@ -298,6 +299,14 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
if (m_state != RS_RELAYING_RF_DATA)
|
if (m_state != RS_RELAYING_RF_DATA)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Regenerate the payload if possible
|
||||||
|
if (dataType == DT_RATE_12_DATA) {
|
||||||
|
CBPTC19696 bptc;
|
||||||
|
unsigned char payload[12U];
|
||||||
|
bptc.decode(data + 2U, payload);
|
||||||
|
bptc.encode(payload, data + 2U);
|
||||||
|
}
|
||||||
|
|
||||||
// Regenerate the Slot Type
|
// Regenerate the Slot Type
|
||||||
slotType.getData(data + 2U);
|
slotType.getData(data + 2U);
|
||||||
|
|
||||||
@@ -356,6 +365,14 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||||||
unsigned char dataType = slotType.getDataType();
|
unsigned char dataType = slotType.getDataType();
|
||||||
|
|
||||||
if (dataType == DT_RATE_12_DATA || dataType == DT_RATE_34_DATA || dataType == DT_RATE_1_DATA) {
|
if (dataType == DT_RATE_12_DATA || dataType == DT_RATE_34_DATA || dataType == DT_RATE_1_DATA) {
|
||||||
|
// Regenerate the payload if possible
|
||||||
|
if (dataType == DT_RATE_12_DATA) {
|
||||||
|
CBPTC19696 bptc;
|
||||||
|
unsigned char payload[12U];
|
||||||
|
bptc.decode(data + 2U, payload);
|
||||||
|
bptc.encode(payload, data + 2U);
|
||||||
|
}
|
||||||
|
|
||||||
// Regenerate the Slot Type
|
// Regenerate the Slot Type
|
||||||
slotType.getData(data + 2U);
|
slotType.getData(data + 2U);
|
||||||
|
|
||||||
@@ -875,6 +892,14 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||||||
if (m_state != RS_RELAYING_NETWORK_DATA)
|
if (m_state != RS_RELAYING_NETWORK_DATA)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Regenerate the payload if possible
|
||||||
|
if (dataType == DT_RATE_12_DATA) {
|
||||||
|
CBPTC19696 bptc;
|
||||||
|
unsigned char payload[12U];
|
||||||
|
bptc.decode(data + 2U, payload);
|
||||||
|
bptc.encode(payload, data + 2U);
|
||||||
|
}
|
||||||
|
|
||||||
// Regenerate the Slot Type
|
// Regenerate the Slot Type
|
||||||
CDMRSlotType slotType;
|
CDMRSlotType slotType;
|
||||||
slotType.putData(data + 2U);
|
slotType.putData(data + 2U);
|
||||||
|
|||||||
Reference in New Issue
Block a user