mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-14 09:47:30 -05:00
M17 - User CAN/DST/SRC and SMS at CLI;
This commit is contained in:
56
src/m17.c
56
src/m17.c
@@ -301,7 +301,7 @@ int M17processLICH(dsd_state * state, dsd_opts * opts, uint8_t * lich_bits)
|
||||
}
|
||||
}
|
||||
|
||||
memset (state->m17_lsf, 1, sizeof(state->m17_lsf));
|
||||
memset (state->m17_lsf, 0, sizeof(state->m17_lsf));
|
||||
|
||||
//debug
|
||||
// fprintf (stderr, " E-%04X; C-%04X (CRC CHK)", crc_ext, crc_cmp);
|
||||
@@ -1109,7 +1109,7 @@ void encodeM17RF (dsd_opts * opts, dsd_state * state, uint8_t * input, int type)
|
||||
//BRT frame sync pattern - 0xDF55 (-3, +3, -3, -3, +3, +3, +3, +3)
|
||||
uint8_t m17_brt_fs[16] = {1,1,0,1, 1,1,1,1, 0,1,0,1, 0,1,0,1};
|
||||
|
||||
//load bits inti a dibit array plus the framesync bits
|
||||
//load bits into a dibit array plus the framesync bits
|
||||
uint8_t output_dibits[192]; memset (output_dibits, 0, sizeof(output_dibits));
|
||||
|
||||
//Preamble (just repeat the preamble 12 times to make 192 symbols)
|
||||
@@ -1256,7 +1256,7 @@ void encodeM17RF (dsd_opts * opts, dsd_state * state, uint8_t * input, int type)
|
||||
sf_write_sync (opts->wav_out_raw);
|
||||
}
|
||||
|
||||
//NOTE: May need to disable the debug decoding when playing out real audio? Could lag/stutter.
|
||||
//NOTE: Internal voice decoding is disabled when tx audio over a hardware device, wav/bin still enabled
|
||||
UNUSED(state);
|
||||
|
||||
}
|
||||
@@ -1285,10 +1285,21 @@ void encodeM17STR(dsd_opts * opts, dsd_state * state)
|
||||
unsigned long long int dst = 0;
|
||||
unsigned long long int src = 0;
|
||||
//DST and SRC Callsign Data (pick up to 9 characters from the b40 char array)
|
||||
char d40[] = "DSD-FME "; //DST
|
||||
char s40[] = "DSD-FME "; //SRC
|
||||
char d40[11] = "DSD-FME "; //DST
|
||||
char s40[11] = "DSD-FME "; //SRC
|
||||
//end User Defined Variables
|
||||
|
||||
//configure User Defined Variables, if defined at CLI
|
||||
if (state->m17_can_en != 0) //is 0 a valid number?
|
||||
can = state->m17_can_en;
|
||||
|
||||
if (state->str50a[0] != 0)
|
||||
sprintf (s40, "%s", state->str50a);
|
||||
|
||||
if (state->str50b[0] != 0)
|
||||
sprintf (d40, "%s", state->str50b);
|
||||
//end
|
||||
|
||||
int i, j, k, x; //basic utility counters
|
||||
short sample = 0; //individual audio sample from source
|
||||
size_t nsam = 160; //number of samples to be read in (default is for codec2 3200 bps)
|
||||
@@ -1856,7 +1867,7 @@ void encodeM17STR(dsd_opts * opts, dsd_state * state)
|
||||
//Contruct an IP frame using previously created arrays
|
||||
uint8_t m17_ip_frame[432]; memset (m17_ip_frame, 0, sizeof(m17_ip_frame));
|
||||
uint8_t m17_ip_packed[54]; memset (m17_ip_packed, 0, sizeof(m17_ip_packed));
|
||||
uint16_t ip_crc = 0; UNUSED(ip_crc);
|
||||
uint16_t ip_crc = 0;
|
||||
|
||||
//NOTE: The Manual doesn't say much about this area, so assuming
|
||||
//the elements are arranged as per the table
|
||||
@@ -2234,8 +2245,8 @@ void encodeM17PKT(dsd_opts * opts, dsd_state * state)
|
||||
unsigned long long int dst = 0;
|
||||
unsigned long long int src = 0;
|
||||
//DST and SRC Callsign Data (pick up to 9 characters from the b40 char array)
|
||||
char d40[] = "DSD-FME "; //DST
|
||||
char s40[] = "DSD-FME "; //SRC
|
||||
char d40[11] = "DSD-FME "; //DST
|
||||
char s40[11] = "DSD-FME "; //SRC
|
||||
|
||||
// dst = 0xEE6B28000000; //viterbi debug values
|
||||
// src = 0xEE6B28000000; //viterbi debug values
|
||||
@@ -2261,6 +2272,30 @@ void encodeM17PKT(dsd_opts * opts, dsd_state * state)
|
||||
|
||||
//end User Defined Variables
|
||||
|
||||
//configure User Defined Variables, if defined at CLI
|
||||
if (state->m17_can_en != 0) //is 0 a valid number?
|
||||
can = state->m17_can_en;
|
||||
|
||||
if (state->str50a[0] != 0)
|
||||
sprintf (s40, "%s", state->str50a);
|
||||
|
||||
if (state->str50b[0] != 0)
|
||||
sprintf (d40, "%s", state->str50b);
|
||||
|
||||
if (state->m17sms[0] != 0)
|
||||
sprintf (text, "%s", state->m17sms);
|
||||
|
||||
// switch to this if issues crop up (cygwin, etc)
|
||||
// strncpy (s40, state->str50a, 9);
|
||||
// strncpy (d40, state->str50b, 9);
|
||||
// s40[10] = '\0';
|
||||
// d40[10] = '\0';
|
||||
|
||||
//debug
|
||||
// fprintf (stderr, " SRC: %s; DST: %s; SRC_D: %llX; DST_D: %llX; SLEN %d; DLEN: %d;", s40, d40, src, dst, strlen(s40), strlen(d40) );
|
||||
|
||||
//end CLI Configuration
|
||||
|
||||
//send dead air with type 99
|
||||
for (i = 0; i < 25; i++)
|
||||
encodeM17RF (opts, state, nil, 99);
|
||||
@@ -2323,6 +2358,9 @@ void encodeM17PKT(dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
//end CSD conversion
|
||||
|
||||
//debug
|
||||
// fprintf (stderr, "\n SRC: %s; DST: %s; SRC_D: %llX; DST_D: %llX", s40, d40, src, dst);
|
||||
|
||||
//load dst and src values into the LSF
|
||||
for (i = 0; i < 48; i++) m17_lsf[i] = (dst >> 47ULL-(unsigned long long int)i) & 1;
|
||||
for (i = 0; i < 48; i++) m17_lsf[i+48] = (src >> 47ULL-(unsigned long long int)i) & 1;
|
||||
@@ -2788,7 +2826,7 @@ void processM17PKT(dsd_opts * opts, dsd_state * state)
|
||||
}
|
||||
|
||||
//reset after processing
|
||||
memset (state->m17_pkt, 1, sizeof(state->m17_pkt));
|
||||
memset (state->m17_pkt, 0, sizeof(state->m17_pkt));
|
||||
state->m17_pbc_ct = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user