aprslib prepare
This commit is contained in:
parent
6fcbdad7c7
commit
9f6481b96a
@ -66,7 +66,7 @@ or `chmod a+x aprs.sh` and `./aprs.sh`
|
||||
## Run IRC Gateway
|
||||
|
||||
```shell
|
||||
pip install kiss3 irc
|
||||
pip install kiss3 irc aprslib
|
||||
|
||||
KISS_HOST=localhost KISS_PORT=8001 IRC_HOST=irc.example.com IRC_PORT=6697 CHANNEL_NAME="#example" BOT_NICK=aprs python3 aprs.py
|
||||
```
|
||||
|
8
aprs.py
8
aprs.py
@ -7,6 +7,7 @@ import irc.client_aio
|
||||
|
||||
from ax253 import Frame
|
||||
import kiss
|
||||
import aprslib
|
||||
|
||||
MYCALL = os.environ.get("MYCALL", "N0CALL")
|
||||
KISS_HOST = os.environ.get("KISS_HOST", "10.10.10.91")
|
||||
@ -18,7 +19,7 @@ channel = os.environ.get('CHANNEL_NAME', "#spau")
|
||||
nickname = os.environ.get('BOT_NICK', "aprsbot")
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logging.basicConfig(level=logging.DEBUG) ## TODO: Make logging level configurable
|
||||
|
||||
async def main():
|
||||
logger.info(f"Connecting to {server}:{port} as {nickname}")
|
||||
@ -38,6 +39,11 @@ async def main():
|
||||
irc_client.privmsg(channel, '[APRS] Starting...')
|
||||
|
||||
async for frame in kiss_protocol.read():
|
||||
try:
|
||||
packet = aprslib.parse(str(frame))
|
||||
except (aprslib.ParseError, aprslib.UnknownFormat) as exp:
|
||||
pass
|
||||
## TODO: Build APRS message from packet
|
||||
logger.debug(f"Received frame: {frame}")
|
||||
irc_client.privmsg(channel, str(frame)) ## TODO: Parse frame and send to channel
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user