Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/4.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ampledata committed Nov 11, 2016
2 parents 4d18b18 + 04979f8 commit 723bb47
Show file tree
Hide file tree
Showing 20 changed files with 666 additions and 230 deletions.
19 changes: 13 additions & 6 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
- Paul McMillan - https://github.com/PaulMcMillan
- Russ Innes
- John Hogenmiller KB3DFZ - https://github.com/ytjohn
- Phil Gagnon N1HHG
- Avi Solomon - https://github.com/genepool99
- Ben Benesh - https://github.com/bbene
- Joe Goforth
- Rick Eason
- Enrico - https://github.com/Enrico204
- Humphreybas - https://github.com/Humphreybas
- JDat - https://github.com/JDat
- Jay Nugent
- Joe Goforth
- John Hogenmiller KB3DFZ - https://github.com/ytjohn
- Paul McMillan - https://github.com/PaulMcMillan
- Pete Loveall AE5PL
- Phil Gagnon N1HHG
- Rick Eason
- Russ Innes
- agmuino - https://github.com/agmuino
- bgstewart - https://github.com/bgstewart
- darksidelemm - https://github.com/darksidelemm
- webbermr - https://github.com/webbermr
23 changes: 14 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Makefile for KISS Python Module.
#
# Source:: https://github.com/ampledata/kiss
# Author:: Greg Albrecht W2GMD <gba@orionlabs.io>
# Author:: Greg Albrecht W2GMD <oss@undef.net>
# Copyright:: Copyright 2016 Orion Labs, Inc. and Contributors
# License:: Apache License, Version 2.0
#
Expand All @@ -10,20 +10,25 @@
.DEFAULT_GOAL := all


all: install_requirements develop

develop:
python setup.py develop
all: develop

install_requirements:
pip install -r requirements.txt

install:
develop: remember
python setup.py develop

install: remember
python setup.py install

uninstall:
pip uninstall -y kiss

reinstall: uninstall install

remember:
@echo "Don't forget to 'make install_requirements'"

clean:
@rm -rf *.egg* build dist *.py[oc] */*.py[co] cover doctest_pypi.cfg \
nosetests.xml pylint.log output.xml flake8.log tests.log \
Expand All @@ -32,13 +37,13 @@ clean:
publish:
python setup.py register sdist upload

nosetests:
nosetests: remember
python setup.py nosetests

pep8: install_requirements
pep8: remember
flake8 --max-complexity 12 --exit-zero kiss/*.py tests/*.py

lint: install_requirements
lint: remember
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
-r n kiss/*.py tests/*.py || exit 0

Expand Down
12 changes: 9 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ Read & print frames from a TNC connected to '/dev/ttyUSB0' at 1200 baud::

import kiss

k = kiss.KISS('/dev/ttyUSB0', 1200)
k = kiss.SerialKISS('/dev/ttyUSB0', 1200)
k.start() # inits the TNC, optionally passes KISS config flags.
k.read(callback=print)
def p(x): print(x) # prints whatever is passed in.
k.read(callback=p) # reads frames and passes them to `p`.


See also: examples/ directory.
Expand Down Expand Up @@ -54,6 +55,11 @@ Master:
.. image:: https://travis-ci.org/ampledata/aprs.svg?branch=master
:target: https://travis-ci.org/ampledata/aprs

Develop:

.. image:: https://travis-ci.org/ampledata/aprs.svg?branch=develop
:target: https://travis-ci.org/ampledata/aprs


Source
======
Expand All @@ -62,7 +68,7 @@ https://github.com/ampledata/kiss

Author
======
Greg Albrecht W2GMD gba@orionlabs.io
Greg Albrecht W2GMD oss@undef.net

http://ampledata.org/

Expand Down
39 changes: 30 additions & 9 deletions examples/serial_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@
"""
Reads & Prints KISS frames from a Serial console.
For use with programs like Dire Wolf.
Mac OS X Tests
--------------
Soundflower, VLC & Dire Wolf as an audio-loopback-to-socket-bridge:
1. Select "Soundflower (2ch)" as Audio Output.
2. Play 'test_frames.wav' via VLC: `open -a vlc test_frames.wav`
3. Startup direwolf: `direwolf -p "Soundflower (2ch)"`
4. Run this script.
Dire Wolf as a raw-audio-input-to-socket-bridge:
1. Startup direwolf: `direwolf -p - < test_frames.wav`
2. Run this script.
Test output should be as follows:
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 1 of 4
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 2 of 4
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 3 of 4
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 4 of 4
"""


Expand All @@ -13,14 +36,12 @@

def print_frame(frame):
try:
print frame
# Decode raw APRS frame into dictionary of separate sections
decoded_frame = aprs.util.decode_frame(frame)

# Format the APRS frame (in Raw ASCII Text) as a human readable frame
formatted_aprs = aprs.util.format_aprs_frame(decoded_frame)
aprs_frame = aprs.APRSFrame(frame)

# This is the human readable APRS output:
print formatted_aprs
print aprs_frame

except Exception as ex:
print ex
Expand All @@ -29,10 +50,10 @@ def print_frame(frame):


def main():
ki = kiss.KISS(port='/dev/cu.AP510-DevB', speed='9600')
ki._logger.setLevel(logging.INFO)
ki = kiss.SerialKISS(port='/dev/cu.Repleo-PL2303-00303114', speed='9600')
#ki._logger.setLevel(logging.INFO)
ki.start()
ki.read(callback=print_frame)
ki.read(callback=print_frame, readmode=True)


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions examples/serial_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@


def main():
ki = aprs.APRSKISS(port='/dev/cu.AP510-DevB', speed='9600')
ki._logger.setLevel(logging.DEBUG)
ki = kiss.SerialKISS(port='/dev/cu.AP510-DevB', speed='9600')
#ki._logger.setLevel(logging.DEBUG)
ki.start()
frame = {
'source': 'W2GMD-14',
'destination': 'PYKISS',
'path': 'WIDE1-1',
'text': '`25mfs>/"3x}'
}
ki.write(frame)
ki.write(aprs.util.encode_frame(frame))


if __name__ == '__main__':
Expand Down
64 changes: 64 additions & 0 deletions examples/socket_read.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env python
"""
Reads & Prints KISS frames from a TCP Socket.
For use with programs like Dire Wolf.
Mac OS X Tests
--------------
Soundflower, VLC & Dire Wolf as an audio-loopback-to-socket-bridge:
1. Select "Soundflower (2ch)" as Audio Output.
2. Play 'test_frames.wav' via VLC: `open -a vlc test_frames.wav`
3. Startup direwolf: `direwolf "Soundflower (2ch)"`
4. Run this script.
Dire Wolf as a raw-audio-input-to-socket-bridge:
1. Startup direwolf: `direwolf - < test_frames.wav`
2. Run this script.
Test output should be as follows:
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 1 of 4
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 2 of 4
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 3 of 4
WB2OSZ-15>TEST:,The quick brown fox jumps over the lazy dog! 4 of 4
"""


import aprs
import kiss
import logging


def print_frame(frame):
try:
# Decode raw APRS frame into dictionary of separate sections
decoded_frame = aprs.util.decode_frame(frame[1:])

# Format the APRS frame (in Raw ASCII Text) as a human readable frame
formatted_aprs = aprs.util.format_aprs_frame(decoded_frame)

# This is the human readable APRS output:
print formatted_aprs

except Exception as ex:
print ex
print "Error decoding frame:"
print "\t%s" % frame


def main():
ki = kiss.TCPKISS(host='localhost', port=8001)
ki._logger.setLevel(logging.INFO)
ki.start()
ki.read(callback=print_frame)


if __name__ == '__main__':
main()
4 changes: 2 additions & 2 deletions examples/socketwrite.py → examples/socket_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


def main():
ki = aprs.APRSKISS(host='localhost', tcp_port=6666)
ki = kiss.TCPKISS(host='localhost', port=1234)
ki._logger.setLevel(logging.DEBUG)
ki.start()
frame = {
Expand All @@ -21,7 +21,7 @@ def main():
'path': 'WIDE1-1',
'text': '`25mfs>/"3x}'
}
ki.write(frame)
ki.write(aprs.util.encode_frame(frame))


if __name__ == '__main__':
Expand Down
39 changes: 0 additions & 39 deletions examples/socketread.py

This file was deleted.

26 changes: 6 additions & 20 deletions kiss/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,17 @@
~~~~
:author: Greg Albrecht W2GMD <gba@orionlabs.io>
:author: Greg Albrecht W2GMD <oss@undef.net>
:copyright: Copyright 2016 Orion Labs, Inc. and Contributors
:license: Apache License, Version 2.0
:source: <https://github.com/ampledata/kiss>
"""

__author__ = 'Greg Albrecht W2GMD <gba@orionlabs.io>'
from .classes import KISS, TCPKISS, SerialKISS # NOQA
from .util import (escape_special_codes, recover_special_codes, extract_ui, # NOQA
strip_df_start)

__author__ = 'Greg Albrecht W2GMD <oss@undef.net>'
__copyright__ = 'Copyright 2016 Orion Labs, Inc. and Contributors'
__license__ = 'Apache License, Version 2.0'


import logging

from .classes import KISS


# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
"""Default logging handler to avoid "No handler found" warnings."""
def emit(self, record):
"""Default logging handler to avoid "No handler found" warnings."""
pass

logging.getLogger(__name__).addHandler(NullHandler())

0 comments on commit 723bb47

Please sign in to comment.