P25 -- Harris TA to groupName/group.csv; Tweaks;

This commit is contained in:
lwvmobile
2023-10-14 08:59:20 -04:00
parent a4ddcd4220
commit f65e65fb47

View File

@@ -1403,6 +1403,21 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
int res = MAC[3+len_a] >> 6;
int k = 0;
//storage info for storing to groupName, if not available
char str[20]; char ttemp[20];
int wr = 0, tsrc = 0, ttg = 0;
if (slot == 0 && state->lastsrc != 0) tsrc = state->lastsrc;
if (slot == 1 && state->lastsrcR != 0) tsrc = state->lastsrcR;
if (slot == 0 && state->lasttg != 0) ttg = state->lasttg;
if (slot == 1 && state->lasttgR != 0) ttg = state->lasttgR;
//init str and ttemp as NULL zeroes
for (i = 0; i < 20; i++)
{
str[i] = 0;
ttemp[i] = 0;
}
//NOTE: slot is already checked
//sanity check that we don't exceed the max MAC array size
@@ -1412,8 +1427,8 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
//Harris "Talker" Alias -- Not always in the SACCH, has been seen in the FACCH as well (before MAC_PTT)
if (MAC[1+len_a] == 0xA8) //1010 1000 (so, its opcode is 0x28, with the b = 0b10 value for manufacturer message?)
{
fprintf (stderr, "\n MFID A4 (Harris); VCH %d Talker Alias: ", slot);
for (i = 4; i < len; i++) //this should be okay
fprintf (stderr, "\n MFID A4 (Harris); VCH %d; SRC: %d; Talker Alias: ", slot, tsrc);
for (i = 4; i <= len; i++) //len doesn't seem to include the CRC12/CRC16
{
if ( (MAC[i+len_a] > 0x19) && (MAC[i+len_a] < 0x7F) )
fprintf (stderr, "%c", (char)MAC[i+len_a]);
@@ -1422,8 +1437,55 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
if ( (MAC[i+len_a] > 0x19) && (MAC[i+len_a] < 0x7F) )
state->dmr_alias_block_segment[slot][0][k/4][k%4] = MAC[i+len_a];
else state->dmr_alias_block_segment[slot][0][k/4][k%4] = 0x20;
if ( (MAC[i+len_a] > 0x19) && (MAC[i+len_a] < 0x7F) )
ttemp[k] = MAC[i+len_a];
k++;
}
//assign completed talker to a more useful string instead
snprintf (str, k+1, "%s", ttemp); //k+1, because we start at index k = 0;
//see if we can fill in the groupName if we have a good src value that isn't 0
//usually, we have TG values in the groupName field, but this is just for dumping
//information for research, etc
if (tsrc != 0)
{
for (int x = 0; x < state->group_tally; x++)
{
if (state->group_array[x].groupNumber == tsrc)
{
wr = 1; //already in there, so no need to assign it
break;
}
}
if (wr == 0) //not already in there, so save it there now
{
state->group_array[state->group_tally].groupNumber = tsrc;
sprintf (state->group_array[state->group_tally].groupMode, "%s", "D");
sprintf (state->group_array[state->group_tally].groupName, "%s", str);
state->group_tally++;
//if we have an opened group file, let's write what info we found into it
if (opts->group_in_file[0] != 0) //file is available
{
FILE * pFile; //file pointer
//open file by name that is supplied in the ncurses terminal, or cli
pFile = fopen (opts->group_in_file, "a");
// fprintf (pFile, "%d,D,%s,TG:%d,SYS:%03llX,RFSS:%lld,SITE:%lld\n", tsrc, str, ttg, state->p2_sysid, state->p2_rfssid, state->p2_siteid); //Cygwin Hates this for some reason
fprintf (pFile, "%d,D,", tsrc);
fprintf (pFile, "%s", str); //for whatever reason, Cygwin likes the string seperate (overflow on pFile?)
fprintf (pFile, ",TG:%d,SYS:%03llX,RFSS:%lld,SITE:%lld\n", ttg, state->p2_sysid, state->p2_rfssid, state->p2_siteid);
fclose (pFile);
}
}
}
//debug
fprintf (stderr, "\n WR: %d SRC: %d Res: %d Len: %d STR: %s", wr, tsrc, res, len, str);
}
else