from pax25.interfaces import TCPInterface
Setting up real interfaces¶
Setting up the file interface is useful for testing and building locally, but eventually you're going to want your station and applications to talk to other stations over the air.
Pax25 comes with two "real-world" interfaces: The serial KISS interface, and the TCP Interface, with more to come. It also comes with a command line app that allows you to connect to other stations through these interfaces.
Serial KISS Configuration¶
The following is an example setup file of a station using a serial interface, and adds the command line app to the file interface. This allows you to run your station using the command line application and connect to other stations over the air by controlling your TNC over your serial connection in KISS-mode. You can read more about the serial interface in its main article.
from pax25.station import Station
from pax25.interfaces import SerialInterface
from pax25.contrib.command.command import CommandLine
import asyncio
station = Station(
config={
# Replace this with your callsign.
"name": "N0CALL",
}
)
SerialInterface.install(station, name="tcp", settings={
# Omit any of these keys to use their defaults.
# Path to your serial device. On Windows, the default is
# COM1, on Linux, it is /dev/ttyUSB0
"path": "/dev/ttyUSB0",
# The signaling rate your TNC communicates to your PC
# using. Default is 9600.
"baud_rate": 9600,
# Timeout, in seconds, for the serial connection. If this
# is exceeded, the connection has failed.
"timeout": 1,
# Same, but for writing instead of reading.
"write_timeout": 1,
# These flags are standard serial flags. You should
# probably leave them alone unless things go wrong,
# then consult your TNC's documentation to see if they're mentioned.
"rtscts": False,
"dsrdtr": False,
"xonxoff": False,
# Whether the station should use this interface to contact outside stations it doesn't know.
"gateway": True,
# Set this True to make the TNC leave kiss mode and immediately shut down the station.
# Works for Kantronics models. No idea for others. Not all TNCs support modes other than KISS.
"exit_kiss": False,
# These are the KISS TNC settings, as described in http://www.ax25.net/kiss.aspx . You should
# probably leave these alone, but you can tweak them if you're having trouble.
"tnc_settings": {
"port": 0,
"tx_delay": 5,
"persist": 63,
"slot_time": 1,
"full_duplex": 0,
}
})
station.connection.add_app(CommandLine, interfaces=["file"], settings={})
asyncio.run(station.start())
TCP Configuration¶
Warning
Please check the main article for security warnings and context about the TCP Interface.
The following is an example configuration that would allow anyone who can contact your station to leave a message on your own personal bulletin board system. It also connects to another system to join you to an existing network.
from pax25.station import Station
from pax25.interfaces import TCPInterface
from pax25.contrib.bulletin_board.bulletin_board import BulletinBoard
import asyncio
station = Station(
config={
# Replace this with your callsign.
"name": "N0CALL",
}
)
TCPInterface.install(station, name="tcp", settings={
# Omit any of these keys to use their defaults.
# The default listening address is 0.0.0.0.
# Operating systems are expected to interpret this as
# 'all interfaces', meaning that it will allow both local
# and external connections.
"listening_address": "0.0.0.0",
# The default IP listening port is 7773.
"listening_port": 7773,
# These are APRS credentials. You must fill them with your
# call sign and APRS password to connect to the other
# stations in the "connections" setting.
"call_sign": "MYCALL",
# Note that your APRS password is an integer, not a string.
"password": 00000,
# Connections is a list of IPs to send packets to when
# they are sent on this interface.
"connections": [
# Connects to another station running pax25 at
# houston.vulpinity.com (one of the reference stations).
# You can use an IP address instead of a hostname.
# The default port is 7773.
{"host": "houston.vulpinity.com", "port": 7773},
],
# Whether this interface can be used for contacting
# outside stations. Default is True.
"gateway": True,
})
station.connection.add_app(BulletinBoard, interfaces=["tcp"], settings={})
asyncio.run(station.start())