Files
contact/interfaces.py
pdxlocations 6732180ca9 Major Refactor - Part 1 (#16)
* begin refactor

* continue refactor - notifications not working

* refactor - fix notif - chanels broken

* refactor - settings broken

* working refactor

* continue refactor

* remove unused import
2024-12-19 14:00:05 -08:00

17 lines
705 B
Python

import meshtastic.serial_interface
import meshtastic.tcp_interface
import meshtastic.ble_interface
import globals
def initialize_interface(args):
if args.ble:
return meshtastic.ble_interface.BLEInterface(args.ble if args.ble != "any" else None)
elif args.host:
return meshtastic.tcp_interface.TCPInterface(args.host)
else:
try:
return meshtastic.serial_interface.SerialInterface(args.port)
except PermissionError as ex:
print("You probably need to add yourself to the `dialout` group to use a serial connection.")
if globals.interface.devPath is None:
return meshtastic.tcp_interface.TCPInterface("meshtastic.local")