-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
working on TCPKISSDevice #6
Comments
Okay, so KISS over TCP… that's not something I've tried, although in truth it's definitely something that should be implemented. I'll have to look at how to achieve this. I don't think using That said, it should still be possible to use the synchronous In your test script, I note you don't seem to create any sort of This is what I have in my code: # main.py
def main(): # pragma: no cover
# Okay, this is for pulling settings from a command line and config file… adapt for your needs
ap = argparse.ArgumentParser(description='aioax25 example')
ap.add_argument('config', help='Path to configuration file')
args = ap.parse_args()
config = yaml.load(open(args.config, 'r'))
# Event loop
loop = asyncio.get_event_loop()
# Set up logging
logging.config.dictConfig(config.pop('logging'))
log = logging.getLogger('rfidterm')
log.info('Starting up')
# Set up TNC interface
kiss_port = config['kiss'].pop('port', 0)
kiss = SerialKISSDevice( # in your case, TCPKISSDevice would be used.
loop=loop, log=log.getChild('kiss'),
**config['kiss']
)
kiss.open() # This starts the "open" process, which will continue when the IOLoop is started.
# Set up AX.25 interface
ax25int = AX25Interface(
kissport=kiss[kiss_port],
loop=loop, log=log.getChild('ax25'),
**config.get('ax25', {})
)
# Set up APRS message handler
aprs = APRSInterface(
ax25int,
log=log.getChild('aprs'),
**config['aprs']
)
# Set up digipeating handler (optional)
digi_enable = config.get('digi', {}).pop('enable', False)
digi = APRSDigipeater(log=log.getChild('digi'),
**config.get('digi', {}))
if digi_enable:
digi.connect(aprs)
# Set up signal handlers
def _shutdown():
log.info('Shut-down signal received')
# Do whatever you have to here to clean everything up!
kiss.close()
log.info('Waiting 5 seconds for final shut-down')
loop.call_later(5, loop.stop)
for sig in (signal.SIGINT, signal.SIGTERM, signal.SIGQUIT):
loop.add_signal_handler(sig, _shutdown)
# Enter the event loop
log.info('Entering event loop')
try:
loop.run_forever()
except KeyboardInterrupt:
# Perform whatever shutdown steps needed here.
pass
# in __main__.py
from .main import main
if __name__ == '__main__':
main() That |
Ohh, and the above, would use a configuration file that looks like this: aprs:
mycall: VK4MSL-1
#aprs_path: []
kiss: # here, you would put the parameters used by TCPKISSInterface… in this case, it's a serial interface to a port on a PocketBeagle which connects to a KPC3
device: /dev/ttyS4
baudrate: 9600
# Logging settings
# See https://docs.python.org/3/library/logging.config.html#logging-config-dictschema
logging:
version: 1
formatters:
detail:
format: '%(asctime)s %(name)s[%(filename)s:%(lineno)4d] %(levelname)s %(message)s'
handlers:
console:
formatter: detail
class: logging.StreamHandler
level: DEBUG
stream: ext://sys.stdout
root:
level: DEBUG
handlers:
- console |
Any chance you can do a formal release so I can use aioax25 from pypi with the new tcpkiss support? |
I'll have to schedule some time to give it a shot at some point. The last few weeks have been a bit of a battle getting free time to work on these projects. |
Release 0.0.10 includes these changes. |
I'm trying to wrap my head around how this package works.
I'm trying to use this to connect to direwolf's TCP KISS interface to recieve aprs messages.
I haven't quite figured out how the KISSPort maps to a TCP based kissdevice, but my test script looks like this.
But it just just and exits. How do I get this to loop forever waiting for packets to come in?
My TCPKISSDevice class looks like this:
The text was updated successfully, but these errors were encountered: