mirror of
https://github.com/TheCommsChannel/TC2-APRS-BBS.git
synced 2025-02-14 14:21:29 -05:00
Added serial support
Added support for serial connections and updated config.ini to be more detail
This commit is contained in:
parent
917797789c
commit
751c92cd7e
15
aprs_comm.py
15
aprs_comm.py
@ -103,7 +103,11 @@ def send_bulletin(bulletin_id, bulletin_text):
|
|||||||
info=frame_info
|
info=frame_info
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if config.KISS_INTERFACE == "SERIAL":
|
||||||
|
ki = aprs.SerialKISS(port=config.SERIAL_PORT, speed=config.SERIAL_BAUDRATE)
|
||||||
|
else:
|
||||||
ki = aprs.TCPKISS(host=config.KISS_HOST, port=config.KISS_PORT)
|
ki = aprs.TCPKISS(host=config.KISS_HOST, port=config.KISS_PORT)
|
||||||
|
|
||||||
ki.start()
|
ki.start()
|
||||||
ki.write(frame)
|
ki.write(frame)
|
||||||
print(f"Urgent bulletin transmitted: {bulletin_text}")
|
print(f"Urgent bulletin transmitted: {bulletin_text}")
|
||||||
@ -114,7 +118,13 @@ def send_bulletin(bulletin_id, bulletin_text):
|
|||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
|
if config.KISS_INTERFACE == "SERIAL":
|
||||||
|
ki = aprs.SerialKISS(port=config.SERIAL_PORT, speed=config.SERIAL_BAUDRATE)
|
||||||
|
print(f"Starting APRS in SERIAL mode on {config.SERIAL_PORT} at {config.SERIAL_BAUDRATE} baud...")
|
||||||
|
else:
|
||||||
ki = aprs.TCPKISS(host=config.KISS_HOST, port=config.KISS_PORT)
|
ki = aprs.TCPKISS(host=config.KISS_HOST, port=config.KISS_PORT)
|
||||||
|
print("Starting APRS in TCP mode...")
|
||||||
|
|
||||||
ki.start()
|
ki.start()
|
||||||
|
|
||||||
device_data = fetch_device_data()
|
device_data = fetch_device_data()
|
||||||
@ -235,7 +245,12 @@ def send_direct_message(recipient, message):
|
|||||||
path=config.APRS_PATH,
|
path=config.APRS_PATH,
|
||||||
info=frame_info
|
info=frame_info
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if config.KISS_INTERFACE == "SERIAL":
|
||||||
|
ki = aprs.SerialKISS(port=config.SERIAL_PORT, speed=config.SERIAL_BAUDRATE)
|
||||||
|
else:
|
||||||
ki = aprs.TCPKISS(host=config.KISS_HOST, port=config.KISS_PORT)
|
ki = aprs.TCPKISS(host=config.KISS_HOST, port=config.KISS_PORT)
|
||||||
|
|
||||||
ki.start()
|
ki.start()
|
||||||
ki.write(frame)
|
ki.write(frame)
|
||||||
print(f"Direct message sent to {recipient}: {formatted_message}")
|
print(f"Direct message sent to {recipient}: {formatted_message}")
|
||||||
|
@ -15,6 +15,9 @@ KISS_HOST = 127.0.0.1
|
|||||||
KISS_PORT = 8001
|
KISS_PORT = 8001
|
||||||
BULLETIN_EXPIRATION_DAYS = 7
|
BULLETIN_EXPIRATION_DAYS = 7
|
||||||
APRS_PATH = WIDE1-1,WIDE2-1
|
APRS_PATH = WIDE1-1,WIDE2-1
|
||||||
|
KISS_INTERFACE = TCP
|
||||||
|
SERIAL_PORT = /dev/rfcomm0
|
||||||
|
SERIAL_BAUDRATE = 9600
|
||||||
""")
|
""")
|
||||||
|
|
||||||
config.read(config_file)
|
config.read(config_file)
|
||||||
@ -26,3 +29,6 @@ KISS_PORT = config.getint("DEFAULT", "KISS_PORT", fallback=8001)
|
|||||||
BULLETIN_EXPIRATION_DAYS = config.getint("DEFAULT", "BULLETIN_EXPIRATION_DAYS", fallback=7)
|
BULLETIN_EXPIRATION_DAYS = config.getint("DEFAULT", "BULLETIN_EXPIRATION_DAYS", fallback=7)
|
||||||
APRS_PATH = config.get("DEFAULT", "APRS_PATH", fallback="WIDE1-1").split(",")
|
APRS_PATH = config.get("DEFAULT", "APRS_PATH", fallback="WIDE1-1").split(",")
|
||||||
RAW_PACKET_DISPLAY = config.getboolean("DEFAULT", "RAW_PACKET_DISPLAY", fallback=False)
|
RAW_PACKET_DISPLAY = config.getboolean("DEFAULT", "RAW_PACKET_DISPLAY", fallback=False)
|
||||||
|
KISS_INTERFACE = config.get("DEFAULT", "KISS_INTERFACE", fallback="TCP").upper()
|
||||||
|
SERIAL_PORT = config.get("DEFAULT", "SERIAL_PORT", fallback="/dev/rfcomm0")
|
||||||
|
SERIAL_BAUDRATE = config.getint("DEFAULT", "SERIAL_BAUDRATE", fallback=9600)
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
# This is the config file for the TC² APRS-BBS.
|
############################################################
|
||||||
# Edit the values below to customize the behavior of the system.
|
# #
|
||||||
|
# TC² APRS-BBS Configuration File #
|
||||||
|
# #
|
||||||
|
# Edit the values below to customize the behavior of the #
|
||||||
|
# system. Ensure all settings match your environment. #
|
||||||
|
# #
|
||||||
|
############################################################
|
||||||
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
|
|
||||||
|
# ================================[ CALLSIGNS ]=============================== #
|
||||||
|
|
||||||
# TACTICAL_CALL: The callsign of the BBS. This is the identifier used to communicate
|
# TACTICAL_CALL: The callsign of the BBS. This is the identifier used to communicate
|
||||||
# with the APRS network. This can be a Tactical Callsign (like BBS) or your ham radio
|
# with the APRS network. This can be a Tactical Callsign (like BBS) or your ham radio
|
||||||
# license callsign (WITH SSID). If using a tactical callsign, be sure to enter in your ham radio
|
# license callsign (WITH SSID). If using a tactical callsign, be sure to enter in your ham radio
|
||||||
@ -13,14 +22,49 @@ TACTICAL_CALL = BBS
|
|||||||
# If using your ham radio license call in the Tactical Call field, leave this as TC2BBS.
|
# If using your ham radio license call in the Tactical Call field, leave this as TC2BBS.
|
||||||
STANDARD_CALL = TC2BBS
|
STANDARD_CALL = TC2BBS
|
||||||
|
|
||||||
# KISS_HOST: The hostname or IP address of the KISS TNC (Terminal Node Controller)
|
|
||||||
# used for APRS communications. Typically, this is a local device or a remote server.
|
# ===============================[ CONNECTIONS ]============================== #
|
||||||
|
|
||||||
|
##############
|
||||||
|
# --SERIAL-- #
|
||||||
|
##############
|
||||||
|
|
||||||
|
# KISS_INTERFACE: Defines the type of connection to the KISS TNC (Terminal Node Controller).
|
||||||
|
# Options:
|
||||||
|
# - 'SERIAL': Connect via a physical serial port (e.g., USB-to-Serial adapter, Bluetooth serial).
|
||||||
|
# - 'TCP': Connect over a network using TCP/IP (for software TNCs like Direwolf).
|
||||||
|
KISS_INTERFACE = SERIAL
|
||||||
|
|
||||||
|
# SERIAL_PORT: Specifies the serial port device used for the serial connection.
|
||||||
|
# Example values:
|
||||||
|
# - Linux: /dev/ttyUSB0 (for USB serial devices) or /dev/rfcomm0 (for Bluetooth serial)
|
||||||
|
# - Windows: COM3, COM4 (depending on the connected device)
|
||||||
|
SERIAL_PORT = /dev/rfcomm0
|
||||||
|
|
||||||
|
# SERIAL_BAUDRATE: Sets the baud rate (communication speed) for the serial connection.
|
||||||
|
# Common baud rates:
|
||||||
|
# - 9600 (VGC VR-N76, BTECH UV-PRO, Kenwood TH-D75, Kenwood TH-D74)
|
||||||
|
SERIAL_BAUDRATE = 9600
|
||||||
|
|
||||||
|
|
||||||
|
###############
|
||||||
|
# --NETWORK-- #
|
||||||
|
###############
|
||||||
|
|
||||||
|
# KISS_HOST: The IP address or hostname of the KISS TNC server.
|
||||||
|
# Use '127.0.0.1' for localhost if the TNC software (e.g., Direwolf) is running on the same machine.
|
||||||
|
# For remote TNCs, provide the external IP address.
|
||||||
|
# This setting is **only used when KISS_INTERFACE is set to 'TCP'**.
|
||||||
KISS_HOST = 127.0.0.1
|
KISS_HOST = 127.0.0.1
|
||||||
|
|
||||||
# KISS_PORT: The port number used to connect to the KISS TNC.
|
# KISS_PORT: The TCP port number used to connect to the KISS TNC server.
|
||||||
# Ensure the port matches the configuration of your TNC.
|
# Default port for Direwolf is typically 8001, but this must match the configuration of your TNC.
|
||||||
|
# This setting is **only used when KISS_INTERFACE is set to 'TCP'**.
|
||||||
KISS_PORT = 8001
|
KISS_PORT = 8001
|
||||||
|
|
||||||
|
|
||||||
|
# =================================[ GENERAL ]================================ #
|
||||||
|
|
||||||
# BULLETIN_EXPIRATION_DAYS: The number of days after which bulletins will
|
# BULLETIN_EXPIRATION_DAYS: The number of days after which bulletins will
|
||||||
# automatically expire and be deleted from the database. Set to 0 to disable expiration.
|
# automatically expire and be deleted from the database. Set to 0 to disable expiration.
|
||||||
BULLETIN_EXPIRATION_DAYS = 7
|
BULLETIN_EXPIRATION_DAYS = 7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user