Skip to content

Commit

Permalink
Finish APRS custom icon support.
Browse files Browse the repository at this point in the history
Finally finished adding custom icon support (with the -i or --icon)
flag.  Note that APRS.fi doesn't seem to handle weather packets that
have a custom icon;  it doesn't parse the weather data.  That is a
limitation of their site, though.
  • Loading branch information
rhymeswithmogul committed Nov 30, 2023
1 parent 341add6 commit d9a3c8f
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 64 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## Version 1.7
Not yet released.
<time datetime="2023-11-29T23:02:00-05:00">November 29, 2023</time>
* The icon can now be changed from the default (WX) icon using the new `--icon` option.
* Output of `snprintf()` is now better checked to make sure we haven't overflowed our buffer.
* Fixed a compile-time error on armhf platforms.

## Version 1.6
<time datetime="2022-10-26T22:53:17-04:00">October 26, 2022</time>
Expand Down
23 changes: 4 additions & 19 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,9 @@
# aprs-weather-submit news

This file details all of the user-facing changes that are in versions 1.6 of aprs-weather-submit. For more details, please consult the CHANGELOG file or this project's GitHub page.
This file details all of the user-facing changes that are in version 1.7 of aprs-weather-submit. For more details, please consult the CHANGELOG file or this project's GitHub page.

## DOS SUPPORT?
## CUSTOM ICONS

I have preliminary support for compiling this app on FreeDOS, MS-DOS, and other DOS-compatible systems. Use the `make-dos.bat` file to build the app and create a file, `APRSWX.EXE`. Note that APRS-IS support will be unavailable.
The new `--icon` parameter lets you specify a character from the two symbol tables. If not specified, you will get the classic weather icon.

This does not currently work. OpenWatcom has an implementation of `getopt()` that is required, but due to licensing differences, I cannot distribute it with this app. I'm working on finding a replacemnet.

## CUSTOM COMMENTS

Custom comments can now be included with the `--comment` option.

## GOT ME A RAYGUN, GOT ME AN ALTITUDE

The short version of the `--altitude` parameter (`-A`) was not being detected. This bug has been corrected.

## TWO MINUTES TO MIDNIGHT

For latitudes and longitudes between ±0.1 (e.g., 40.00 to 40.1666), the "minutes" calculation would evaluate to less than ten. This would result in a missing digit and invalid uncompressed positions. This has been fixed thanks to [ploeffler](https://github.com/ploeffler)'s bug report.

-----
For information about older versions, consult the CHANGELOG.md files.
Note that APRS.fi does not support parsing weather data from packets that have custom icons. If this is important to you, do not use this new feature.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dnl
dnl You should have received a copy of the GNU Affero General Public License
dnl along with this program. If not, see <http://gnu.org/licenses/agpl-3.0.html>.

AC_INIT([aprs-weather-submit], [1.7-git], [https://github.com/rhymeswithmogul/aprs-weather-submit/])
AC_INIT([aprs-weather-submit], [1.7], [https://github.com/rhymeswithmogul/aprs-weather-submit/])
AM_INIT_AUTOMAKE([foreign subdir-objects -Wall -Werror])
AC_PREREQ
AC_PROG_INSTALL
Expand Down
2 changes: 1 addition & 1 deletion debian/aprs-weather-submit-docs.docs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AUTHORS
CHANGELOG.md
CODE_OF_CONDUCT.md
INSTALL.md
NEWS.md
README.md
SECURITY.md
25 changes: 7 additions & 18 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
aprs-weather-submit (1.6-4) unstable; urgency=medium
aprs-weather-submit (1.7-2) jammy; urgency=medium

* Custom comments can be added to packets! Use --comment` to add your own
notes to a packet.
* When not using custom comments, the "X" in the comment field is removed.
APRS packets rarely, if ever, use the operating system identifier these days,
so there is no need to prefix the user agent or comment with it.
* Fixed GitHub issue #9: minute values less than ten would result in invalid
uncompressed positions. (Thank you, ploeffler!)
* Fixed a bug where the --altitude parameter was not being detected in its
short form (-A).
* Fixed GitHub issue #6 (for real this time): Worked around a bug with APRS.fi
where their site would reject packets with the temperature listed before the
wind gust speeds. This was not a bug in this app. Thank you, PD9MWO!
* Fixed GitHub issue #4 where GCC 8.1 would emit spurious warnings. This was
fixed by replacing calls to strncat() with strcat(). Thank you for the report
and the pull request, KR4DIO!
* Removed dependency on <assert.h>.
* The icon can now be changed from the default (WX) icon using the new
`--icon` option.
* Output of `snprintf()` is now better checked to make sure we haven't
overflowed our buffer.
* Fixed a compile-time error on armhf platforms.

-- Colin Cogle <colin@colincogle.name> Wed, 26 Oct 2022 22:53:17 -0400
-- Colin Cogle <colin@colincogle.name> Thu, 30 Nov 2023 00:32:00 -0500
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Description: Manually submits weather station information to the APRS-IS network
Maybe you are like me, and have an old-school thermometer and CoCoRaHS-approved
rain gauge. This command-line app can compile on most Linux toolchains and will
manually submit APRS 1.2.1-compliant information via APRS-IS.
Installed-Size: 63291
Installed-Size: 56041
6 changes: 3 additions & 3 deletions debian/files
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
aprs-weather-submit-dbgsym_1.6-1_amd64.ddeb debug optional automatic=yes
aprs-weather-submit_1.6-1_amd64.buildinfo hamradio optional
aprs-weather-submit_1.6-1_amd64.deb hamradio optional
aprs-weather-submit-dbgsym_1.7-2_amd64.ddeb debug optional automatic=yes
aprs-weather-submit_1.7-2_amd64.buildinfo hamradio optional
aprs-weather-submit_1.7-2_amd64.deb hamradio optional
8 changes: 7 additions & 1 deletion man/aprs-weather-submit.man
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.\"
.\" (This page is best viewed with the command: groff -man)
.\"
.TH aprs\-weather\-submit 1 "2022-10-26" "Version 1.6" "aprs-weather-submit General Help"
.TH aprs\-weather\-submit 1 "2023-11-29" "Version 1.7" "aprs-weather-submit General Help"
.SH NAME
aprs\-weather\-submit \- manually submit weather station data to the APRS-IS network
.SH DESCRIPTION
Expand Down Expand Up @@ -46,6 +46,8 @@ This command-line app will manually submit APRS 1.2.1-compliant weather informat
.IR SPEED " ]\:"
.RB [ " \-h "
.IR PERCENTAGE " ]\:"
.RB [ " \-i "
.IR ICON " ]\:"
.RB [ " \-L "
.IR WATTS_PER_SQUARE_METER " ]\:"
.RB [ " \-p "
Expand Down Expand Up @@ -97,6 +99,10 @@ Replace the comment field (by default, the aprs-weather-submit user agent).
The APRS specification allows for a comment of up to 43 characters in length;
anything longer will be truncated with a warning printed to stderr.
This option will override the \-Q (\-\-no\-comment) option.
.TP
.BR \-i ", " \-\-icon =\fIICON\fP
Instead of using the default APRS weather icon, you may specify a custom one.
Note that this app does not check to make sure you're using a valid icon, as implementations vary wildly.

.SS CALLSIGN AND LOCATION OPTIONS
The APRS specification requires all packets to have a callsign, and strongly encourages all weather reports to have position information.
Expand Down
7 changes: 1 addition & 6 deletions src/aprs-wx.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,20 +257,15 @@ notNull (const char* const val)
* @param compressedPacket The constant COMPRESSED_PACKET or UNCOMPRESSED_PACKET.
* @param suppressUserAgent If !=0, don't put the Linux flag ('X') nor the app
* name and version in the comment field.
* @param icon The symbol table identifier and code. Default: /w
* @since 0.1
*/
void
printAPRSPacket (APRSPacket* restrict const p, char* restrict const ret,
char compressPacket, const char suppressUserAgent,
const char* const icon = "/w")
char compressPacket, const char suppressUserAgent)
{
char result[BUFSIZE] = "\0";
time_t t = time(NULL);
struct tm* now = gmtime(&t); /* APRS uses GMT */

const char symbolTableID = icon[0];
const char symbolCode = icon[1];

if (compressPacket == COMPRESSED_PACKET)
{
Expand Down
8 changes: 2 additions & 6 deletions src/aprs-wx.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef struct APRSPacket
char waterLevel[5];
char voltage[4];
char comment[MAX_COMMENT_LENGTH + 1];
char icon[2];
char icon[3];
} APRSPacket;

#define IS_LATITUDE 0
Expand Down Expand Up @@ -113,17 +113,13 @@ notNull (const char* const val);
* @param compressedPacket The constant COMPRESSED_PACKET or UNCOMPRESSED_PACKET.
* @param suppressUserAgent If !=0, don't put the app name/version in the comment
* field.
* @param icon The icon to use on the map. The first character is
* the symbol table identifier, and the second is the
* symbol code.
*/
void
printAPRSPacket (
APRSPacket* restrict const p,
char* restrict const ret,
char compressedPacket,
const char suppressUserAgent,
const char* const icon
const char suppressUserAgent
);

/**
Expand Down
14 changes: 8 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ main (const int argc, const char** argv)
{"radiation", required_argument, 0, 'X'},
{"water-level-above-stage", required_argument, 0, 'F'}, /* APRS 1.2 */
{"voltage", required_argument, 0, 'V'}, /* APRS 1.2 */
{"icon", required_argument, 0, 'i'}
{"icon", required_argument, 0, 'i'},
{0, 0, 0, 0}
};
#endif
Expand Down Expand Up @@ -586,7 +586,7 @@ main (const int argc, const char** argv)
be able to get away with this. */
if (strlen(optarg) > MAX_COMMENT_LENGTH)
{
fprintf(stderr, "Your comment was %lu characters long, but APRS allows %u characters. Your comment was truncated.\n", strlen(optarg), MAX_COMMENT_LENGTH);
fprintf(stderr, "Your comment was %zu characters long, but APRS allows %u characters. Your comment was truncated.\n", strlen(optarg), MAX_COMMENT_LENGTH);
}
break;

Expand All @@ -601,18 +601,20 @@ main (const int argc, const char** argv)
}
if (optarg[0] != '/' && optarg[0] != '\\')
{
fprintf(stderr, "%s: the symbol table identifier '%c' is not valid.\n", argv[0], optarg);
fprintf(stderr, "%s: the symbol table identifier '%c' is not valid.\n", argv[0], optarg[0]);
return EXIT_FAILURE;
}
if (optarg[1] < 33 || optarg[1] > 126)
{
fprintf(stderr, "%s: the symbol code '%c' is not in the APRS symbol table.\n", argv[0], optopt);
fprintf(stderr, "%s: the symbol code '%c' is not in the APRS symbol table.\n", argv[0], optarg[1]);
return EXIT_FAILURE;
}

snprintf_verify(
/*snprintf_verify(
snprintf(packet.icon, 2, "%s", optarg)
)
);*/
packet.icon[0] = optarg[0];
packet.icon[1] = optarg[1];
break;

/* Unknown argument handler (quick help). */
Expand Down
2 changes: 1 addition & 1 deletion src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ with this program. If not, see <https://www.gnu.org/licenses/agpl-3.0.html>.
#endif

#ifndef VERSION
#define VERSION "1.7-git"
#define VERSION "1.7"
#endif

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

0 comments on commit d9a3c8f

Please sign in to comment.