mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 17:27:32 +00:00
feat(dmr): decode full link control
This commit is contained in:
+46
-6
@@ -56,6 +56,12 @@ type
|
||||
ColorCode: Integer;
|
||||
DataType: Integer;
|
||||
SlotTypeCorrectedBits: Integer;
|
||||
LinkControlValid: Boolean;
|
||||
LCSlot: Integer;
|
||||
LCOpcode: Integer;
|
||||
ServiceOptions: Integer;
|
||||
TargetID: LongWord;
|
||||
SourceID: LongWord;
|
||||
end;
|
||||
|
||||
TDMRDecoder = class;
|
||||
@@ -101,6 +107,10 @@ type
|
||||
FCurrentBurstPos: Integer;
|
||||
FLastBurst: TDMRDibitBurst;
|
||||
FLastBurstInfo: TDMRBurstInfo;
|
||||
FLastLinkControl: TDMRLinkControl;
|
||||
FLastLCSlot: Integer;
|
||||
FColorCodeValid: Boolean;
|
||||
FColorCode, FLastDataType, FSlotTypeCorrectedBits: Integer;
|
||||
FBurstCount: QWord;
|
||||
FRMSSq: Double;
|
||||
|
||||
@@ -259,6 +269,12 @@ begin
|
||||
FillChar(FCurrentBurst, SizeOf(FCurrentBurst), 0);
|
||||
FillChar(FLastBurst, SizeOf(FLastBurst), 0);
|
||||
FillChar(FLastBurstInfo, SizeOf(FLastBurstInfo), 0);
|
||||
FillChar(FLastLinkControl, SizeOf(FLastLinkControl), 0);
|
||||
FLastLCSlot := -1;
|
||||
FColorCodeValid := False;
|
||||
FColorCode := 0;
|
||||
FLastDataType := 0;
|
||||
FSlotTypeCorrectedBits := 0;
|
||||
FTrackPhase := -1;
|
||||
FCurrentBurstPos := 0;
|
||||
FBurstCount := 0;
|
||||
@@ -445,6 +461,26 @@ procedure TDMRDecoder.CompleteBurst;
|
||||
begin
|
||||
Move(FCurrentBurst[0], FLastBurst[0], SizeOf(FLastBurst));
|
||||
DMRParseBurst(FLastBurst, FLastBurstInfo);
|
||||
if FLastBurstInfo.SlotType.Valid and
|
||||
(FSyncKind in [dskBSData, dskMSData, dskDirectTS1Data,
|
||||
dskDirectTS2Data]) then
|
||||
begin
|
||||
FColorCodeValid := True;
|
||||
FColorCode := FLastBurstInfo.SlotType.ColorCode;
|
||||
FLastDataType := FLastBurstInfo.SlotType.DataType;
|
||||
FSlotTypeCorrectedBits := FLastBurstInfo.SlotType.CorrectedBits;
|
||||
end;
|
||||
if FLastBurstInfo.LinkControl.Decoded then
|
||||
begin
|
||||
FLastLinkControl := FLastBurstInfo.LinkControl;
|
||||
if (FSyncKind in [dskBSData, dskBSVoice]) and
|
||||
FLastBurstInfo.CACH.Valid then
|
||||
FLastLCSlot := FLastBurstInfo.CACH.Slot
|
||||
else if FSyncKind in [dskDirectTS2Data, dskDirectTS2Voice] then
|
||||
FLastLCSlot := 1
|
||||
else
|
||||
FLastLCSlot := 0;
|
||||
end;
|
||||
Inc(FBurstCount);
|
||||
FCurrentBurstPos := 0;
|
||||
end;
|
||||
@@ -513,12 +549,16 @@ begin
|
||||
S.LCSS := FLastBurstInfo.CACH.LCSS;
|
||||
// Voice sync replaces the centre Slot Type field. Do not expose a
|
||||
// chance Golay match from AMBE bits as a real colour/data type.
|
||||
S.SlotTypeValid := FLastBurstInfo.SlotType.Valid and
|
||||
(FSyncKind in [dskBSData, dskMSData,
|
||||
dskDirectTS1Data, dskDirectTS2Data]);
|
||||
S.ColorCode := FLastBurstInfo.SlotType.ColorCode;
|
||||
S.DataType := FLastBurstInfo.SlotType.DataType;
|
||||
S.SlotTypeCorrectedBits := FLastBurstInfo.SlotType.CorrectedBits;
|
||||
S.SlotTypeValid := FColorCodeValid;
|
||||
S.ColorCode := FColorCode;
|
||||
S.DataType := FLastDataType;
|
||||
S.SlotTypeCorrectedBits := FSlotTypeCorrectedBits;
|
||||
S.LinkControlValid := FLastLinkControl.Decoded;
|
||||
S.LCSlot := FLastLCSlot;
|
||||
S.LCOpcode := FLastLinkControl.Opcode;
|
||||
S.ServiceOptions := FLastLinkControl.ServiceOptions;
|
||||
S.TargetID := FLastLinkControl.TargetID;
|
||||
S.SourceID := FLastLinkControl.SourceID;
|
||||
finally
|
||||
FStatusLock.Leave;
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user