Skip to content

Commit 1b31467

Browse files
Add support for APRS 1.2.1 device type identifier
This commit adds support for the `Z` field, a two-character device type identifier, as defined in the APRS 1.2.1 `weather-new.txt` addendum by Bob Bruninga, WB4APR (SK) on March 24, 2011. Device types are exactly two characters long. What they mean is implementation-specific and not defined in the APRS specification or its addenda, the best I could tell. Basically, if you don't know what this is, don't use it. If you do know what it is, go nuts.
1 parent 5d59741 commit 1b31467

10 files changed

+46
-26
lines changed

AUTHORS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Colin Cogle, KC1HBK <[email protected]>
1+
Colin Cogle, W1DNS <[email protected]>

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Change Log for `aprs-weather-submit`
22

33
## Next version
4+
Not yet released.
5+
- Added the `Z` device type field, as noted in [**APRS version 1.2.1 WEATHER UPDATES TO THE SPEC**](https://www.aprs.org/aprs12/weather-new.txt).
46

57
## Version 1.8.2
68
<time datetime="2024-11-13">November 13, 2024</time>

NEWS.md

+3-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
# aprs-weather-submit news
22

3-
This file details all of the user-facing changes that are in versions 1.8 of aprs-weather-submit. For more details, please consult the CHANGELOG file or this project's GitHub page.
3+
This file details all of the user-facing changes that are in versions 1.9 of aprs-weather-submit. For more details, please consult the CHANGELOG file or this project's GitHub page.
44

5-
## Graceful failure
6-
7-
In version 1.7.2 and older, the app would hang almost indefinitely if the remote APRS-IS server did not respond. This version fixes that by converting to non-blocking sockets, so that if your APRS-IS server does not respond in a timely manner (for whatever reason), the connection will fail gracefully.
8-
9-
Likewise, there is a new parameter, `--timeout`, that will let you specify a timeout value, if you don't like my default of fifteen seconds.
10-
11-
If you want the old behavior, specify `--timeout 0`.
12-
13-
Thanks to [DL9SEC](https://www.dl9sec.de) for pointing out this behavior, and I suppose thanks are due to the APRS Tier 2 network for having some servers down long enough for this bug to get pointed out.
14-
15-
16-
## Building without APRS-IS support
17-
18-
I'd always given users the option to build a custom version without APRS-IS support by specifying `./configure --disable-aprs-is`. However, that broke at some point. This option now works as intended.
5+
## Device type identifier.
6+
The `Z` device type identifier is now supported by using the `-Z`/`--device-type` parameter. The device type is any two characters.
197

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dnl
1717
dnl You should have received a copy of the GNU Affero General Public License
1818
dnl along with this program. If not, see <http://gnu.org/licenses/agpl-3.0.html>.
1919

20-
AC_INIT([aprs-weather-submit], [1.8.2-testingtocall], [https://github.com/rhymeswithmogul/aprs-weather-submit/])
20+
AC_INIT([aprs-weather-submit], [1.9-dev], [https://github.com/rhymeswithmogul/aprs-weather-submit/])
2121
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
2222
AC_PREREQ
2323
AC_PROG_INSTALL

man/aprs-weather-submit.man

+10-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
.\"
1919
.\" (This page is best viewed with the command: groff -man)
2020
.\"
21-
.TH aprs\-weather\-submit 1 "2024-10-31" "Version 1.8" "aprs-weather-submit General Help"
21+
.TH aprs\-weather\-submit 1 "2025-02-14" "Version 1.9-dev" "aprs-weather-submit General Help"
2222
.SH NAME
2323
aprs\-weather\-submit \- manually submit weather station data to the APRS-IS network
2424
.SH DESCRIPTION
@@ -70,6 +70,8 @@ This command-line app will manually submit APRS 1.2.1-compliant weather informat
7070
.IR VOLTS " ]\:"
7171
.RB [ " \-X "
7272
.IR NANOSIEVERTS " ]\:"
73+
.RB [ " \-Z "
74+
.IR DEVICE_TYPE " ]\:"
7375
.RB [ " \-Q "
7476
.RB | " \-M "
7577
.IR COMMENT " ]\:"
@@ -229,6 +231,11 @@ You may report voltages of up to 99.9 volts, with a resolution of one-tenth of a
229231
The current level of nuclear radiation.
230232
You may report readings of up to 99,000,000,000 nanosieverts per hour, though the resolution of the value put into your report varies based on orders of magnitude.
231233
Consult the APRS 1.2 specification for full details.
234+
.TP
235+
.BR \-Z ", " \-\-device\-type =\fIDEVICE-TYPE\fP
236+
(APRS 1.2.1)
237+
Exactly two characters to identify the type of device sending this information.
238+
The device types are not defined in the APRS specification and are implementation-specific.
232239
.SH EXAMPLES
233240
.PP
234241
If you were operating the ARRL's (theoretical) weather station at their headquarters and wanted to submit a temperature of 68 degrees Fahrenheit, no rainfall, and a westerly wind at about five miles per hour, use this command:
@@ -310,7 +317,7 @@ APRS Version 1.2.1, "Weather Updates to the Spec" (24 Mar 2011)
310317
.UE
311318

312319
.SH AUTHOR AND COPYRIGHT
313-
.BR aprs\-weather\-submit ", version 1.8"
320+
.BR aprs\-weather\-submit ", version 1.9-dev"
314321
.br
315322
Copyright (c) 2019-2025 Colin Cogle.
316323
.br
@@ -327,4 +334,4 @@ Bug reports and contributions should be made on
327334
this project's GitHub page.
328335
.UE
329336
.PP
330-
QRT. 73 de KC1HBK
337+
QRT. 73 de W1DNS

src/aprs-wx.c

+7
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ packetConstructor (APRSPacket* const p)
6565
strcpy(p->snowfallLast24Hours, "...");
6666
strcpy(p->comment, "");
6767
strcpy(p->icon, "/_"); /* the default icon, (WX) */
68+
strcpy(p->deviceType, "");
6869
return;
6970
}
7071

@@ -356,6 +357,12 @@ printAPRSPacket (APRSPacket* restrict const p, char* restrict const ret,
356357
strcat(result, p->voltage);
357358
}
358359

360+
if (notNull(p->deviceType))
361+
{
362+
strcat(result, "Z");
363+
strcat(result, p->deviceType);
364+
}
365+
359366
if (notNull(p->snowfallLast24Hours))
360367
{
361368
/* Add snowfall last, as some sites (aprs.fi) accidentally parse a

src/aprs-wx.h

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef struct APRSPacket
4646
char radiation[4];
4747
char waterLevel[5];
4848
char voltage[4];
49+
char deviceType[3];
4950
char comment[MAX_COMMENT_LENGTH + 1];
5051
char icon[3];
5152
} APRSPacket;

src/help.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ Required parameters:\n\
120120
-t, --temperature Temperature (degrees Fahrenheit).\n\
121121
-T, --temperature-celsius Temperature (degrees Celsius).\n\
122122
-V, --voltage Battery voltage of your weather station.\n\
123-
-X, --radiation Radiation levels (nanosieverts per hour).\n\n\
123+
-X, --radiation Radiation levels (nanosieverts per hour).\n\
124+
-Z, --device-type A two-character device type code.\n\n\
124125
Find this project online at https://github.com/rhymeswithmogul/aprs-weather-submit\n");
125126
#else /* DOS build -- son't forget to wrap lines at 80 characters */
126127
puts("\n\
@@ -153,7 +154,8 @@ Optional parameters (each requires an argument):\n\
153154
/t\tTemperature (degrees Fahrenheit).\n\
154155
/T\tTemperature (degrees Celsius).\n\
155156
/V\tBattery voltage of your weather station.\n\
156-
/X\tRadiation levels (nanosieverts per hour).\n\n\
157+
/X\tRadiation levels (nanosieverts per hour).\n\
158+
/Z\tTwo-character device type identifier.\n\n\
157159
Find this online at https://github.com/rhymeswithmogul/aprs-weather-submit\n");
158160
#endif
159161
return;

src/main.c

+16-3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ main (const int argc, const char** argv)
104104
{"radiation", required_argument, 0, 'X'},
105105
{"water-level-above-stage", required_argument, 0, 'F'}, /* APRS 1.2 */
106106
{"voltage", required_argument, 0, 'V'}, /* APRS 1.2 */
107+
{"device-type", required_argument, 0, 'Z'}, /* APRS 1.2.1 addendum */
107108
{"icon", required_argument, 0, 'i'},
108109
{0, 0, 0, 0}
109110
};
@@ -132,11 +133,11 @@ main (const int argc, const char** argv)
132133
}
133134

134135
#ifdef _DOS
135-
while ((c = (char) getopt(argc, (char**)argv, "CH?vI:o:u:d:k:n:e:A:c:S:g:t:T:r:P:p:s:h:b:L:X:F:V:QM:i:")) != -1)
136+
while ((c = (char) getopt(argc, (char**)argv, "CH?vI:o:u:d:k:n:e:A:c:S:g:t:T:r:P:p:s:h:b:L:X:F:V:QM:i:Z:")) != -1)
136137
#elif HAVE_APRSIS_SUPPORT
137-
while ((c = (char) getopt_long(argc, (char* const*)argv, "CHvI:o:m:u:d:k:n:e:A:c:S:g:t:T:r:P:p:s:h:b:L:X:F:V:QM:i:", long_options, &option_index)) != -1)
138+
while ((c = (char) getopt_long(argc, (char* const*)argv, "CHvI:o:m:u:d:k:n:e:A:c:S:g:t:T:r:P:p:s:h:b:L:X:F:V:QM:i:Z:", long_options, &option_index)) != -1)
138139
#else
139-
while ((c = (char) getopt_long(argc, (char* const*)argv, "CHvk:n:e:A:c:S:g:t:T:r:P:p:s:h:b:L:X:F:V:QM:i:", long_options, &option_index)) != -1)
140+
while ((c = (char) getopt_long(argc, (char* const*)argv, "CHvk:n:e:A:c:S:g:t:T:r:P:p:s:h:b:L:X:F:V:QM:i:Z:", long_options, &option_index)) != -1)
140141
#endif
141142
{
142143
double x = 0.0; /* scratch space */
@@ -577,6 +578,18 @@ main (const int argc, const char** argv)
577578
}
578579
break;
579580

581+
/* (APRS 1.2.1 addendum) Device type identifier (-Z | --device-type) */
582+
case 'Z':
583+
if (strlen(optarg) != 2)
584+
{
585+
fprintf(stderr, "%s: option '-%c' must be exactly two characters.\n", argv[0], optopt);
586+
return EXIT_FAILURE;
587+
}
588+
snprintf_verify(
589+
snprintf(packet.deviceType, strlen(optarg)+1, "%s", optarg)
590+
);
591+
break;
592+
580593
/* -Q | --no-comment: Suppress our user agent, if desired. */
581594
case 'Q':
582595
suppressUserAgent = 1;

src/main.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
2828
#endif
2929

3030
#ifndef VERSION
31-
#define VERSION "1.8.2_testing-tocall"
31+
#define VERSION "1.9-dev"
3232
#endif
3333

3434
/* We don't support networking on DOS at this time.

0 commit comments

Comments
 (0)