开放式滑翔机网络的python模块
ogn-client的Python项目详细描述
python ogn客户端
用于Open Glider Network的python3模块。 它可用于连接到ogn aprs服务器并解析aprs-/ogn消息。
ogn-python提供具有内置数据库的全功能网关。
安装
python ogn客户端在pypi上可用。因此,对于安装,只需使用pip:
pip install ogn-client
示例用法
解析aprs/ogn包。
from ogn.parser import parse
from datetime import datetime
beacon = parse("FLRDDDEAD>APRS,qAS,EDER:/114500h5029.86N/00956.98E'342/049/A=005524 id0ADDDEAD -454fpm -1.1rot 8.8dB 0e +51.2kHz gps4x5",
reference_timestamp=datetime(2015, 07, 31, 12, 34, 56))
连接到ogn并显示所有传入的信标。
from ogn.client import AprsClient
from ogn.parser import parse, ParseError
def process_beacon(raw_message):
try:
beacon = parse(raw_message)
print('Received {aprs_type}: {raw_message}'.format(**beacon))
except ParseError as e:
print('Error, {}'.format(e.message))
client = AprsClient(aprs_user='N0CALL')
client.connect()
try:
client.run(callback=process_beacon, autoreconnect=True)
except KeyboardInterrupt:
print('\nStop ogn gateway')
client.disconnect()
许可证
根据AGPLv3授权。