Skip to content

Commit ae888b0

Browse files
committed
New NCHANNEL feature.
1 parent c05669a commit ae888b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+697
-391
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
### New Features: ###
88

9+
10+
- New NCHANNEL feature to map a channel number to an external network TCP KISS TNC. See xxx for example of a bridge to LoRa APRS. See [APRS-LoRa-VHF-APRS-Bridge.pdf](https://github.com/wb2osz/direwolf-doc/blob/main/APRS-LoRa-VHF-APRS-Bridge.pdf) for explanation.
11+
912
- [http://www.aprs.org/aprs11/tocalls.txt](http://www.aprs.org/aprs11/tocalls.txt) has been abandoned since the end of 2021. [https://github.com/aprsorg/aprs-deviceid](https://github.com/aprsorg/aprs-deviceid) is now considered to be the authoritative source of truth for the vendor/model encoding.
1013

1114
## Version 1.7 -- October 2023 ##

conf/generic.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
%C%#DTMF
275275
%C%
276276
%C%# Push to Talk (PTT) can be confusing because there are so many different cases.
277-
%C%# Radio-Interface-Guide.pdf in https://github.com/wb2osz/direwolf-doc
277+
%C%# https://github.com/wb2osz/direwolf-doc/blob/main/Radio-Interface-Guide.pdf
278278
%C%# goes into detail about the various options.
279279
%C%
280280
%L%# If using a C-Media CM108/CM119 or similar USB Audio Adapter,

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ list(APPEND direwolf_SOURCES
7979
morse.c
8080
multi_modem.c
8181
waypoint.c
82+
nettnc.c
8283
serial_port.c
8384
pfilter.c
8485
ptt.c

src/agwlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static void * tnc_listen_thread (void *arg)
357357
/*
358358
* Take some precautions to guard against bad data which could cause problems later.
359359
*/
360-
if (cmd.hdr.portx < 0 || cmd.hdr.portx >= MAX_CHANS) {
360+
if (cmd.hdr.portx < 0 || cmd.hdr.portx >= MAX_TOTAL_CHANS) {
361361
text_color_set(DW_COLOR_ERROR);
362362
dw_printf ("Invalid channel number, %d, in command '%c', from network TNC.\n",
363363
cmd.hdr.portx, cmd.hdr.datakind);

src/appserver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void agw_cb_G_port_information (int num_chan_avail, char *chan_descriptions[])
597597
if (strncasecmp(p, "Port", 4) == 0 && isdigit(p[4])) {
598598

599599
int chan = atoi(p+4) - 1; // "Port1" is our channel 0.
600-
if (chan >= 0 && chan < MAX_CHANS) {
600+
if (chan >= 0 && chan < MAX_TOTAL_CHANS) {
601601

602602
char *desc = p + 4;
603603
while (*desc != '\0' && (*desc == ' ' || isdigit(*desc))) {

src/aprs_tt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@
9595

9696
#define MAX_MSG_LEN 100
9797

98-
static char msg_str[MAX_CHANS][MAX_MSG_LEN+1];
99-
static int msg_len[MAX_CHANS];
98+
static char msg_str[MAX_RADIO_CHANS][MAX_MSG_LEN+1];
99+
static int msg_len[MAX_RADIO_CHANS];
100100

101101
static int parse_fields (char *msg);
102102
static int parse_callsign (char *e);
@@ -185,7 +185,7 @@ void aprs_tt_init (struct tt_config_s *p, int debug)
185185
// TODO: Keep ptr instead of making a copy.
186186
memcpy (&tt_config, p, sizeof(struct tt_config_s));
187187
#endif
188-
for (c=0; c<MAX_CHANS; c++) {
188+
for (c=0; c<MAX_RADIO_CHANS; c++) {
189189
msg_len[c] = 0;
190190
msg_str[c][0] = '\0';
191191
}
@@ -226,7 +226,7 @@ void aprs_tt_button (int chan, char button)
226226
{
227227
static int poll_period = 0;
228228

229-
assert (chan >= 0 && chan < MAX_CHANS);
229+
assert (chan >= 0 && chan < MAX_RADIO_CHANS);
230230

231231

232232
//if (button != '.') {

src/atest.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ int main (int argc, char *argv[])
231231
my_audio_config.adev[0].bits_per_sample = DEFAULT_BITS_PER_SAMPLE;
232232

233233

234-
for (channel=0; channel<MAX_CHANS; channel++) {
234+
for (channel=0; channel<MAX_RADIO_CHANS; channel++) {
235235

236236
my_audio_config.achan[channel].modem_type = MODEM_AFSK;
237237

@@ -628,9 +628,10 @@ int main (int argc, char *argv[])
628628
dw_printf ("%d samples per second. %d bits per sample. %d audio channels.\n",
629629
my_audio_config.adev[0].samples_per_sec,
630630
my_audio_config.adev[0].bits_per_sample,
631-
my_audio_config.adev[0].num_channels);
631+
(int)(my_audio_config.adev[0].num_channels));
632+
// nnum_channels is known to be 1 or 2.
632633
one_filetime = (double) wav_data.datasize /
633-
((my_audio_config.adev[0].bits_per_sample / 8) * my_audio_config.adev[0].num_channels * my_audio_config.adev[0].samples_per_sec);
634+
((my_audio_config.adev[0].bits_per_sample / 8) * (int)(my_audio_config.adev[0].num_channels) * my_audio_config.adev[0].samples_per_sec);
634635
total_filetime += one_filetime;
635636

636637
dw_printf ("%d audio bytes in file. Duration = %.1f seconds.\n",
@@ -654,7 +655,7 @@ int main (int argc, char *argv[])
654655
int audio_sample;
655656
int c;
656657

657-
for (c=0; c<my_audio_config.adev[0].num_channels; c++)
658+
for (c=0; c<(int)(my_audio_config.adev[0].num_channels); c++)
658659
{
659660

660661
/* This reads either 1 or 2 bytes depending on */
@@ -921,7 +922,7 @@ void dlq_rec_frame (int chan, int subchan, int slice, packet_t pp, alevel_t alev
921922
void ptt_set (int ot, int chan, int ptt_signal)
922923
{
923924
// Should only get here for DCD output control.
924-
static double dcd_start_time[MAX_CHANS];
925+
static double dcd_start_time[MAX_RADIO_CHANS];
925926

926927
if (d_o_opt) {
927928
double t = (double)sample_number / my_audio_config.adev[0].samples_per_sec;

src/audio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ int audio_open (struct audio_s *pa)
257257
if (pa->adev[a].bits_per_sample == 0)
258258
pa->adev[a].bits_per_sample = DEFAULT_BITS_PER_SAMPLE;
259259

260-
for (chan=0; chan<MAX_CHANS; chan++) {
260+
for (chan=0; chan<MAX_RADIO_CHANS; chan++) {
261261
if (pa->achan[chan].mark_freq == 0)
262262
pa->achan[chan].mark_freq = DEFAULT_MARK_FREQ;
263263

src/audio.h

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <hamlib/rig.h>
1717
#endif
1818

19-
#include "direwolf.h" /* for MAX_CHANS used throughout the application. */
19+
#include "direwolf.h" /* for MAX_RADIO_CHANS and MAX_TOTAL_CHANS used throughout the application. */
2020
#include "ax25_pad.h" /* for AX25_MAX_ADDR_LEN */
2121
#include "version.h"
2222

@@ -59,7 +59,7 @@ typedef enum retry_e {
5959
enum medium_e { MEDIUM_NONE = 0, // Channel is not valid for use.
6060
MEDIUM_RADIO, // Internal modem for radio.
6161
MEDIUM_IGATE, // Access IGate as ordinary channel.
62-
MEDIUM_NETTNC }; // Remote network TNC. (possible future)
62+
MEDIUM_NETTNC }; // Remote network TNC. (new in 1.8)
6363

6464

6565
typedef enum sanity_e { SANITY_APRS, SANITY_AX25, SANITY_NONE } sanity_t;
@@ -139,10 +139,19 @@ struct audio_s {
139139
/* originally a "channel" was always connected to an internal modem. */
140140
/* In version 1.6, this is generalized so that a channel (as seen by client application) */
141141
/* can be connected to something else. Initially, this will allow application */
142-
/* access to the IGate. Later we might have network TNCs or other internal functions. */
142+
/* access to the IGate. In version 1.8 we add network KISS TNC. */
143+
144+
// Watch out for maximum number of channels.
145+
// MAX_CHANS - Originally, this was 6 for internal modem adio channels. Has been phased out.
146+
// After adding virtual channels (IGate, network TNC), this is split into two different numbers:
147+
// MAX_RADIO_CHANNELS - For internal modems.
148+
// MAX_TOTAL_CHANNELS - limited by KISS channels/ports. Needed for digipeating, filtering, etc.
143149

144150
// Properties for all channels.
145151

152+
char mycall[MAX_TOTAL_CHANS][AX25_MAX_ADDR_LEN]; /* Call associated with this radio channel. */
153+
/* Could all be the same or different. */
154+
146155
enum medium_e chan_medium[MAX_TOTAL_CHANS];
147156
// MEDIUM_NONE for invalid.
148157
// MEDIUM_RADIO for internal modem. (only possibility earlier)
@@ -154,6 +163,14 @@ struct audio_s {
154163
/* Redundant but it makes things quicker and simpler */
155164
/* than always searching thru above. */
156165

166+
// Applies only to network TNC type channels.
167+
168+
char nettnc_addr[MAX_TOTAL_CHANS][80]; // Network TNC address: hostname or IP addr.
169+
170+
int nettnc_port[MAX_TOTAL_CHANS]; // Network TNC TCP port.
171+
172+
173+
157174
/* Properties for each radio channel, common to receive and transmit. */
158175
/* Can be different for each radio channel. */
159176

@@ -171,8 +188,6 @@ struct audio_s {
171188
// int audio_source; // Default would be [0,1,2,3,4,5]
172189

173190
// What else should be moved out of structure and enlarged when NETTNC is implemented. ???
174-
char mycall[AX25_MAX_ADDR_LEN]; /* Call associated with this radio channel. */
175-
/* Could all be the same or different. */
176191

177192

178193
enum modem_t { MODEM_AFSK, MODEM_BASEBAND, MODEM_SCRAMBLE, MODEM_QPSK, MODEM_8PSK, MODEM_OFF, MODEM_16_QAM, MODEM_64_QAM, MODEM_AIS, MODEM_EAS } modem_type;
@@ -381,7 +396,7 @@ struct audio_s {
381396

382397
int fulldup; /* Full Duplex. */
383398

384-
} achan[MAX_CHANS];
399+
} achan[MAX_RADIO_CHANS];
385400

386401
#ifdef USE_HAMLIB
387402
int rigs; /* Total number of configured rigs */

src/audio_portaudio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ int audio_open (struct audio_s *pa)
578578
if (pa->adev[a].bits_per_sample == 0)
579579
pa->adev[a].bits_per_sample = DEFAULT_BITS_PER_SAMPLE;
580580

581-
for (chan = 0; chan < MAX_CHANS; chan++) {
581+
for (chan = 0; chan < MAX_RADIO_CHANS; chan++) {
582582
if (pa->achan[chan].mark_freq == 0)
583583
pa->achan[chan].mark_freq = DEFAULT_MARK_FREQ;
584584

0 commit comments

Comments
 (0)