forked from hb9pae/RPI-iGate-LoRa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAPRS.py
67 lines (56 loc) · 1.42 KB
/
APRS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import logging
import aprslib
import pdb
import Config
def init() :
Config.AprsStat = "Not active"
Config.Login = 0
if (Config.EN_APRSIS) :
try :
Config.AIS = aprslib.IS(Config.CALL, Config.PASSCODE, port=14580)
Config.AIS.connect()
Config.Login += 1
except:
logging.info("APRS-IS upload failed")
logging.debug("APRS init() done")
"""
def sendMsg( msg ) :
logging.info("APRS Packet to sent: %s" , msg)
logging.info("MSG: %s", msg)
if (Config.EN_APRSIS) :
try :
AIS = aprslib.IS(Config.CALL, Config.PASSCODE, port=14580)
AIS.connect()
AIS.sendall(msg)
AIS.close()
Config.AprsStat = "Active"
Config.MsgSent +=1
except:
logging.info("APRS-IS upload failed")
else :
logging.debug("APRS-IS upload: %s", Config.EN_APRSIS)
Config.AprsStat = "Test"
Config.LastPkt = msg
"""
def sendMsg( msg ) :
logging.info("APRS Packet to sent: %s" , msg)
#logging.info("MSG: %s", msg)
if (Config.EN_APRSIS) :
#pdb.set_trace()
if not Config.AIS._connected :
Config.AIS = aprslib.IS(Config.CALL, Config.PASSCODE, port=14580)
Config.AIS.connect()
Config.Login += 1
logging.info("APRS-IS Login")
try :
Config.AIS.sendall(msg)
Config.AprsStat = "Active"
Config.MsgSent +=1
except:
logging.info("APRS-IS upload failed")
else :
logging.info("APRS-IS upload: %s", Config.EN_APRSIS)
Config.AprsStat = "Test"
Config.LastPkt = msg