Skip to content

Commit 98b8949

Browse files
committed
Slight fixes before switching to uint64_t and MSB processing.
1 parent 742dfb4 commit 98b8949

File tree

5 files changed

+11
-30
lines changed

5 files changed

+11
-30
lines changed

Diff for: src/eotd.c

+7-19
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,8 @@
2323
* File: eotd.c
2424
*
2525
* Purpose: Functions for processing received EOTD transmissions and
26-
* converting to NMEA sentence representation.
26+
* converting to text format.
2727
*
28-
* References: AIVDM/AIVDO protocol decoding by Eric S. Raymond
29-
* https://gpsd.gitlab.io/gpsd/AIVDM.html
30-
*
31-
* Sample recording with about 100 messages. Test with "atest -B AIS xxx.wav"
32-
* https://github.com/freerange/ais-on-sdr/wiki/example-data/long-beach-160-messages.wav
33-
*
34-
* Useful on-line decoder for AIS NMEA sentences.
35-
* https://www.aggsoft.com/ais-decoder.htm
36-
*
37-
* Future? Add an interface to feed AIS data into aprs.fi.
38-
* https://aprs.fi/page/ais_feeding
39-
*
4028
*******************************************************************************/
4129

4230
#include "direwolf.h"
@@ -53,21 +41,21 @@
5341

5442
/*-------------------------------------------------------------------
5543
*
56-
* Convert EOTD binary block (from HDLC frame) to NMEA sentence.
44+
* Convert EOTD binary block (from HDLC frame) to text.
5745
*
5846
* In: Pointer to EOTD binary block and number of bytes.
59-
* Out: NMEA sentence. Provide size to avoid string overflow.
47+
* Out: text.
6048
*
6149
*--------------------------------------------------------------------*/
6250

63-
void eotd_to_nmea (unsigned char *eotd, int eotd_len, char *nmea, int nmea_size)
51+
void eotd_to_text (unsigned char *eotd, int eotd_len, char *text, int text_size)
6452
{
6553
time_t now = time(NULL);
66-
*nmea = '\0';
67-
strcat(nmea, ctime(&now));
54+
*text = '\0';
55+
strcat(text, ctime(&now));
6856
for (int i = 0; i < eotd_len; i++) {
6957
char temp[32];
7058
snprintf(temp, sizeof(temp), " %02x", eotd[i]);
71-
strlcat(nmea, temp, nmea_size);
59+
strlcat(text, temp, text_size);
7260
}
7361
}

Diff for: src/eotd.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
void eotd_to_nmea (unsigned char *ais, int ais_len, char *nema, int nema_size);
1+
void eotd_to_text (unsigned char *ais, int ais_len, char *text, int text_size);

Diff for: src/hdlc_rec.c

-8
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ a good modem here and providing a result when it is received.
432432
#define EOTD_PREAMBLE_AND_BARKER_CODE 0x55555712
433433
#define HOTD_PREAMBLE_AND_BARKER_CODE 0x558f1129
434434
#define EOTD_MAX_LEN 8
435-
#undef DUMMY_BIT_HACK
436435

437436
static void eotd_rec_bit (int chan, int subchan, int slice, int raw, int future_use)
438437
{
@@ -468,13 +467,6 @@ dw_printf("chan=%d subchan=%d slice=%d raw=%d\n", chan, subchan, slice, raw);
468467
else if (H->eotd_gathering) {
469468
H->olen++;
470469

471-
#ifdef DUMMY_BIT_HACK
472-
/* Hack to skip 'dummy' 64th bit */
473-
if (H->olen == 7 && H->frame_len == 7) {
474-
H->eotd_acc <<= 1;
475-
H->olen++;
476-
}
477-
#endif
478470
if (H->olen == 8) {
479471
H->olen = 0;
480472
char ch = H->eotd_acc & 0xff;

Diff for: src/multi_modem.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,9 @@ void multi_modem_process_rec_frame (int chan, int subchan, int slice, unsigned c
345345
}
346346
else if (save_audio_config_p->achan[chan].modem_type == MODEM_EOTD) {
347347
char nmea[300];
348-
eotd_to_nmea (fbuf, flen, nmea, sizeof(nmea));
348+
eotd_to_text (fbuf, flen, nmea, sizeof(nmea));
349349
char monfmt[276];
350-
snprintf (monfmt, sizeof(monfmt), "EOTD>%s%1d%1d:{%c%c%s", APP_TOCALL, MAJOR_VERSION, MINOR_VERSION, USER_DEF_USER_ID, USER_DEF_TYPE_AIS, nmea);
350+
snprintf (monfmt, sizeof(monfmt), "EOTD>%s%1d%1d:{%c%c%s", APP_TOCALL, MAJOR_VERSION, MINOR_VERSION, USER_DEF_USER_ID, USER_DEF_TYPE_EOTD, nmea);
351351
pp = ax25_from_text (monfmt, 1);
352352
}
353353
else {

Diff for: src/version.h

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919

2020
#define USER_DEF_TYPE_AIS 'A' // data type A for AIS NMEA sentence
2121
#define USER_DEF_TYPE_EAS 'E' // data type E for EAS broadcasts
22+
#define USER_DEF_TYPE_EOTD 'T' // data type T for 'T'rain broadcasts

0 commit comments

Comments
 (0)