P25 - Fix SNDCP Ann vPDU + Misc LCW/TSBK/MPDU;

This commit is contained in:
lwvmobile 2023-11-27 11:42:18 -05:00
parent 76b6aa46bd
commit 19712bf401
4 changed files with 65 additions and 111 deletions

View File

@ -193,20 +193,6 @@ void p25_lcw (dsd_opts * opts, dsd_state * state, uint8_t LCW_bits[], uint8_t ir
fprintf (stderr, " Call Alert");
}
else if (lc_format == 0x57)
{
fprintf (stderr, " Extended Function Command");
}
else if (lc_format == 0x58)
{
fprintf (stderr, " Channel Identifier Update");
}
else if (lc_format == 0x59)
{
fprintf (stderr, " Channel Identifier Update VU");
}
else if (lc_format == 0x5A)
{
@ -303,7 +289,8 @@ void p25_lcw (dsd_opts * opts, dsd_state * state, uint8_t LCW_bits[], uint8_t ir
//tune back to CC here - save about 1-2 seconds
else if (lc_format == 0x4F) //# Call Termination/Cancellation
{
fprintf (stderr, " Call Termination");
uint32_t tgt = (uint32_t)ConvertBitIntoBytes(&LCW_bits[48], 24); //can be individual, or all units (0xFFFFFF)
fprintf (stderr, " Call Termination; TGT: %d;", tgt);
if (opts->p25_trunk == 1 && state->p25_cc_freq != 0 && opts->p25_is_tuned == 1)
{
@ -370,6 +357,47 @@ void p25_lcw (dsd_opts * opts, dsd_state * state, uint8_t LCW_bits[], uint8_t ir
else fprintf (stderr, " Unknown Format %02X MFID %02X SVC %02X", lc_format, lc_mfid, lc_svcopt);
}
//TODO: Look through all LCW format messages and move here if they don't use the MFID field
//just going to add/fix a few values I've observed for now, one issue with doing so may
//be where there is a reserved field that is also used as an MFID, i.e., Call Termination 0xF vs Moto Talker EOT 0xF with
//the reserved field showing the 0x90 for moto in it, and Harris 0xA vs Unit to Unit Voice Call 0xA
//TODO: Add Identification of Special SU Address values
//0 - No Unit
//1-0xFFFFFB - Assignable Units
//0xFFFFFC - FNE 16777212
//0xFFFFFD - System Default (FNE Calling Functions, Registration, Mobility)
//0xFFFFFE - Registration Default (registration transactions from SU)
//0xFFFFFF - All Units
//This lc_format doesn't use the MFID field
else if (lc_format == 0x42)
fprintf (stderr, " Conventional Fallback Indication");
//This lc_format doesn't use the MFID field
else if (lc_format == 0x57)
fprintf (stderr, " Extended Function Command");
//This lc_format doesn't use the MFID field
else if (lc_format == 0x58)
{
uint8_t iden = (uint8_t)ConvertBitIntoBytes(&LCW_bits[8], 4);
uint32_t base = (uint32_t)ConvertBitIntoBytes(&LCW_bits[40], 32);
fprintf (stderr, " Channel Identifier Update VU; Iden: %X; Base: %d;", iden, base*5);
}
//This lc_format doesn't use the MFID field
else if (lc_format == 0x59)
{
uint8_t iden = (uint8_t)ConvertBitIntoBytes(&LCW_bits[8], 4);
uint32_t base = (uint32_t)ConvertBitIntoBytes(&LCW_bits[40], 32);
fprintf (stderr, " Channel Identifier Update VU; Iden: %X; Base: %d;", iden, base*5);
}
//This lc_format doesn't use the MFID field
else if (lc_format == 0x63)
fprintf (stderr, " RFSS Status Broadcast");
//MFID 90 Embedded GPS
else if (lc_mfid == 0x90 && lc_opcode == 0x6)
{
@ -392,22 +420,20 @@ void p25_lcw (dsd_opts * opts, dsd_state * state, uint8_t LCW_bits[], uint8_t ir
else if (lc_mfid == 0x90 && lc_opcode == 0xF)
{
uint32_t src = (uint32_t)ConvertBitIntoBytes(&LCW_bits[48], 24);
fprintf (stderr, " MFID90 (Moto) Talker EOT; SRC: %d", src);
fprintf (stderr, " MFID90 (Moto) Talker EOT; SRC: %d;", src);
}
//observed format value on SNDCP data channels
else if (lc_format == 0x58)
//observed format value on Harris SNDCP data channel (Phase 2 CC to Phase 1 MPDU channel)
else if (lc_mfid == 0xA4 && lc_format == 0x0A)
{
//will need to look for the appropriate values to fill in here from the manual,
//MFID values seem to look like a counter of some sort? offset maybe? or block number?
fprintf (stderr, " SNDCP Data Channel LCW %02X", lc_format);
//Could also just be a Unit to Unit Voice Channel User using the reserved field as the MFID?
//if it were similar to Unit to Unit though, the TGT and SRC values seem to be reversed
//this appears to be a data channel indicator, has a matching target and the FNE address in it
uint32_t src = (uint32_t)ConvertBitIntoBytes(&LCW_bits[24], 24);
uint32_t tgt = (uint32_t)ConvertBitIntoBytes(&LCW_bits[48], 24);
fprintf (stderr, " MFIDA4 (Harris) Data Channel; SRC: %d; TGT: %d;", src, tgt);
}
//observed format value on SNDCP data channels
else if (lc_format == 0x63) //based on the SAP of the same value found in BAHA-A (unconfirmed, but may make sense?)
fprintf (stderr, " Protected Format LCW %02X", lc_format);
//not a duplicate, this one will print if not MFID 0 or 1
else
{

View File

@ -316,7 +316,8 @@ void processMPDU(dsd_opts * opts, dsd_state * state)
fprintf (stderr, "%s",KRED);
fprintf (stderr, " P25 Data Header CRC Error");
fprintf (stderr, "%s",KNRM);
sprintf (state->dmr_lrrp_gps[0], "Data Call: Header Error; Unknown Format/SAP;");
//Don't add to the data call string, can occur when tuning from control channel with MBT blocks
// sprintf (state->dmr_lrrp_gps[0], "Data Call: Header Error; Unknown Format/SAP;");
end = 1; //go ahead and end after this loop
}

View File

@ -147,7 +147,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
//MFIDA4 Group Regroup Explicit Encryption Command
if ( (tsbk_byte[0] & 0x3F) == 0x30)
{
fprintf (stderr, "%s",KCYN);
fprintf (stderr, "%s",KYEL);
fprintf (stderr, "\n MFID A4 (Harris) Group Regroup Explicit Encryption Command\n");
int sg = (tsbk_byte[3] << 8) | tsbk_byte[4];
int key = (tsbk_byte[5] << 8) | tsbk_byte[6];
@ -401,6 +401,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
else if ( (tsbk_byte[0] & 0x3F) == 0x00)
{
fprintf (stderr, "\n");
fprintf (stderr, "%s",KYEL);
fprintf (stderr, " MFID 90 (Moto) Group Regroup Add: ");
for (i = 2; i < 10; i++)
fprintf (stderr, "%02X", tsbk_byte[i]);
@ -409,6 +410,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
else if ( (tsbk_byte[0] & 0x3F) == 0x01 )
{
fprintf (stderr, "\n");
fprintf (stderr, "%s",KYEL);
fprintf (stderr, " MFID 90 (Moto) Group Regroup Delete: ");
for (i = 2; i < 10; i++)
fprintf (stderr, "%02X", tsbk_byte[i]);
@ -417,6 +419,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
else if ( (tsbk_byte[0] & 0x3F) == 0x04 )
{
fprintf (stderr, "\n");
fprintf (stderr, "%s",KYEL);
fprintf (stderr, " MFID 90 (Moto) Extended Function: ");
for (i = 2; i < 10; i++)
fprintf (stderr, "%02X", tsbk_byte[i]);
@ -425,6 +428,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
else if ( (tsbk_byte[0] & 0x3F) == 0x06 )
{
fprintf (stderr, "\n");
fprintf (stderr, "%s",KYEL);
fprintf (stderr, " MFID 90 (Moto) Queued Response: ");
for (i = 2; i < 10; i++)
fprintf (stderr, "%02X", tsbk_byte[i]);
@ -433,6 +437,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
else if ( (tsbk_byte[0] & 0x3F) == 0x07 )
{
fprintf (stderr, "\n");
fprintf (stderr, "%s",KYEL);
fprintf (stderr, " MFID 90 (Moto) Deny Response: ");
for (i = 2; i < 10; i++)
fprintf (stderr, "%02X", tsbk_byte[i]);
@ -441,6 +446,7 @@ void processTSBK(dsd_opts * opts, dsd_state * state)
else if ( (tsbk_byte[0] & 0x3F) == 0x08 )
{
fprintf (stderr, "\n");
fprintf (stderr, "%s",KYEL);
fprintf (stderr, " MFID 90 (Moto) Acknoledge Response: ");
for (i = 2; i < 10; i++)
fprintf (stderr, "%02X", tsbk_byte[i]);

View File

@ -1584,91 +1584,12 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
int channelt = (MAC[4+len_a] << 8) | MAC[5+len_a];
int channelr = (MAC[6+len_a] << 8) | MAC[7+len_a];
int dac = (MAC[8+len_a] << 8) | MAC[9+len_a];
if (channelt != 0)
fprintf (stderr, "\n AA: %d; RA: %d; DSO: %02X; DAC: %02X; CHAN-T: %04X; CHAN-R: %04X;", aa, ra, dso, dac, channelt, channelr);
else fprintf (stderr, "- Null");
long int freq = 0;
fprintf (stderr, "\n AA: %d; RA: %d; DSO: %02X; DAC: %02X; CHAN-T: %04X; CHAN-R: %04X;", aa, ra, dso, dac, channelt, channelr);
long int freq = 0; UNUSED(freq);
if (channelt != 0)
freq = process_channel_to_freq (opts, state, channelt);
//nothing to do but skip
// if (channelt == 0)
goto SKIPCALL; //this is just an announcement, and not a grant/tunable action
//add active channel to string for ncurses display
if (channelt != 0)
{
sprintf (state->active_channel[0], "Active Data Ch: %04X Annoucement; ", channelt);
state->last_active_time = time(NULL);
}
//Skip tuning data calls if data calls is disabled
if (opts->trunk_tune_data_calls == 0) goto SKIPCALL;
//just skip altogether if a tg hold
if (state->tg_hold != 0) goto SKIPCALL;
//tune if tuning available -- not even sure if you tune with these or not...
if (opts->p25_trunk == 1 && (strcmp(mode, "DE") != 0) && (strcmp(mode, "B") != 0))
{
//reworked to set freq once on any call to process_channel_to_freq, and tune on that, independent of slot
if (state->p25_cc_freq != 0 && opts->p25_is_tuned == 0 && freq != 0) //if we aren't already on a VC and have a valid frequency
{
//changed to allow symbol rate change on C4FM Phase 2 systems as well as QPSK
if (1 == 1)
{
if (state->p25_chan_tdma[channelt >> 12] == 1)
{
state->samplesPerSymbol = 8;
state->symbolCenter = 3;
//shim fix to stutter/lag by only enabling slot on the target/channel we tuned to
//this will only occur in realtime tuning, not not required .bin or .wav playback
if (channelt & 1) //VCH1
{
opts->slot1_on = 0;
opts->slot2_on = 1;
}
else //VCH0
{
opts->slot1_on = 1;
opts->slot2_on = 0;
}
}
}
//rigctl
if (opts->use_rigctl == 1)
{
if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw);
SetFreq(opts->rigctl_sockfd, freq);
if (state->synctype == 0 || state->synctype == 1) state->p25_vc_freq[0] = freq;
opts->p25_is_tuned = 1; //set to 1 to set as currently tuned so we don't keep tuning nonstop
state->last_vc_sync_time = time(NULL);
}
//rtl
else if (opts->audio_in_type == 3)
{
#ifdef USE_RTLSDR
rtl_dev_tune (opts, freq);
if (state->synctype == 0 || state->synctype == 1) state->p25_vc_freq[0] = freq;
opts->p25_is_tuned = 1;
state->last_vc_sync_time = time(NULL);
#endif
}
}
}
if (opts->p25_trunk == 0)
{
// if (target == state->lasttg || target == state->lasttgR)
{
//P1 FDMA
if (state->synctype == 0 || state->synctype == 1) state->p25_vc_freq[0] = freq;
//P2 TDMA
else state->p25_vc_freq[0] = state->p25_vc_freq[1] = freq;
}
}
if (channelr != 0)
freq = process_channel_to_freq (opts, state, channelt);
}