ampledata / kiss

A pure-Python implementation of the KISS Protocol for communicating with serial TNC devices for use with Amateur Radio.
Other
86 stars 36 forks source link

Adding socket connectivity #8

Open ytjohn opened 9 years ago

ytjohn commented 9 years ago

First off, I am not overly familiar with the KISS protocol - i'm just a user when it comes to that. But I've been wanting to connect to a ip-based TNC such as direwolf and interact with it from a python connection (ultimately resulting in a web interface).

To that end, I created this fork: https://github.com/ampledata/kiss/compare/master...ytjohn:socket?expand=1

And it did work, somewhat. I can write a message into the socket and the TNC will send it out over the air. However, I get some "garbage" characters when reading. If this was a serial port, my speed or stop bits would be wrong. But this is a socket connection (and it only impacts a portion of the message).

I captured some log of my attempts here.

Specifically:

[0L] KB3DFZ-5>APDW10,WIDE1-1,WIDE2-1:testing
[0L] KB3DFZ-5>APDW10,WIDE1-1:;444.200+R*111111z4000.80N/07833.25Wr444.200MHz T123 +500 k3nqt www.bcars.org

produces this:

�����b`���f����f��@@⮒��b@��;444.200+R*111111z4000.80N/07833.25Wr444.200MHz T123 +500 k3nqt www.bcars.org�
2015-04-03 21:59:52,843 DEBUG kiss.classes.read:158 - frame=����b`���f����f��@@⮒��b@��;444.200+R*111111z4000.80N/07833.25Wr444.200MHz T123 +500 k3nqt www.bcars.org

Would appreciate any insight towards what I need to do to get this to work. I most likely have to post-process this text in some way. Of course, once I get a handle on it, I plan to clean up the code, add some tests, and provide a PR back.

73s, KB3DFZ

ampledata commented 9 years ago

To decode the AX.25/APRS portion of those frames, check out my APRS Python Module.

An example of it's frame decoder is here: https://gist.github.com/ampledata/53ed5957a962bbaadc29

Which should output a Python Dict like:

{'text': '!3745.75NI12228.05W#W2GMD-6 Inner Sunset, SF iGate/Digipeater http://w2gmd.org', 'path': 'WIDE1-1', 'destination': 'APRX24', 'source': 'W2GMD-6'}