1 2 /*---------------------------------------------------------------------------- 3 * 4 * Name: config.h 5 * 6 * Purpose: 7 * 8 * Description: 9 * 10 *-----------------------------------------------------------------------------*/ 11 12 13 #ifndef CONFIG_H 14 #define CONFIG_H 1 15 16 #include "audio.h" /* for struct audio_s */ 17 #include "digipeater.h" /* for struct digi_config_s */ 18 #include "cdigipeater.h" /* for struct cdigi_config_s */ 19 #include "aprs_tt.h" /* for struct tt_config_s */ 20 #include "igate.h" /* for struct igate_config_s */ 21 22 /* 23 * All the leftovers. 24 * This wasn't thought out. It just happened. 25 */ 26 27 enum beacon_type_e { BEACON_IGNORE, BEACON_POSITION, BEACON_OBJECT, BEACON_TRACKER, BEACON_CUSTOM, BEACON_IGATE }; 28 29 enum sendto_type_e { SENDTO_XMIT, SENDTO_IGATE, SENDTO_RECV }; 30 31 32 #define MAX_BEACONS 30 33 34 struct misc_config_s { 35 36 int agwpe_port; /* Port number for the "AGW TCPIP Socket Interface" */ 37 int kiss_port; /* Port number for the "TCP KISS" protocol. */ 38 int kiss_copy; /* Data from network KISS client is copied to all others. */ 39 int enable_kiss_pt; /* Enable pseudo terminal for KISS. */ 40 /* Want this to be off by default because it hangs */ 41 /* after a while if nothing is reading from other end. */ 42 43 char kiss_serial_port[20]; 44 /* Serial port name for our end of the */ 45 /* virtual null modem for native Windows apps. */ 46 /* Version 1.5 add same capability for Linux. */ 47 48 int kiss_serial_speed; /* Speed, in bps, for the KISS serial port. */ 49 /* If 0, just leave what was already there. */ 50 51 int kiss_serial_poll; /* When using Bluetooth KISS, the /dev/rfcomm0 device */ 52 /* will appear and disappear as the remote application */ 53 /* opens and closes the virtual COM port. */ 54 /* When this is non-zero, we will check periodically to */ 55 /* see if the device has appeared and we will open it. */ 56 57 char gpsnmea_port[20]; /* Serial port name for reading NMEA sentences from GPS. */ 58 /* e.g. COM22, /dev/ttyACM0 */ 59 /* Currently no option for setting non-standard speed. */ 60 61 char gpsd_host[20]; /* Host for gpsd server. */ 62 /* e.g. localhost, 192.168.1.2 */ 63 64 int gpsd_port; /* Port number for gpsd server. */ 65 /* Default is 2947. */ 66 67 68 char waypoint_serial_port[20]; /* Serial port name for sending NMEA waypoint sentences */ 69 /* to a GPS map display or other mapping application. */ 70 /* e.g. COM22, /dev/ttyACM0 */ 71 /* Currently no option for setting non-standard speed. */ 72 /* This was done in 2014 and no one has complained yet. */ 73 74 char waypoint_udp_hostname[80]; /* Destination host when using UDP. */ 75 76 int waypoint_udp_portnum; /* UDP port. */ 77 78 int waypoint_formats; /* Which sentence formats should be generated? */ 79 80 #define WPT_FORMAT_NMEA_GENERIC 0x01 /* N $GPWPT */ 81 #define WPT_FORMAT_GARMIN 0x02 /* G $PGRMW */ 82 #define WPT_FORMAT_MAGELLAN 0x04 /* M $PMGNWPL */ 83 #define WPT_FORMAT_KENWOOD 0x08 /* K $PKWDWPL */ 84 #define WPT_FORMAT_AIS 0x10 /* A !AIVDM */ 85 86 87 int log_daily_names; /* True to generate new log file each day. */ 88 89 char log_path[80]; /* Either directory or full file name depending on above. */ 90 91 int sb_configured; /* TRUE if SmartBeaconing is configured. */ 92 int sb_fast_speed; /* MPH */ 93 int sb_fast_rate; /* seconds */ 94 int sb_slow_speed; /* MPH */ 95 int sb_slow_rate; /* seconds */ 96 int sb_turn_time; /* seconds */ 97 int sb_turn_angle; /* degrees */ 98 int sb_turn_slope; /* degrees * MPH */ 99 100 // AX.25 connected mode. 101 102 int frack; /* Number of seconds to wait for ack to transmission. */ 103 104 int retry; /* Number of times to retry before giving up. */ 105 106 int paclen; /* Max number of bytes in information part of frame. */ 107 108 int maxframe_basic; /* Max frames to send before ACK. mod 8 "Window" size. */ 109 110 int maxframe_extended; /* Max frames to send before ACK. mod 128 "Window" size. */ 111 112 int maxv22; /* Maximum number of unanswered SABME frames sent before */ 113 /* switching to SABM. This is to handle the case of an old */ 114 /* TNC which simply ignores SABME rather than replying with FRMR. */ 115 116 char **v20_addrs; /* Stations known to understand only AX.25 v2.0 so we don't */ 117 /* waste time trying v2.2 first. */ 118 119 int v20_count; /* Number of station addresses in array above. */ 120 121 char **noxid_addrs; /* Stations known not to understand XID command so don't */ 122 /* waste time sending it and eventually giving up. */ 123 /* AX.25 for Linux is the one known case, so far, where */ 124 /* SABME is implemented but XID is not. */ 125 126 int noxid_count; /* Number of station addresses in array above. */ 127 128 129 // Beacons. 130 131 int num_beacons; /* Number of beacons defined. */ 132 133 struct beacon_s { 134 135 enum beacon_type_e btype; /* Position or object. */ 136 137 int lineno; /* Line number from config file for later error messages. */ 138 139 enum sendto_type_e sendto_type; 140 141 /* SENDTO_XMIT - Usually beacons go to a radio transmitter. */ 142 /* chan, below is the channel number. */ 143 /* SENDTO_IGATE - Send to IGate, probably to announce my position */ 144 /* rather than relying on someone else to hear */ 145 /* me on the radio and report me. */ 146 /* SENDTO_RECV - Pretend this was heard on the specified */ 147 /* radio channel. Mostly for testing. It is a */ 148 /* convenient way to send packets to attached apps. */ 149 150 int sendto_chan; /* Transmit or simulated receive channel for above. Should be 0 for IGate. */ 151 152 int delay; /* Seconds to delay before first transmission. */ 153 154 int slot; /* Seconds after hour for slotted time beacons. */ 155 /* If specified, it overrides any 'delay' value. */ 156 157 int every; /* Time between transmissions, seconds. */ 158 /* Remains fixed for PBEACON and OBEACON. */ 159 /* Dynamically adjusted for TBEACON. */ 160 161 time_t next; /* Unix time to transmit next one. */ 162 163 char *dest; /* NULL or explicit AX.25 destination to use */ 164 /* instead of the software version such as APDW11. */ 165 166 int compress; /* Use more compact form? */ 167 168 char objname[10]; /* Object name. Any printable characters. */ 169 170 char *via; /* Path, e.g. "WIDE1-1,WIDE2-1" or NULL. */ 171 172 char *custom_info; /* Info part for handcrafted custom beacon. */ 173 /* Ignore the rest below if this is set. */ 174 175 char *custom_infocmd; /* Command to generate info part. */ 176 /* Again, other options below are then ignored. */ 177 178 int messaging; /* Set messaging attribute for position report. */ 179 /* i.e. Data Type Indicator of '=' rather than '!' */ 180 181 double lat; /* Latitude and longitude. */ 182 double lon; 183 int ambiguity; /* Number of lower digits to trim from location. 0 (default), 1, 2, 3, 4. */ 184 float alt_m; /* Altitude in meters. */ 185 186 char symtab; /* Symbol table: / or \ or overlay character. */ 187 char symbol; /* Symbol code. */ 188 189 float power; /* For PHG. */ 190 float height; 191 float gain; /* Original protocol spec was unclear. */ 192 /* Addendum 1.1 clarifies it is dBi not dBd. */ 193 194 char dir[3]; /* 1 or 2 of N,E,W,S, or empty for omni. */ 195 196 float freq; /* MHz. */ 197 float tone; /* Hz. */ 198 float offset; /* MHz. */ 199 200 char *comment; /* Comment or NULL. */ 201 char *commentcmd; /* Command to append more to Comment or NULL. */ 202 203 204 } beacon[MAX_BEACONS]; 205 206 }; 207 208 209 #define MIN_IP_PORT_NUMBER 1024 210 #define MAX_IP_PORT_NUMBER 49151 211 212 213 #define DEFAULT_AGWPE_PORT 8000 /* Like everyone else. */ 214 #define DEFAULT_KISS_PORT 8001 /* Above plus 1. */ 215 216 217 #define DEFAULT_NULLMODEM "COM3" /* should be equiv. to /dev/ttyS2 on Cygwin */ 218 219 220 221 222 extern void config_init (char *fname, struct audio_s *p_modem, 223 struct digi_config_s *digi_config, 224 struct cdigi_config_s *cdigi_config, 225 struct tt_config_s *p_tt_config, 226 struct igate_config_s *p_igate_config, 227 struct misc_config_s *misc_config); 228 229 230 231 #endif /* CONFIG_H */ 232 233 /* end config.h */ 234 235 236