@@ -1381,6 +1381,70 @@ void config_init (char *fname, struct audio_s *p_audio_config,
1381
1381
p_audio_config -> nettnc_port [nchan ] = atoi (t );
1382
1382
}
1383
1383
1384
+ /*
1385
+ * SCHANNEL chan device baudrate - Define Serial TNC virtual channel.
1386
+ *
1387
+ * This allows a client application to talk to to an external TNC over serial KISS
1388
+ * by using a channel number outside the normal range for modems.
1389
+ * This does not change the current channel number used by MODEM, PTT, etc.
1390
+ *
1391
+ * chan = direwolf channel.
1392
+ * device = device (serial port) name of serial TNC.
1393
+ * baudrate = baud rate for communicating with serial TNC.
1394
+ *
1395
+ * Future: Might allow selection of channel on the serial TNC.
1396
+ * For now, ignore incoming and set to 0 for outgoing.
1397
+ *
1398
+ * FIXME: Can't set mycall for schannel.
1399
+ */
1400
+
1401
+ else if (strcasecmp (t , "SCHANNEL" ) == 0 ) {
1402
+ t = split (NULL ,0 );
1403
+ if (t == NULL ) {
1404
+ text_color_set (DW_COLOR_ERROR );
1405
+ dw_printf ("Line %d: Missing virtual channel number for SCHANNEL command.\n" , line );
1406
+ continue ;
1407
+ }
1408
+ int nchan = atoi (t );
1409
+ if (nchan >= MAX_RADIO_CHANS && nchan < MAX_TOTAL_CHANS ) {
1410
+
1411
+ if (p_audio_config -> chan_medium [nchan ] == MEDIUM_NONE ) {
1412
+
1413
+ p_audio_config -> chan_medium [nchan ] = MEDIUM_SERTNC ;
1414
+ }
1415
+ else {
1416
+ text_color_set (DW_COLOR_ERROR );
1417
+ dw_printf ("Line %d: SCHANNEL can't use channel %d because it is already in use.\n" , line , nchan );
1418
+ }
1419
+ }
1420
+ else {
1421
+ text_color_set (DW_COLOR_ERROR );
1422
+ dw_printf ("Line %d: SCHANNEL number must in range of %d to %d.\n" , line , MAX_RADIO_CHANS , MAX_TOTAL_CHANS - 1 );
1423
+ }
1424
+
1425
+ t = split (NULL ,0 );
1426
+ if (t == NULL ) {
1427
+ text_color_set (DW_COLOR_ERROR );
1428
+ dw_printf ("Line %d: Missing serial TNC device for SCHANNEL command.\n" , line );
1429
+ continue ;
1430
+ }
1431
+ strlcpy (p_audio_config -> sertnc_device [nchan ], t , sizeof (p_audio_config -> sertnc_device [nchan ]));
1432
+ int n ;
1433
+ t = split (NULL ,0 );
1434
+ if (t != NULL ) {
1435
+ n = atoi (t );
1436
+ if (n != 1200 && n != 2400 && n != 4800 && n != 9600 && n != 19200 && n != 38400 && n != 57600 && n != 115200 ) {
1437
+ text_color_set (DW_COLOR_ERROR );
1438
+ dw_printf ("Line %d: Warning: Unsupported data rate of %d bits per second. Using 9600.\n" , line , n );
1439
+ n = 9600 ;
1440
+ }
1441
+ p_audio_config -> sertnc_baud [nchan ] = n ;
1442
+ }
1443
+ else {
1444
+ p_audio_config -> sertnc_baud [nchan ] = 9600 ;
1445
+ }
1446
+ }
1447
+
1384
1448
/*
1385
1449
* MYCALL station
1386
1450
*/
@@ -2749,7 +2813,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
2749
2813
// Channels specified must be radio channels or network TNCs.
2750
2814
2751
2815
if (p_audio_config -> chan_medium [from_chan ] != MEDIUM_RADIO &&
2752
- p_audio_config -> chan_medium [from_chan ] != MEDIUM_NETTNC ) {
2816
+ p_audio_config -> chan_medium [from_chan ] != MEDIUM_NETTNC &&
2817
+ p_audio_config -> chan_medium [from_chan ] != MEDIUM_SERTNC ) {
2753
2818
text_color_set (DW_COLOR_ERROR );
2754
2819
dw_printf ("Config file, line %d: FROM-channel %d is not valid.\n" ,
2755
2820
line , from_chan );
@@ -2777,7 +2842,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
2777
2842
}
2778
2843
2779
2844
if (p_audio_config -> chan_medium [to_chan ] != MEDIUM_RADIO &&
2780
- p_audio_config -> chan_medium [to_chan ] != MEDIUM_NETTNC ) {
2845
+ p_audio_config -> chan_medium [to_chan ] != MEDIUM_NETTNC &&
2846
+ p_audio_config -> chan_medium [to_chan ] != MEDIUM_SERTNC ) {
2781
2847
text_color_set (DW_COLOR_ERROR );
2782
2848
dw_printf ("Config file, line %d: TO-channel %d is not valid.\n" ,
2783
2849
line , to_chan );
@@ -3111,7 +3177,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
3111
3177
}
3112
3178
3113
3179
if (p_audio_config -> chan_medium [from_chan ] != MEDIUM_RADIO &&
3114
- p_audio_config -> chan_medium [from_chan ] != MEDIUM_NETTNC ) {
3180
+ p_audio_config -> chan_medium [from_chan ] != MEDIUM_NETTNC &&
3181
+ p_audio_config -> chan_medium [from_chan ] != MEDIUM_SERTNC ) {
3115
3182
text_color_set (DW_COLOR_ERROR );
3116
3183
dw_printf ("Config file, line %d: FROM-channel %d is not valid.\n" ,
3117
3184
line , from_chan );
@@ -3149,7 +3216,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
3149
3216
continue ;
3150
3217
}
3151
3218
if (p_audio_config -> chan_medium [to_chan ] != MEDIUM_RADIO &&
3152
- p_audio_config -> chan_medium [to_chan ] != MEDIUM_NETTNC ) {
3219
+ p_audio_config -> chan_medium [to_chan ] != MEDIUM_NETTNC &&
3220
+ p_audio_config -> chan_medium [to_chan ] != MEDIUM_SERTNC ) {
3153
3221
text_color_set (DW_COLOR_ERROR );
3154
3222
dw_printf ("Config file, line %d: TO-channel %d is not valid.\n" ,
3155
3223
line , to_chan );
@@ -4429,7 +4497,8 @@ void config_init (char *fname, struct audio_s *p_audio_config,
4429
4497
x = -1 ;
4430
4498
}
4431
4499
else if (p_audio_config -> chan_medium [x ] != MEDIUM_RADIO &&
4432
- p_audio_config -> chan_medium [x ] != MEDIUM_NETTNC ) {
4500
+ p_audio_config -> chan_medium [x ] != MEDIUM_NETTNC &&
4501
+ p_audio_config -> chan_medium [x ] != MEDIUM_SERTNC ) {
4433
4502
text_color_set (DW_COLOR_ERROR );
4434
4503
dw_printf ("Config file, line %d: TTOBJ transmit channel %d is not valid.\n" , line , x );
4435
4504
x = -1 ;
@@ -5784,7 +5853,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,
5784
5853
/* When IGate is enabled, all radio channels must have a callsign associated. */
5785
5854
5786
5855
if (strlen (p_igate_config -> t2_login ) > 0 &&
5787
- (p_audio_config -> chan_medium [i ] == MEDIUM_RADIO || p_audio_config -> chan_medium [i ] == MEDIUM_NETTNC )) {
5856
+ (p_audio_config -> chan_medium [i ] == MEDIUM_RADIO ||
5857
+ p_audio_config -> chan_medium [i ] == MEDIUM_NETTNC ||
5858
+ p_audio_config -> chan_medium [i ] == MEDIUM_SERTNC )) {
5788
5859
5789
5860
if (strcmp (p_audio_config -> mycall [i ], "NOCALL" ) == 0 || strcmp (p_audio_config -> mycall [i ], "N0CALL" ) == 0 ) {
5790
5861
text_color_set (DW_COLOR_ERROR );
@@ -5810,7 +5881,9 @@ void config_init (char *fname, struct audio_s *p_audio_config,
5810
5881
5811
5882
if (strlen (p_igate_config -> t2_login ) > 0 ) {
5812
5883
for (j = 0 ; j < MAX_TOTAL_CHANS ; j ++ ) {
5813
- if (p_audio_config -> chan_medium [j ] == MEDIUM_RADIO || p_audio_config -> chan_medium [j ] == MEDIUM_NETTNC ) {
5884
+ if (p_audio_config -> chan_medium [j ] == MEDIUM_RADIO ||
5885
+ p_audio_config -> chan_medium [j ] == MEDIUM_NETTNC ||
5886
+ p_audio_config -> chan_medium [j ] == MEDIUM_SERTNC ) {
5814
5887
if (p_digi_config -> filter_str [MAX_TOTAL_CHANS ][j ] == NULL ) {
5815
5888
p_digi_config -> filter_str [MAX_TOTAL_CHANS ][j ] = strdup ("i/180" );
5816
5889
}
0 commit comments