Skip to content

Add possibility to define "one" log file name #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

----------

## Version 1.3 -- Beta Test -- February 2016 ##
## Version 1.3 -- May 2016 ##

This is the same as the 1.3 beta test version with a few minor documentation updates. If you are already using 1.3 beta test, there is no need to install this.

### New Features: ###

Expand Down Expand Up @@ -40,7 +42,7 @@ command line option.

- When receiving packet with comment of a few hundred characters.

- Address in path, from Internet server. more than 9 characters.
- Address in path, from Internet server, more than 9 characters.

- "INTERNAL ERROR: dlq_append NULL packet pointer." when using PASSALL.

Expand All @@ -51,6 +53,8 @@ command line option.
- AGW network protocol now works properly for big-endian processors
such as PowerPC or MIPS.

- Packet filtering treated telemetry metadata as messages rather than telemetry.

----------

## Version 1.2 -- June 2015 ##
Expand Down
20 changes: 0 additions & 20 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -558,26 +558,6 @@ dist-src : README.md CHANGES.md \

# Reminders if pdf files are not up to date.

doc/User-Guide.pdf : doc/User-Guide.docx
echo "***** User-Guide.pdf is out of date *****"

doc/Raspberry-Pi-APRS.pdf : doc/Raspberry-Pi-APRS.docx
echo "***** Raspberry-Pi-APRS.pdf is out of date *****"

doc/Raspberry-Pi-APRS-Tracker.pdf : doc/Raspberry-Pi-APRS-Tracker.docx
echo "***** Raspberry-Pi-APRS-Tracker.pdf is out of date *****"

doc/APRStt-Implementation-Notes.pdf : doc/APRStt-Implementation-Notes.docx
echo "***** APRStt-Implementation-Notes.pdf is out of date *****"

doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf : doc/A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.docx
echo "***** A-Better-APRS-Packet-Demodulator-Part-1-1200-baud.pdf is out of date *****"

doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf : doc/A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.docx
echo "***** A-Better-APRS-Packet-Demodulator-Part-2-9600-baud.pdf is out of date *****"

doc/APRS-Telemetry-Toolkit.pdf : doc/APRS-Telemetry-Toolkit.docx
echo "***** APRS-Telemetry-Toolkit.pdf is out of date *****"



Expand Down
23 changes: 23 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
strlcpy (p_misc_config->gpsnmea_port, "", sizeof(p_misc_config->gpsnmea_port));
strlcpy (p_misc_config->nmea_port, "", sizeof(p_misc_config->nmea_port));
strlcpy (p_misc_config->logdir, "", sizeof(p_misc_config->logdir));
strlcpy (p_misc_config->logfilename, "", sizeof(p_misc_config->logfilename));


/*
Expand Down Expand Up @@ -3863,6 +3864,28 @@ void config_init (char *fname, struct audio_s *p_audio_config,
}
}


/*
* LOGFILENAME - Log file name.
*/
else if (strcasecmp(t, "logfilename") == 0) {
t = split(NULL,0);
if (t == NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file: Missing name for LogFileName on line %d.\n", line);
continue;
}
else {
strlcpy (p_misc_config->logfilename, t, sizeof(p_misc_config->logfilename));
}
t = split(NULL,0);
if (t != NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file: LOGFILE on line %d should have logfile name and nothing more.\n", line);
}
}


/*
* BEACON channel delay every message
*
Expand Down
2 changes: 2 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ struct misc_config_s {

char logdir[80]; /* Directory for saving activity logs. */

char logfilename[80]; /* File name for saving activity logs. */

int sb_configured; /* TRUE if SmartBeaconing is configured. */
int sb_fast_speed; /* MPH */
int sb_fast_rate; /* seconds */
Expand Down
21 changes: 17 additions & 4 deletions direwolf.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ int main (int argc, char *argv[])
int r_opt = 0, n_opt = 0, b_opt = 0, B_opt = 0, D_opt = 0; /* Command line options. */
char P_opt[16];
char l_opt[80];
char f_opt[80];
char input_file[80];

int t_opt = 1; /* Text color option. */
Expand All @@ -194,6 +195,7 @@ int main (int argc, char *argv[])
#endif

strlcpy(l_opt, "", sizeof(l_opt));
strlcpy(f_opt, "", sizeof(f_opt));
strlcpy(P_opt, "", sizeof(P_opt));

#if __WIN32__
Expand Down Expand Up @@ -236,9 +238,9 @@ int main (int argc, char *argv[])

text_color_init(t_opt);
text_color_set(DW_COLOR_INFO);
dw_printf ("Dire Wolf version %d.%d (%s) Beta Test\n", MAJOR_VERSION, MINOR_VERSION, __DATE__);
//dw_printf ("Dire Wolf version %d.%d (%s) Beta Test\n", MAJOR_VERSION, MINOR_VERSION, __DATE__);
//dw_printf ("Dire Wolf DEVELOPMENT version %d.%d %s (%s)\n", MAJOR_VERSION, MINOR_VERSION, "K", __DATE__);
//dw_printf ("Dire Wolf version %d.%d\n", MAJOR_VERSION, MINOR_VERSION);
dw_printf ("Dire Wolf version %d.%d\n", MAJOR_VERSION, MINOR_VERSION);

#if defined(ENABLE_GPSD) || defined(USE_HAMLIB)
dw_printf ("Includes optional support for: ");
Expand Down Expand Up @@ -322,7 +324,7 @@ int main (int argc, char *argv[])

/* ':' following option character means arg is required. */

c = getopt_long(argc, argv, "P:B:D:c:pxr:b:n:d:q:t:Ul:Sa:",
c = getopt_long(argc, argv, "P:B:D:c:pxr:b:n:d:q:t:Ul:Sa:Uf:",
long_options, &option_index);
if (c == -1)
break;
Expand Down Expand Up @@ -501,6 +503,11 @@ int main (int argc, char *argv[])
strlcpy (l_opt, optarg, sizeof(l_opt));
break;

case 'f': /* -f for log file name */

strlcpy (f_opt, optarg, sizeof(f_opt));
break;

case 'S': /* Print symbol tables and exit. */

symbols_init ();
Expand Down Expand Up @@ -594,6 +601,11 @@ int main (int argc, char *argv[])
strlcpy (misc_config.logdir, l_opt, sizeof(misc_config.logdir));
}

if (strlen(f_opt) > 0) {
strlcpy (misc_config.logfilename, f_opt, sizeof(misc_config.logfilename));
}


misc_config.enable_kiss_pt = enable_pseudo_terminal;

if (strlen(input_file) > 0) {
Expand Down Expand Up @@ -711,7 +723,7 @@ int main (int argc, char *argv[])
* log the tracker beacon transmissions with fake channel 999.
*/

log_init(misc_config.logdir);
log_init(misc_config.logdir, misc_config.logfilename);
beacon_init (&audio_config, &misc_config);


Expand Down Expand Up @@ -1062,6 +1074,7 @@ static void usage (char **argv)
dw_printf ("Options:\n");
dw_printf (" -c fname Configuration file name.\n");
dw_printf (" -l logdir Directory name for log files. Use . for current.\n");
dw_printf (" -f logname Name for log file. \n");
dw_printf (" -r n Audio sample rate, per sec.\n");
dw_printf (" -n n Number of audio channels, 1 or 2.\n");
dw_printf (" -b n Bits per audio sample, 8 or 16.\n");
Expand Down
Binary file modified doc/APRStt-Implementation-Notes.pdf
Binary file not shown.
Binary file modified doc/Raspberry-Pi-APRS-Tracker.pdf
Binary file not shown.
Binary file modified doc/User-Guide.pdf
Binary file not shown.
13 changes: 12 additions & 1 deletion log.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ static void quote_for_csv (char *out, size_t outsize, const char *in) {
static char g_log_dir[80];
static FILE *g_log_fp;
static char g_open_fname[20];
static char g_logfilename[80];


void log_init (char *path)
void log_init (char *path, char *logfilename)
{
struct stat st;

Expand All @@ -118,6 +119,11 @@ void log_init (char *path)
return;
}

if (strlen(logfilename) != 0) {
strlcpy (g_logfilename, logfilename, sizeof(g_logfilename));
}


if (stat(path,&st) == 0) {
// Exists, but is it a directory?
if (S_ISDIR(st.st_mode)) {
Expand Down Expand Up @@ -191,7 +197,12 @@ void log_write (int chan, decode_aprs_t *A, packet_t pp, alevel_t alevel, retry_

// Microsoft doesn't recognize %F as equivalent to %Y-%m-%d

if (strlen(g_logfilename) != 0) {
strftime (fname, sizeof(fname), g_logfilename, &tm);
}
else {
strftime (fname, sizeof(fname), "%Y-%m-%d.log", &tm);
}

// Close current file if name has changed

Expand Down
4 changes: 2 additions & 2 deletions log.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@



void log_init (char *path);
void log_init (char *path, char *logfilename);

void log_write (int chan, decode_aprs_t *A, packet_t pp, alevel_t alevel, retry_t retries);

void log_term (void);
void log_term (void);
26 changes: 24 additions & 2 deletions pfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,21 @@ static int filt_bodgu (pfstate_t *pf, char *arg)
*
*------------------------------------------------------------------------------*/

/* Telemetry metadata is a special case of message. */
/* We want to categorize it as telemetry rather than message. */

static int is_telem_metadata (char *infop)
{
if (*infop != ':') return (0);
if (strlen(infop) < 16) return (0);
if (strncmp(infop+10, ":PARM.", 6) == 0) return (1);
if (strncmp(infop+10, ":UNIT.", 6) == 0) return (1);
if (strncmp(infop+10, ":EQNS.", 6) == 0) return (1);
if (strncmp(infop+10, ":BITS.", 6) == 0) return (1);
return (0);
}


static int filt_t (pfstate_t *pf)
{
char src[AX25_MAX_ADDR_LEN];
Expand Down Expand Up @@ -652,7 +667,7 @@ static int filt_t (pfstate_t *pf)
break;

case 'm': /* Message */
if (*infop == ':') return (1);
if (*infop == ':' && ! is_telem_metadata(infop)) return (1);
break;

case 'q': /* Query */
Expand All @@ -665,6 +680,7 @@ static int filt_t (pfstate_t *pf)

case 't': /* Telemetry */
if (*infop == 'T') return (1);
if (is_telem_metadata(infop)) return (1);
break;

case 'u': /* User-defined */
Expand Down Expand Up @@ -1033,13 +1049,19 @@ int main ()
pftest (112, "t/t", "WM1X>APU25N:@210147z4235.39N/07106.58W_359/000g000t027r000P000p000h89b10234/WX REPORT {UIV32N}<0x0d>", 0);
pftest (113, "t/w", "WM1X>APU25N:@210147z4235.39N/07106.58W_359/000g000t027r000P000p000h89b10234/WX REPORT {UIV32N}<0x0d>", 1);

/* Telemetry metadata is a special case of message. */
pftest (114, "t/t", "KJ4SNT>APMI04::KJ4SNT :PARM.Vin,Rx1h,Dg1h,Eff1h,Rx10m,O1,O2,O3,O4,I1,I2,I3,I4", 1);
pftest (115, "t/m", "KJ4SNT>APMI04::KJ4SNT :PARM.Vin,Rx1h,Dg1h,Eff1h,Rx10m,O1,O2,O3,O4,I1,I2,I3,I4", 0);
pftest (116, "t/t", "KB1GKN-10>APRX27,UNCAN,WIDE1*:T#491,4.9,0.3,25.0,0.0,1.0,00000000", 1);


pftest (120, "t/p", "CWAPID>APRS::NWS-TTTTT:DDHHMMz,ADVISETYPE,zcs{seq#", 0);
pftest (122, "t/p", "CWAPID>APRS::SKYCWA :DDHHMMz,ADVISETYPE,zcs{seq#", 0);
pftest (123, "t/p", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0);
pftest (124, "t/n", "CWAPID>APRS::NWS-TTTTT:DDHHMMz,ADVISETYPE,zcs{seq#", 1);
pftest (125, "t/n", "CWAPID>APRS::SKYCWA :DDHHMMz,ADVISETYPE,zcs{seq#", 1);
pftest (126, "t/n", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 1);
pftest (127, "t/", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0);
pftest (127, "t/", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", 0);

pftest (130, "r/42.6/-71.3/10", "WB2OSZ-5>APDW12,WIDE1-1,WIDE2-1:!4237.14NS07120.83W#PHG7140Chelmsford MA", 1);
pftest (131, "r/42.6/-71.3/10", "WA1PLE-5>APWW10,W1MHL,N8VIM,WIDE2*:@022301h4208.75N/07115.16WoAPRS-IS for Win32", 0);
Expand Down
6 changes: 2 additions & 4 deletions tq.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,14 @@ void tq_append (int chan, int prio, packet_t pp)
{
packet_t plast;
packet_t pnext;
//int a = ACHAN2ADEV(chan); /* Audio device for channel. */


#if DEBUG
text_color_set(DW_COLOR_DEBUG);
dw_printf ("tq_append (chan=%d, prio=%d, pp=%p)\n", chan, prio, pp);
#endif



assert (chan >= 0 && chan < MAX_CHANS);
assert (prio >= 0 && prio < TQ_NUM_PRIO);

if (pp == NULL) {
Expand All @@ -240,7 +238,7 @@ void tq_append (int chan, int prio, packet_t pp)
}
#endif

if ( ! save_audio_config_p->achan[chan].valid) {
if (chan < 0 || chan >= MAX_CHANS || ! save_audio_config_p->achan[chan].valid) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("ERROR - Request to transmit on invalid radio channel %d.\n", chan);
ax25_delete(pp);
Expand Down