P25: Fix Extended Channel Grants/Updates/Full SUID Values;

This commit is contained in:
lwvmobile
2024-03-30 17:21:10 -04:00
parent 931fae62c6
commit bb78b1bf27
3 changed files with 48 additions and 12 deletions

View File

@@ -147,15 +147,19 @@ void p25_lcw (dsd_opts * opts, dsd_state * state, uint8_t LCW_bits[], uint8_t ir
else if (lc_format == 0x49) else if (lc_format == 0x49)
{ {
fprintf (stderr, " Souce ID Extension"); fprintf (stderr, " Source ID Extension -");
uint32_t nid = (uint32_t)ConvertBitIntoBytes(&LCW_bits[16], 24);
uint32_t src = (uint32_t)ConvertBitIntoBytes(&LCW_bits[40], 24);
fprintf (stderr, " Full SUID: %08X-%08d", nid, src);
} }
else if (lc_format == 0x4A) else if (lc_format == 0x4A)
{ {
fprintf (stderr, " Unit to Unit Voice Channel User – Extended"); fprintf (stderr, " Unit to Unit Voice Channel User – Extended");
uint32_t target = (uint32_t)ConvertBitIntoBytes(&LCW_bits[16], 24); uint32_t target = (uint32_t)ConvertBitIntoBytes(&LCW_bits[16], 24);
uint32_t suid = (uint32_t)ConvertBitIntoBytes(&LCW_bits[40], 24); uint32_t src = (uint32_t)ConvertBitIntoBytes(&LCW_bits[40], 24);
fprintf (stderr, "TGT: %04X SUID: %d; ", target, suid); fprintf (stderr, "TGT: %d; SRC: %d; ", target, src);
} }
else if (lc_format == 0x50) else if (lc_format == 0x50)

View File

@@ -576,8 +576,13 @@ void processMPDU(dsd_opts * opts, dsd_state * state)
int channelt = (mpdu_byte[22] << 8) | mpdu_byte[23]; int channelt = (mpdu_byte[22] << 8) | mpdu_byte[23];
int channelr = (mpdu_byte[24] << 8) | mpdu_byte[25]; //optional! int channelr = (mpdu_byte[24] << 8) | mpdu_byte[25]; //optional!
//using source and target address, not source and target id (is this correct?) //using source and target address, not source and target id (is this correct?)
long int source = (mpdu_byte[3] << 16) |(mpdu_byte[4] << 8) | mpdu_byte[5]; long int source = (mpdu_byte[3] << 16) | (mpdu_byte[4] << 8) | mpdu_byte[5];
long int target = (mpdu_byte[19] << 16) |(mpdu_byte[20] << 8) | mpdu_byte[21]; long int target = (mpdu_byte[19] << 16) |(mpdu_byte[20] << 8) | mpdu_byte[21];
//TODO: Test Full Values added here for SUID, particular tgt_nid and tgt_sid
long int src_nid = (mpdu_byte[12] << 24) | (mpdu_byte[13] << 16) | (mpdu_byte[14] << 8) | mpdu_byte[15];
long int src_sid = (mpdu_byte[16] << 16) | (mpdu_byte[17] << 8) | mpdu_byte[18];
long int tgt_nid = (mpdu_byte[26] << 16) | (mpdu_byte[27] << 8) | mpdu_byte[28]; //only has 3 octets on tgt nid, partial only?
long int tgt_sid = (mpdu_byte[29] << 16) | (mpdu_byte[30] << 8) | mpdu_byte[31];
long int freq1 = 0; long int freq1 = 0;
long int freq2 = 0; long int freq2 = 0;
UNUSED(freq2); UNUSED(freq2);
@@ -594,7 +599,8 @@ void processMPDU(dsd_opts * opts, dsd_state * state)
fprintf (stderr, " Priority %d", svc & 0x7); //call priority fprintf (stderr, " Priority %d", svc & 0x7); //call priority
} }
fprintf (stderr, " Unit to Unit Voice Channel Grant Update - Extended"); fprintf (stderr, " Unit to Unit Voice Channel Grant Update - Extended");
fprintf (stderr, "\n SVC [%02X] CHAN-T [%04X] CHAN-R [%04X] Source [%ld][%04lX] Target [%ld][%04lX]", svc, channelt, channelr, source, source, target, target); // fprintf (stderr, "\n SVC [%02X] CHAN-T [%04X] CHAN-R [%04X] Source [%ld][%04lX] Target [%ld][%04lX]", svc, channelt, channelr, source, source, target, target);
fprintf (stderr, "\n SVC: %02X; CHAN-T: %04X; CHAN-R: %04X; SRC: %d; TGT: %d; FULL SRC: %08X-%08d; FULL TGT: %08X-%08d;", svc, channelt, channelr, source, target, src_nid, src_sid, tgt_nid, tgt_sid);
freq1 = process_channel_to_freq (opts, state, channelt); freq1 = process_channel_to_freq (opts, state, channelt);
freq2 = process_channel_to_freq (opts, state, channelr); //optional! freq2 = process_channel_to_freq (opts, state, channelr); //optional!

View File

@@ -695,16 +695,31 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
} }
//Unit-to-Unit Voice Service Channel Grant (UU_V_CH_GRANT), or Grant Update (same format) //Unit-to-Unit Voice Service Channel Grant (UU_V_CH_GRANT), or Grant Update (same format)
if (MAC[1+len_a] == 0x44 || MAC[1+len_a] == 0x46) //double check these opcodes if (MAC[1+len_a] == 0x44 || MAC[1+len_a] == 0x46 || MAC[1+len_a] == 0xC4) //double check these opcodes
{ {
int channel = (MAC[2+len_a] << 8) | MAC[3+len_a]; int channel = (MAC[2+len_a] << 8) | MAC[3+len_a];
int target = (MAC[4+len_a] << 16) | (MAC[5+len_a] << 8) | MAC[6+len_a]; int target = (MAC[4+len_a] << 16) | (MAC[5+len_a] << 8) | MAC[6+len_a];
int source = (MAC[7+len_a] << 16) | (MAC[8+len_a] << 8) | MAC[9+len_a]; int source = (MAC[7+len_a] << 16) | (MAC[8+len_a] << 8) | MAC[9+len_a];
unsigned long long int src_suid = 0;
long int freq = 0; long int freq = 0;
if (MAC[1+len_a] == 0x21)
{
src_suid = (MAC[6+len_a] << 48ULL) | (MAC[7+len_a] << 40ULL) | (MAC[8+len_a] << 32ULL) | (MAC[9+len_a] << 24ULL) |
(MAC[10+len_a] << 16ULL) | (MAC[11+len_a] << 8ULL) | (MAC[12+len_a] << 0ULL);
source = src_suid & 0xFFFFFF;
target = (MAC[13+len_a] << 16) | (MAC[14+len_a] << 8) | MAC[15+len_a];
// channel = (MAC[4+len_a] << 8) | MAC[5+len_a]; //CH-R, above is CH-T value
}
fprintf (stderr, "\n Unit to Unit Channel Grant"); fprintf (stderr, "\n Unit to Unit Channel Grant");
if ( MAC[1+len_a] == 0x46) fprintf (stderr, " Update"); if ( MAC[1+len_a] == 0x46) fprintf (stderr, " Update");
fprintf (stderr, "\n CHAN [%04X] Source [%d] Target [%d]", channel, source, target); if ( MAC[1+len_a] == 0xC4) fprintf (stderr, " Extended");
fprintf (stderr, "\n CHAN: %04X; SRC: %d; TGT: %d; ", channel, source, target);
if (MAC[1+len_a] == 0xC4) fprintf (stderr, "SUID: %08llX-%08d; ", src_suid >> 24, source);
freq = process_channel_to_freq (opts, state, channel); freq = process_channel_to_freq (opts, state, channel);
//add active channel to string for ncurses display //add active channel to string for ncurses display
@@ -2242,15 +2257,15 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
if (MAC[1+len_a] == 0x21) if (MAC[1+len_a] == 0x21)
{ {
src_suid = (MAC[8+len_a] << 48) | (MAC[9+len_a] << 40) | (MAC[10+len_a] << 32) | (MAC[11+len_a] << 24) | src_suid = (MAC[8+len_a] << 48ULL) | (MAC[9+len_a] << 40ULL) | (MAC[10+len_a] << 32ULL) | (MAC[11+len_a] << 24ULL) |
(MAC[12+len_a] << 16) | (MAC[13+len_a] << 8) | (MAC[14+len_a] << 0); (MAC[12+len_a] << 16ULL) | (MAC[13+len_a] << 8ULL) | (MAC[14+len_a] << 0ULL);
src = src_suid & 0xFFFFFF; //last 24 of completed SUID? src = src_suid & 0xFFFFFF; //last 24 of completed SUID?
} }
fprintf (stderr, "\n VCH %d - TG: %d; SRC: %d; ", slot, gr, src); fprintf (stderr, "\n VCH %d - TG: %d; SRC: %d; ", slot, gr, src);
if (MAC[1+len_a] == 0x21) fprintf (stderr, "SUID: %lld; ", src_suid); if (MAC[1+len_a] == 0x21) fprintf (stderr, "SUID: %08llX-%08d; ", src_suid >> 24, src);
if (svc & 0x80) fprintf (stderr, " Emergency"); if (svc & 0x80) fprintf (stderr, " Emergency");
if (svc & 0x40) fprintf (stderr, " Encrypted"); if (svc & 0x40) fprintf (stderr, " Encrypted");
@@ -2286,14 +2301,25 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
} }
} }
//1 or 21, group voice channel message, abb and ext //1 or 21, unit to unit voice channel message, abb and ext
if (MAC[1+len_a] == 0x2 || MAC[1+len_a] == 0x22) if (MAC[1+len_a] == 0x2 || MAC[1+len_a] == 0x22)
{ {
int svc = MAC[2+len_a]; int svc = MAC[2+len_a];
int gr = (MAC[3+len_a] << 16) | (MAC[4+len_a] << 8) | MAC[5+len_a]; int gr = (MAC[3+len_a] << 16) | (MAC[4+len_a] << 8) | MAC[5+len_a];
int src = (MAC[6+len_a] << 16) | (MAC[7+len_a] << 8) | MAC[8+len_a]; int src = (MAC[6+len_a] << 16) | (MAC[7+len_a] << 8) | MAC[8+len_a];
unsigned long long int src_suid = 0;
fprintf (stderr, "\n VCH %d - TG %d SRC %d ", slot, gr, src); if (MAC[1+len_a] == 0x21)
{
src_suid = (MAC[9+len_a] << 48ULL) | (MAC[10+len_a] << 40ULL) | (MAC[11+len_a] << 32ULL) | (MAC[12+len_a] << 24ULL) |
(MAC[13+len_a] << 16ULL) | (MAC[14+len_a] << 8ULL) | (MAC[15+len_a] << 0ULL);
src = src_suid & 0xFFFFFF;
}
fprintf (stderr, "\n VCH %d - TGT: %d; SRC %d; ", slot, gr, src);
if (MAC[1+len_a] == 0x22) fprintf (stderr, "SUID: %08llX-%08d; ", src_suid >> 24, src);
if (svc & 0x80) fprintf (stderr, " Emergency"); if (svc & 0x80) fprintf (stderr, " Emergency");
if (svc & 0x40) fprintf (stderr, " Encrypted"); if (svc & 0x40) fprintf (stderr, " Encrypted");