DMR Additions

--Easier to use key entry for privacy modes
---Serpen'tera' 10 mode now available
--Slightly improved dmr dibit buffering/inverted dibit buffering
--Tweaks to console and ncurses output regarding FID, SVC, and privacy key values
--fix for RTL optional support (think I have all the ifdef covered now)
--TGT, SRC, FID, SVC, now set on Voice LC Header (not sure why I wasn't before)
--other misc tweaks that I can't recall
This commit is contained in:
lwvmobile 2022-08-21 23:45:00 -04:00 committed by GitHub
parent 7f34ff9340
commit df6d7a6609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 457 additions and 114 deletions

View File

@ -563,6 +563,11 @@ typedef struct
unsigned int dmrburstL;
unsigned int dmrburstR;
unsigned long long int R;
unsigned long long int H;
unsigned long long int HYTL;
unsigned long long int HYTR;
int DMRvcL;
int DMRvcR;
// int block_count;
short int dmr_encL;
short int dmr_encR;
@ -887,11 +892,13 @@ void dstar_header_decode(dsd_state * state, int radioheaderbuffer[660]);
#ifdef __cplusplus
extern "C" {
#endif
#ifdef USE_RTLSDR
void open_rtlsdr_stream(dsd_opts *opts);
void cleanup_rtlsdr_stream();
void get_rtlsdr_sample(int16_t *sample, dsd_opts * opts, dsd_state * state);
void rtlsdr_sighandler();
#endif
//TRELLIS
void CDMRTrellisTribitsToBits(const unsigned char* tribits, unsigned char* payload);
unsigned int CDMRTrellisCheckCode(const unsigned char* points, unsigned char* tribits);

View File

@ -368,23 +368,35 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
if (opts->inverted_dmr == 0)
{
fprintf (stderr,"Sync: +DMR [SLOT1] slot2 | | DMRSTEREO | VC%d ",vc1);
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
else
{
fprintf (stderr,"Sync: -DMR [SLOT1] slot2 | | DMRSTEREO | VC%d ",vc1);
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
}
@ -395,23 +407,35 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
if (opts->inverted_dmr == 0)
{
fprintf (stderr,"Sync: +DMR slot1 [SLOT2] | | DMRSTEREO | VC%d ",vc2);
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0)
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if (state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
else
{
fprintf (stderr,"Sync: -DMR slot1 [SLOT2] | | DMRSTEREO | VC%d ",vc2);
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0)
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if (state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
}
@ -435,10 +459,10 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
if (internalslot == 0 && vc1 == 6)
{
state->DMRvcL = 0;
if (state->payload_algid >= 0x21)
{
//running this as state->payload_mi > 0 apparently causes some problem, don't know why
if (state->payload_mi != 0 && state->payload_algid >= 0x21)
{
LFSR(state);
@ -449,12 +473,12 @@ void dmrBS (dsd_opts * opts, dsd_state * state)
if (internalslot == 1 && vc2 == 6)
{
state->DMRvcR = 0;
if (state->payload_algidR >= 0x21)
{
if (state->payload_miR != 0 && state->payload_algidR == 0x21)
{
LFSR(state); //re-enable this one after testing Late Entry MI
LFSR(state);
}
fprintf (stderr, "\n");
}
@ -565,8 +589,8 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
//payload buffer
//CACH + First Half Payload + Sync = 12 + 54 + 24
dibit_p = state->dibit_buf_p - 90; //this seems to work okay for both
//dibit_p = state->dmr_payload_p - 90;
//dibit_p = state->dibit_buf_p - 90; //this seems to work okay for both
dibit_p = state->dmr_payload_p - 90;
for (i = 0; i < 90; i++) //90
{
dibit = *dibit_p;
@ -710,6 +734,9 @@ void dmrBSBootstrap (dsd_opts * opts, dsd_state * state)
fprintf (stderr, "\n");
}
state->DMRvcL = 0;
state->DMRvcR = 0;
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
processMbeFrame (opts, state, NULL, ambe_fr3, NULL);

View File

@ -51,15 +51,15 @@ processDMRdata (dsd_opts * opts, dsd_state * state)
ccAscii[4] = 0;
bursttype[4] = 0;
dibit_p = state->dibit_buf_p - 90;
//dibit_p = state->dibit_buf_p - 90;
//using the estimate_symbol method for the dmr_payload_p buffer causes sync
//issues with P25, so only do it when frame_p25p1 == 0, or -fr option
//temp fix to only use dmr_payload_p buffer when no inversion expected, otherwise use dibit_buf
if (opts->frame_p25p1 == 0 && opts->inverted_dmr == 0) //opts->frame_p25p1 == 0 && opts->inverted_dmr == 0
{
dibit_p = state->dmr_payload_p - 90;
}
// if (opts->frame_p25p1 == 0 && opts->inverted_dmr == 0) //opts->frame_p25p1 == 0 && opts->inverted_dmr == 0
// {
// dibit_p = state->dmr_payload_p - 90;
// }
dibit_p = state->dmr_payload_p - 90;
// CACH, why aren't we running any FEC on this?
for (i = 0; i < 12; i++)
{

View File

@ -366,24 +366,36 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
if (internalslot == 0 && opts->inverted_dmr == 0)
{
fprintf (stderr,"Sync: +DMR MS MODE | Color Code=%02d | DMRSTEREO | VC%d ", state->color_code, vc1);
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
if (internalslot == 0 && opts->inverted_dmr == 1)
{
fprintf (stderr,"Sync: -DMR MS MODE | Color Code=%02d | DMRSTEREO | VC%d ", state->color_code, vc1);
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
@ -400,10 +412,9 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
processMbeFrame (opts, state, NULL, ambe_fr3, NULL);
//need to seperate the algs here so we don't run LFSR on 22 and so on
if (vc1 == 6 && state->payload_algid >= 21)
{
//state->currentslot = 0;
state->DMRvcL = 0;
if (state->payload_mi != 0 && state->payload_algid >= 0x21)
{
LFSR(state);
@ -614,29 +625,44 @@ void dmrMSBootstrap (dsd_opts * opts, dsd_state * state)
if (opts->inverted_dmr == 0)
{
fprintf (stderr,"Sync: +DMR MS MODE | Frame Sync | DMRSTEREO | VC1 ");
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) ||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) )
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10) ||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x10) )
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if ( (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68) ||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x68) )
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
else
{
fprintf (stderr,"Sync: -DMR MS MODE | Frame Sync | DMRSTEREO | VC1 ");
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) ||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) )
if ( (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10) ||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x10) )
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
fprintf (stderr, "%s", KNRM);
}
if ( (state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68) ||
(state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x68) )
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " T10 %010llX", state->H);
fprintf (stderr, "%s", KNRM);
}
fprintf (stderr, "\n");
}
state->dmr_ms_mode = 1;
state->DMRvcL = 0;
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
processMbeFrame (opts, state, NULL, ambe_fr2, NULL);

View File

@ -72,7 +72,7 @@ int BP[256] = {
};
if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0)
if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
@ -93,7 +93,7 @@ if (state->currentslot == 0 && state->K > 0 && state->dmr_so & 0x40 && state->pa
}
}
if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0)
if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x10)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " BPK %lld", state->K);
@ -114,6 +114,70 @@ if (state->currentslot == 1 && state->K > 0 && state->dmr_soR & 0x40 && state->p
}
}
if (state->currentslot == 0 && state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " HYT %010llX", state->H);
fprintf (stderr, "%s", KNRM);
k = state->H;
unsigned long long int msb = 0;
k = k << 8;
k = k | ((k >> 40) & 0xFF);
for(Frame = 0; Frame < 6; Frame++)
{
for(i = 0; i < 3; i++)
{
for(j = 0; j < 48; j++)
{
x = ( ((k << j) & 0x800000000000) >> 47 );
TSVoiceSupFrameL->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i][j] ^= x;
}
k = k << 1;
msb = (k >> 32) & 0xFFFF;
k = (k << 8) & 0xFFFFFFFF0000;
k = k | msb;
}
}
}
if (state->currentslot == 1 && state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
{
fprintf (stderr, "%s", KYEL);
fprintf(stderr, " HYT %010llX", state->H);
fprintf (stderr, "%s", KNRM);
k = state->H;
unsigned long long int msb = 0;
k = k << 8;
k = k | ((k >> 40) & 0xFF);
for(Frame = 0; Frame < 6; Frame++)
{
for(i = 0; i < 3; i++)
{
for(j = 0; j < 48; j++)
{
x = ( ((k << j) & 0x800000000000) >> 47 );
TSVoiceSupFrameR->TimeSlotAmbeVoiceFrame[Frame].AmbeBit[i][j] ^= x;
}
k = k << 1;
msb = (k >> 32) & 0xFFFF;
k = (k << 8) & 0xFFFFFFFF0000;
k = k | msb;
}
}
}
if (state->currentslot == 0)
{

View File

@ -1918,7 +1918,7 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
DmrDataBit[j + 6] = (DmrDataByte[i] >> 1) & 0x01;
DmrDataBit[j + 7] = (DmrDataByte[i] >> 0) & 0x01;
}
//fprintf (stderr, "\nDDB = 0x%X \n", DmrDataBit);
/* Store the Protect Flag (PF) bit */
TSVoiceSupFrame->FullLC.ProtectFlag = (unsigned int)(DmrDataBit[0]);
@ -1930,7 +1930,6 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
/* Store the Feature set ID (FID) */
TSVoiceSupFrame->FullLC.FeatureSetID = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[8], 8);
//state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
/* Store the Service Options */
TSVoiceSupFrame->FullLC.ServiceOptions = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[16], 8);
@ -1940,7 +1939,6 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
/* Store the Source address */
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&DmrDataBit[48], 24);
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
if((IrrecoverableErrors == 0) && CRCCorrect)
{
@ -1948,24 +1946,36 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
TSVoiceSupFrame->FullLC.DataValidity = 1;
if (state->currentslot == 0)
{
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
}
if (state->currentslot == 1)
{
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
state->lasttgR = TSVoiceSupFrame->FullLC.GroupAddress;
state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
}
}
else if(IrrecoverableErrors == 0)
{
//FEC okay? Set SVCop code anyways
TSVoiceSupFrame->FullLC.DataValidity = 0; //shouldn't matter in this context
//FEC okay. Set all variables anyways.
TSVoiceSupFrame->FullLC.DataValidity = 0;
if (state->currentslot == 0)
{
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
}
if (state->currentslot == 1)
{
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
state->lasttgR = TSVoiceSupFrame->FullLC.GroupAddress;
state->lastsrcR = TSVoiceSupFrame->FullLC.SourceAddress;
}
}
else
@ -1973,19 +1983,12 @@ void ProcessDmrVoiceLcHeader(dsd_opts * opts, dsd_state * state, uint8_t info[19
/* CRC checking error, so consider the Full LC data as invalid */
TSVoiceSupFrame->FullLC.DataValidity = 0;
}
//Full, amateur callsigns and labels not on this,
if (opts->payload == 1)
{
//fprintf (stderr, "\nFull VoiceLC Payload ");
for (i = 0; i < 12; i++)
{
//fprintf (stderr, "[%02X]", DmrDataByte[i]);
}
}
/* Print the destination ID (TG) and the source ID */
fprintf (stderr, "%s \n", KGRN);
fprintf (stderr, " Slot %d ", state->currentslot+1);
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
fprintf (stderr, " SLOT %d ", state->currentslot+1);
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
@ -2186,16 +2189,26 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
{
state->payload_algid = 0;
state->payload_keyid = 0;
//state->payload_mfid = 0;
state->payload_mi = 0;
// state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
//state->dmr_fid = 0;
//state->dmr_so = 0; //leave disabled so will persist to aid in muting or unmuting when required
state->lastsrc = 0;
state->lasttg = 0;
}
if (state->currentslot == 1)
{
state->payload_algidR = 0;
state->payload_keyidR = 0;
//state->payload_mfid = 0;
state->payload_miR = 0;
// state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
//state->dmr_fidR = 0;
//state->dmr_soR = 0;
state->lastsrcR = 0;
state->lasttgR = 0;
}
@ -2203,31 +2216,33 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
if((IrrecoverableErrors == 0) && CRCCorrect) //amateur DMR seems to only set radio ID up here I think, figure out best way to set without messing up other DMR types
{
fprintf (stderr, "%s \n", KRED);
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
fprintf (stderr, " SLOT %d ", state->currentslot+1);
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
fprintf (stderr, "%s ", KNRM);
//fprintf(stderr, "(CRC OK ) ");
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode == 0) //other opcodes may convey callsigns, names, etc.
{
if (state->currentslot == 0)
{
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
// state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
//zero out src and tgt here as well, or will that cause issues with ncurses terminal and per call?
}
if (state->currentslot == 1)
{
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
// state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
//zero out src and tgt here as well, or will that cause issues with ncurses terminal and per call?
}
}
}
else if(IrrecoverableErrors == 0)
{
fprintf (stderr, "%s \n", KRED);
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
fprintf (stderr, " SLOT %d ", state->currentslot+1);
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
fprintf(stderr, "RAS (FEC OK/CRC ERR)"); //tlc
fprintf (stderr, "%s ", KNRM);
if (TSVoiceSupFrame->FullLC.FullLinkControlOpcode == 0) //other opcodes may convey callsigns, names, etc.
@ -2235,13 +2250,13 @@ void ProcessDmrTerminaisonLC(dsd_opts * opts, dsd_state * state, uint8_t info[19
{
if (state->currentslot == 0)
{
state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
// state->dmr_fid = TSVoiceSupFrame->FullLC.FeatureSetID;
// state->dmr_so = TSVoiceSupFrame->FullLC.ServiceOptions;
}
if (state->currentslot == 1)
{
state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
// state->dmr_fidR = TSVoiceSupFrame->FullLC.FeatureSetID;
// state->dmr_soR = TSVoiceSupFrame->FullLC.ServiceOptions;
}
}
}
@ -2306,11 +2321,6 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
uint8_t CRCComputed;
uint32_t CRCCorrect = 0;
/* Remove warning compiler */
//UNUSED_VARIABLE(opts);
/* Check the current time slot */
if(state->currentslot == 0)
{
TSVoiceSupFrame = &state->TS1SuperFrame;
@ -2320,7 +2330,6 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
TSVoiceSupFrame = &state->TS2SuperFrame;
}
/* First step : Reconstitute the BPTC 16x8 matrix */
Burst = 1; /* Burst B to E contains embedded signaling data */
k = 0;
@ -2395,7 +2404,6 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
/* Store the Source address */
TSVoiceSupFrame->FullLC.SourceAddress = (unsigned int)ConvertBitIntoBytes(&LC_DataBit[48], 24);
//state->lastsrc = TSVoiceSupFrame->FullLC.SourceAddress;
/* Check the CRC values */
if((IrrecoverableErrors == 0))// && CRCCorrect)
@ -2440,7 +2448,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
{
fprintf(stderr, "\n");
}
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf (stderr, " Embedded Alias Header and Blocks: [%s%s%s%s%s]", state->dmr_callsign[state->currentslot][0],
state->dmr_callsign[state->currentslot][1], state->dmr_callsign[state->currentslot][2],
state->dmr_callsign[state->currentslot][3], state->dmr_callsign[state->currentslot][4] );
@ -2467,7 +2475,7 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
{
fprintf(stderr, "\n");
}
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf (stderr, " Embedded GPS: [%s]", state->dmr_callsign[state->currentslot][5] );
fprintf (stderr, "%s ", KNRM);
}
@ -2483,11 +2491,45 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
{
fprintf(stderr, "\n");
}
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
fprintf (stderr, " SLOT %d ", state->currentslot+1);
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
fprintf (stderr, "%s ", KNRM);
//fprintf(stderr, "(CRC OK ) ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
{
fprintf (stderr, "%s ", KRED);
fprintf(stderr, "Encrypted ");
//fprintf (stderr, "%s ", KNRM);
}
else
{
fprintf (stderr, "%s ", KGRN);
fprintf(stderr, "Clear/Unencrypted ");
//fprintf (stderr, "%s ", KNRM);
}
/* Check the "Reserved" bits */
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x30)
{
/* Experimentally determined with DSD+, when the "Reserved" bit field
* is equal to 0x2, this is a TXI call */
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) == 0x20) fprintf(stderr, "TXI ");
else fprintf(stderr, "Reserved=%d ", (TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) >> 4);
}
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x08) fprintf(stderr, "Broadcast ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x04) fprintf(stderr, "OVCM ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x03)
{
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x01) fprintf(stderr, "Priority 1 ");
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x02) fprintf(stderr, "Priority 2 ");
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x03) fprintf(stderr, "Priority 3 ");
else fprintf(stderr, "No Priority "); /* We should never go here */
}
fprintf(stderr, "Call ");
fprintf (stderr, "%s ", KNRM);
if (state->currentslot == 0)
{
state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;
@ -2516,12 +2558,47 @@ void ProcessVoiceBurstSync(dsd_opts * opts, dsd_state * state)
{
fprintf(stderr, "\n");
}
fprintf (stderr, " SLOT %d", state->currentslot+1);
fprintf(stderr, " TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
//fprintf(stderr, "FID=0x%02X ", TSVoiceSupFrame->FullLC.FeatureSetID);
fprintf (stderr, " SLOT %d ", state->currentslot+1);
fprintf(stderr, "TGT=%u SRC=%u ", TSVoiceSupFrame->FullLC.GroupAddress, TSVoiceSupFrame->FullLC.SourceAddress);
fprintf(stderr, "FID=0x%02X SVC=0x%02X", TSVoiceSupFrame->FullLC.FeatureSetID, TSVoiceSupFrame->FullLC.ServiceOptions);
fprintf (stderr, "%s ", KRED);
fprintf(stderr, "RAS (FEC OK/CRC ERR) ");
fprintf (stderr, "%s ", KNRM);
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x80) fprintf(stderr, "Emergency ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x40)
{
fprintf (stderr, "%s ", KRED);
fprintf(stderr, "Encrypted ");
//fprintf (stderr, "%s ", KNRM);
}
else
{
fprintf (stderr, "%s ", KGRN);
fprintf(stderr, "Clear/Unencrypted ");
//fprintf (stderr, "%s ", KNRM);
}
/* Check the "Reserved" bits */
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x30)
{
/* Experimentally determined with DSD+, when the "Reserved" bit field
* is equal to 0x2, this is a TXI call */
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) == 0x20) fprintf(stderr, "TXI ");
else fprintf(stderr, "Reserved=%d ", (TSVoiceSupFrame->FullLC.ServiceOptions & 0x30) >> 4);
}
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x08) fprintf(stderr, "Broadcast ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x04) fprintf(stderr, "OVCM ");
if(TSVoiceSupFrame->FullLC.ServiceOptions & 0x03)
{
if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x01) fprintf(stderr, "Priority 1 ");
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x02) fprintf(stderr, "Priority 2 ");
else if((TSVoiceSupFrame->FullLC.ServiceOptions & 0x03) == 0x03) fprintf(stderr, "Priority 3 ");
else fprintf(stderr, "No Priority "); /* We should never go here */
}
fprintf(stderr, "Call ");
fprintf (stderr, "%s ", KNRM);
if (state->currentslot == 0)
{
state->lasttg = TSVoiceSupFrame->FullLC.GroupAddress;

View File

@ -318,6 +318,13 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
// store non-inverted values in dibit_buf
*state->dibit_buf_p = invert_dibit(dibit);
state->dibit_buf_p++;
//dmr buffer
*state->dmr_payload_p = invert_dibit(dibit); //invert, or no?
// *state->dmr_payload_p = dibit; //invert, or no?
state->dmr_payload_p++;
//dmr buffer end
return dibit;
}
else

View File

@ -295,14 +295,14 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
state->dmr_payload_p = state->dmr_payload_buf + 200;
}
int valid;
// int valid;
//running estimate_symbol causes an issue with P25 syncing properly
if (opts->frame_p25p1 != 1)
{
valid = estimate_symbol(state->rf_mod, &(state->p25_heuristics), state->last_dibit, symbol, &dibit);
}
// if (opts->frame_p25p1 != 1)
// {
// valid = estimate_symbol(state->rf_mod, &(state->p25_heuristics), state->last_dibit, symbol, &dibit);
// }
if (opts->frame_dmr == 1 && valid == 0) //opts->dmr_stereo
if (1 == 1) //opts->dmr_stereo //opts->frame_dmr == 1 && valid == 0
{
if (symbol > state->center)
{

View File

@ -144,6 +144,16 @@ noCarrier (dsd_opts * opts, dsd_state * state)
state->payload_keyid = 0;
state->payload_keyidR = 0;
state->dmr_fid = 0;
state->dmr_so = 0;
state->dmr_fidR = 0;
state->dmr_soR = 0;
state->HYTL = 0;
state->HYTR = 0;
state->DMRvcL = 0;
state->DMRvcR = 0;
state->payload_miN = 0;
state->p25vc = 0;
state->payload_miP = 0;
@ -469,6 +479,7 @@ initState (dsd_state * state)
state->K = 0;
state->R = 0;
state->H = 0;
state->dmr_stereo = 0;
state->dmrburstL = 17; //initialize at higher value than possible
@ -479,6 +490,11 @@ initState (dsd_state * state)
state->dmr_fidR = 0;
state->dmr_ms_mode = 0;
state->HYTL = 0;
state->HYTR = 0;
state->DMRvcL = 0;
state->DMRvcR = 0;
state->p25vc = 0;
state->payload_miP = 0;
@ -616,6 +632,10 @@ usage ()
printf (" Use if skipping occurs, but may cause wonky audio due to loss of good sync\n");
printf (" -Z Log MBE/Frame Payloads to console\n");
printf ("\n");
printf (" -K <dec> Manually Enter DMRA BP Key (Decimal Value of Key Number)\n");
printf ("\n");
printf (" -H <hex> Manually Enter **tera 10 BP Key (40-Bit/10-Char Hex Value)\n");
printf ("\n");
exit (0);
}
@ -854,7 +874,7 @@ main (int argc, char **argv)
exitflag = 0;
signal (SIGINT, sigfun);
while ((c = getopt (argc, argv, "haep:P:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:Y:K:NQWrlZTF")) != -1)
while ((c = getopt (argc, argv, "haep:P:qstv:z:i:o:d:c:g:nw:B:C:R:f:m:u:x:A:S:M:G:D:L:V:U:Y:K:H:NQWrlZTF")) != -1)
{
opterr = 0;
switch (c)
@ -933,6 +953,21 @@ main (int argc, char **argv)
}
break;
case 'H':
sscanf (optarg, "%llX", &state.H);
if (state.H > 0xFFFFFFFFFF)
{
state.H = 0xFFFFFFFFFF;
}
opts.dmr_mute_encL = 0;
opts.dmr_mute_encR = 0;
if (state.H == 0)
{
opts.dmr_mute_encL = 1;
opts.dmr_mute_encR = 1;
}
break;
case 'G': //Set rtl device gain
sscanf (optarg, "%d", &opts.rtl_gain_value); //multiple value by ten to make it consitent with the way rtl_fm really works
break;

View File

@ -228,8 +228,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
mbe_demodulateAmbe3600x2450Data (ambe_fr);
state->errs2 += mbe_eccAmbe3600x2450Data (ambe_fr, ambe_d);
//
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0) //
if (state->K > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x10)
{
k = BP[state->K];
k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k );
@ -240,6 +239,36 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
}
}
if (state->currentslot == 0 && state->H > 0 && state->dmr_so & 0x40 && state->payload_keyid == 0 && state->dmr_fid == 0x68)
{
unsigned long long int msb = 0;
if (state->DMRvcL == 0)
{
state->HYTL = state->H;
k = state->H;
k = k << 8;
k = k | ((k >> 40) & 0xFF);
state->HYTL = k;
}
k = state->HYTL;
for(short int j = 0; j < 48; j++)
{
x = ( ((k << j) & 0x800000000000) >> 47 );
ambe_d[j] ^= x;
}
k = k << 1;
msb = (k >> 32) & 0xFFFF; //new MSB
k = (k << 8) & 0xFFFFFFFF0000;
k = k | msb;
state->HYTL = k;
state->DMRvcL++;
}
mbe_processAmbe2450Dataf (state->audio_out_temp_buf, &state->errs, &state->errs2, state->err_str,
ambe_d, state->cur_mp, state->prev_mp, state->prev_mp_enhanced, opts->uvquality);
@ -260,8 +289,8 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
mbe_demodulateAmbe3600x2450Data (ambe_fr);
state->errs2R += mbe_eccAmbe3600x2450Data (ambe_fr, ambe_d);
//BP Handling, Slot 2
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0) //
if (state->K > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fid == 0x10)
{
k = BP[state->K];
k = ( ((k & 0xFF0F) << 32 ) + (k << 16) + k );
@ -272,6 +301,36 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
}
}
if (state->H > 0 && state->dmr_soR & 0x40 && state->payload_keyidR == 0 && state->dmr_fidR == 0x68)
{
unsigned long long int msb = 0;
if (state->DMRvcR == 0)
{
state->HYTR = state->H;
k = state->H;
k = k << 8;
k = k | ((k >> 40) & 0xFF);
state->HYTR = k;
}
k = state->HYTR;
for(short int j = 0; j < 48; j++)
{
x = ( ((k << j) & 0x800000000000) >> 47 );
ambe_d[j] ^= x;
}
k = k << 1;
msb = (k >> 32) & 0xFFFF;
k = (k << 8) & 0xFFFFFFFF0000;
k = k | msb;
state->HYTR = k;
state->DMRvcR++;
}
mbe_processAmbe2450Dataf (state->audio_out_temp_bufR, &state->errsR, &state->errs2R, state->err_strR,
ambe_d, state->cur_mp2, state->prev_mp2, state->prev_mp_enhanced2, opts->uvquality);

View File

@ -206,7 +206,7 @@ char *choices[] = {
"Decode NXDN96",
"Decode X2-TDMA*",
"Toggle Signal Inversion",
" ", //spacer
"Basic Key Entry", //spacer
"Reset Call History",
"Enable Payloads to Console",
"Disable Payloads to Console",
@ -312,13 +312,6 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
closePulseInput(opts);
}
if (opts->audio_in_type == 3)
{
//function hangs, figure out why I can't release/stop the dongle
//cleanup_rtlsdr_stream(); //close down the rtl dongle
//rtlsdr_sighandler();
}
state->payload_keyid = 0;
state->payload_keyidR = 0;
@ -809,27 +802,59 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
{
state->payload_keyid = 0;
state->payload_keyidR = 0;
state->K = 0;
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
// state->K = 0;
// state->H = 0;
short int option = 0;
entry_win = newwin(9, WIDTH+6, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, " ");
mvwprintw(entry_win, 3, 3, " ");
mvwprintw(entry_win, 2, 2, "Key Type Selection");
mvwprintw(entry_win, 3, 2, " ");
mvwprintw(entry_win, 4, 2, "1 - DMRA BP ");
mvwprintw(entry_win, 5, 2, "2 - Tera BP ");
mvwprintw(entry_win, 6, 3, " ");
echo();
refresh();
wscanw(entry_win, "%d", &state->K);
wscanw(entry_win, "%d", &option);
noecho();
opts->dmr_mute_encL = 0;
opts->dmr_mute_encR = 0;
if (state->K > 255)
if (option == 1)
{
state->K = 255;
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, "DMRA BP Key Number (DEC):");
mvwprintw(entry_win, 3, 3, " ");
echo();
refresh();
wscanw(entry_win, "%lld", &state->K);
noecho();
if (state->K > 255)
{
state->K = 255;
}
}
if (state->K == 0)
if (option == 2)
{
entry_win = newwin(6, WIDTH+6, starty+10, startx+10);
box (entry_win, 0, 0);
mvwprintw(entry_win, 2, 2, "**Tera 10 Key Value (HEX):");
mvwprintw(entry_win, 3, 3, " ");
echo();
refresh();
wscanw(entry_win, "%llX", &state->H);
noecho();
if (state->H > 0xFFFFFFFFFF)
{
state->H = 0xFFFFFFFFFF;
}
}
if (state->K == 0 && state->H == 0)
{
opts->dmr_mute_encL = 1;
opts->dmr_mute_encR = 1;
}
break;
}
@ -1367,7 +1392,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
}
if (state->dmrburstR == 16 && state->lastsrcR > 0) //state->currentslot == 1 &&
if (state->dmrburstR == 16 && state->lasttgR > 0) //state->currentslot == 1 &&
{
tgR = state->lasttgR;
@ -1766,7 +1791,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
if (state->payload_algid == 0xAA)
{
attron(COLOR_PAIR(1));
printw(" ADP/RC4");
printw(" RC4");
attron(COLOR_PAIR(3));
}
if (state->payload_algid == 0x81)
@ -1810,7 +1835,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
printw ("\n");
//printw ("| | "); //10 spaces
printw ("| V XTRA | "); //10 spaces
//Burger King
if(state->dmrburstL == 16 && state->payload_algid == 0 && (state->dmr_so & 0xCF) == 0x40) //4F or CF mask? & 0xCF currently
{
attron(COLOR_PAIR(5));
@ -1818,14 +1843,24 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
attroff(COLOR_PAIR(5));
attron(COLOR_PAIR(3));
}
//Point
if(state->dmrburstL == 16 && state->payload_algid == 0 && state->K > 0 && (state->dmr_so & 0xCF) == 0x40)
if(state->dmrburstL == 16 && state->payload_algid == 0 && state->K > 0 && state->dmr_fid == 0x10 && (state->dmr_so & 0xCF) == 0x40)
{
attron(COLOR_PAIR(1));
printw ("BPK [%3lld] ", state->K);
//printw ("BPK [%3lld] ", state->K);
printw ("DMRA BP Key [%3lld] ", state->K);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(3));
}
if(state->dmrburstL == 16 && state->payload_algid == 0 && state->H > 0 && state->dmr_fid == 0x68 && ((state->dmr_so & 0xCF) == 0x40) )
{
attron(COLOR_PAIR(1));
printw ("**Tera BP Key [%010llX] ", state->H);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(3));
}
//ALG, KeyID, MI //was key_id
if(state->dmrburstL == 16 && state->payload_algid > 0 && (state->dmr_so & 0xCF) == 0x40)
{
@ -1911,7 +1946,6 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
//printw ("| | "); //12 spaces
printw ("| V XTRA | "); //10 spaces
//Burger King 2
if(state->dmrburstR == 16 && state->payload_algidR == 0 && (state->dmr_soR & 0xCF) == 0x40) //4F or CF mask?
{
attron(COLOR_PAIR(5));
@ -1919,11 +1953,18 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state)
attroff(COLOR_PAIR(5));
attron(COLOR_PAIR(3));
}
//Point 2
if(state->dmrburstR == 16 && state->payload_algidR == 0 && state->K > 0 && (state->dmr_soR & 0xCF) == 0x40)
if(state->dmrburstR == 16 && state->payload_algidR == 0 && state->K > 0 && ((state->dmr_soR & 0xCF) == 0x40) && state->dmr_fidR == 0x10)
{
attron(COLOR_PAIR(1));
printw ("BPK [%3lld] ", state->K);
printw ("DMRA BP Key [%3lld] ", state->K);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(3));
}
if(state->dmrburstR == 16 && state->payload_algidR == 0 && state->H > 0 && ((state->dmr_soR & 0xCF) == 0x40) && state->dmr_fidR == 0x68)
{
attron(COLOR_PAIR(1));
printw ("**Tera BP Key [%010llX] ", state->H);
attroff(COLOR_PAIR(1));
attron(COLOR_PAIR(3));
}