improve APRS per master config
This commit is contained in:
parent
cae4ad03d8
commit
88a791ee7b
@ -42,7 +42,7 @@ from twisted.protocols.basic import NetstringReceiver
|
||||
from twisted.internet import reactor, task
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
|
||||
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases, aprs_upload
|
||||
from dmr_utils3.utils import bytes_3, int_id, get_alias
|
||||
from dmr_utils3 import decode, bptc, const
|
||||
import config
|
||||
@ -1183,6 +1183,8 @@ if __name__ == '__main__':
|
||||
logger.info('(REPORT) TCP Socket reporting not configured')
|
||||
|
||||
# HBlink instance creation
|
||||
# Run aprs_upload loop
|
||||
aprs_upload()
|
||||
logger.info('(GLOBAL) HBlink \'bridge.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
|
@ -46,7 +46,7 @@ from twisted.protocols.basic import NetstringReceiver
|
||||
from twisted.internet import reactor, task
|
||||
|
||||
# Things we import from the main hblink module
|
||||
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, config_reports, mk_aliases, acl_check
|
||||
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, config_reports, mk_aliases, acl_check, aprs_upload
|
||||
from dmr_utils3.utils import bytes_3, int_id, get_alias
|
||||
from dmr_utils3 import decode, bptc, const
|
||||
import config
|
||||
@ -281,6 +281,8 @@ if __name__ == '__main__':
|
||||
report_server = config_reports(CONFIG, reportFactory)
|
||||
|
||||
# HBlink instance creation
|
||||
# Run aprs_upload loop
|
||||
aprs_upload()
|
||||
logger.info('HBlink \'bridge_all.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
|
@ -280,7 +280,7 @@ def build_config(_config_file):
|
||||
CONFIG['SYSTEMS'].update({section: {
|
||||
'MODE': config.get(section, 'MODE'),
|
||||
'ENABLED': config.getboolean(section, 'ENABLED'),
|
||||
'APRS_ENABLED': config.getboolean(section, 'APRS_ENABLED'),
|
||||
'APRS': config.getboolean(section, 'APRS'),
|
||||
'REPEAT': config.getboolean(section, 'REPEAT'),
|
||||
'MAX_PEERS': config.getint(section, 'MAX_PEERS'),
|
||||
'IP': gethostbyname(config.get(section, 'IP')),
|
||||
|
@ -167,7 +167,7 @@ TGID_ACL: PERMIT:ALL
|
||||
[MASTER-1]
|
||||
MODE: MASTER
|
||||
ENABLED: True
|
||||
APRS_ENABLED: False
|
||||
APRS: False
|
||||
REPEAT: True
|
||||
MAX_PEERS: 10
|
||||
EXPORT_AMBE: False
|
||||
|
24
hblink.py
24
hblink.py
@ -74,10 +74,12 @@ systems = {}
|
||||
|
||||
open("nom_aprs","w").close
|
||||
|
||||
file_config=config.build_config('hblink.cfg')
|
||||
#file_config=config.build_config('hblink.cfg')
|
||||
|
||||
CONFIG = ''
|
||||
|
||||
def sendAprs():
|
||||
AIS = aprslib.IS(str(file_config['APRS']['CALLSIGN']), passwd=aprslib.passcode(str(file_config['APRS']['CALLSIGN'])), host=str(file_config['APRS']['SERVER']), port=14580)
|
||||
AIS = aprslib.IS(str(CONFIG['APRS']['CALLSIGN']), passwd=aprslib.passcode(str(CONFIG['APRS']['CALLSIGN'])), host=str(CONFIG['APRS']['SERVER']), port=14580)
|
||||
AIS.connect()
|
||||
f = open('nom_aprs', 'r')
|
||||
lines = f.readlines()
|
||||
@ -141,16 +143,14 @@ def sendAprs():
|
||||
rx_utile = dati[2][0:3]+'.'+dati[2][3:]
|
||||
tx_utile = dati[3][0:3]+'.'+dati[3][3:]
|
||||
|
||||
if self._config['APRS']['ENABLED']:
|
||||
AIS.sendall(str(dati[0])+">APRS,TCPIP*,qAC,"+str(file_config['APRS']['CALLSIGN'])+":!"+str(lat_utile)[:-2]+lat_verso+"/"+str(lon_utile)[:-1]+lon_verso+"r"+str(file_config['APRS']['MESSAGE'])+' RX: '+str(rx_utile)+' TX: '+str(tx_utile))
|
||||
AIS.sendall(str(dati[0])+">APRS,TCPIP*,qAC,"+str(CONFIG['APRS']['CALLSIGN'])+":!"+str(lat_utile)[:-2]+lat_verso+"/"+str(lon_utile)[:-1]+lon_verso+"r"+str(CONFIG['APRS']['MESSAGE'])+' RX: '+str(rx_utile)+' TX: '+str(tx_utile))
|
||||
logging.info('APRS INVIATO/APRS Sent')
|
||||
else:
|
||||
pass
|
||||
|
||||
if file_config['APRS']['ENABLED']:
|
||||
if int(file_config['APRS']['REPORT_INTERVAL']) >= 10:
|
||||
def aprs_upload():
|
||||
if CONFIG['APRS']['ENABLED']:
|
||||
if int(CONFIG['APRS']['REPORT_INTERVAL']) >= 10:
|
||||
l=task.LoopingCall(sendAprs)
|
||||
l.start(int(file_config['APRS']['REPORT_INTERVAL'])*60)
|
||||
l.start(int(CONFIG['APRS']['REPORT_INTERVAL'])*60)
|
||||
else:
|
||||
l=task.LoopingCall(sendAprs)
|
||||
l.start(15*60)
|
||||
@ -568,7 +568,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
and self._peers[_peer_id]['SOCKADDR'] == _sockaddr:
|
||||
logger.info('(%s) Peer is closing down: %s (%s)', self._system, self._peers[_peer_id]['CALLSIGN'], int_id(_peer_id))
|
||||
self.transport.write(b''.join([MSTNAK, _peer_id]), _sockaddr)
|
||||
if self._CONFIG['APRS']['ENABLED']:
|
||||
if self._CONFIG['SYSTEMS'][self._system]['APRS']:
|
||||
#if self._config['APRS_ENABLED'] == True:
|
||||
fn = 'nom_aprs'
|
||||
f = open(fn)
|
||||
@ -612,7 +612,7 @@ class HBSYSTEM(DatagramProtocol):
|
||||
lista_blocco=['ysf', 'xlx', 'nxdn', 'dstar', 'echolink','p25', 'svx', 'l1nk']
|
||||
#if self._CONFIG['SYSTEMS']['APRS_ENABLED']['ENABLED'] and self._CONFIG['APRS']['ENABLED'] and not str(_this_peer['CALLSIGN'].decode('UTF-8')).replace(' ', '').isalpha() :
|
||||
# Check if master has APRS enabled instead of global.
|
||||
if self._CONFIG['APRS']['ENABLED'] and not str(_this_peer['CALLSIGN'].decode('UTF-8')).replace(' ', '').isalpha() :
|
||||
if self._CONFIG['SYSTEMS'][self._system]['APRS'] and not str(_this_peer['CALLSIGN'].decode('UTF-8')).replace(' ', '').isalpha() :
|
||||
file = open("nom_aprs","r")
|
||||
linee = file.readlines()
|
||||
file.close()
|
||||
@ -962,6 +962,8 @@ if __name__ == '__main__':
|
||||
logger.info('(REPORT) TCP Socket reporting not configured')
|
||||
|
||||
# HBlink instance creation
|
||||
# Run aprs_upload loop
|
||||
aprs_upload()
|
||||
logger.info('(GLOBAL) HBlink \'HBlink.py\' -- SYSTEM STARTING...')
|
||||
for system in CONFIG['SYSTEMS']:
|
||||
if CONFIG['SYSTEMS'][system]['ENABLED']:
|
||||
|
Loading…
Reference in New Issue
Block a user