This commit is contained in:
KF7EEL 2021-03-04 16:31:54 -08:00
parent 239c0730c0
commit 2e5dec5cac
4 changed files with 8 additions and 18 deletions

View File

@ -44,7 +44,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, aprs_upload, sendAprs
from hblink import HBSYSTEM, OPENBRIDGE, systems, hblink_handler, reportFactory, REPORT_OPCODES, mk_aliases
from dmr_utils3.utils import bytes_3, int_id, get_alias
from dmr_utils3 import decode, bptc, const
import config
@ -245,7 +245,7 @@ def decdeg2dms(dd):
def user_setting_write(dmr_id, setting, value):
## try:
# Open file and load as dict for modification
with open("./user_settings.txt", 'r') as f:
with open(user_settings_file, 'r') as f:
## if f.read() == '{}':
## user_dict = {}
user_dict = ast.literal_eval(f.read())
@ -264,7 +264,7 @@ def user_setting_write(dmr_id, setting, value):
f.close()
logger.info('Loaded user settings. Preparing to write...')
# Write modified dict to file
with open("./user_settings.txt", 'w') as user_dict_file:
with open(user_settings_file, 'w') as user_dict_file:
user_dict_file.write(str(user_dict))
user_dict_file.close()
logger.info('User setting saved')
@ -1898,7 +1898,7 @@ if __name__ == '__main__':
systems[system] = routerHBP(system, CONFIG, report_server)
reactor.listenUDP(CONFIG['SYSTEMS'][system]['PORT'], systems[system], interface=CONFIG['SYSTEMS'][system]['IP'])
logger.debug('(GLOBAL) %s instance created: %s, %s', CONFIG['SYSTEMS'][system]['MODE'], system, systems[system])
aprs_upload(CONFIG)
#aprs_upload(CONFIG)
def loopingErrHandle(failure):
logger.error('(GLOBAL) STOPPING REACTOR TO AVOID MEMORY LEAK: Unhandled error in timed loop.\n %s', failure)

View File

@ -106,7 +106,6 @@ def build_config(_config_file):
CONFIG['GLOBAL'] = {}
CONFIG['REPORTS'] = {}
CONFIG['LOGGER'] = {}
CONFIG['APRS'] = {}
CONFIG['GPS_DATA'] = {}
CONFIG['ALIASES'] = {}
CONFIG['SYSTEMS'] = {}
@ -184,15 +183,6 @@ def build_config(_config_file):
'STALE_TIME': config.getint(section, 'STALE_DAYS') * 86400,
})
elif section == 'APRS':
CONFIG['APRS'].update({
'ENABLED': config.getboolean(section, 'ENABLED'),
'CALLSIGN': config.get(section, 'CALLSIGN'),
'REPORT_INTERVAL': config.getint(section, 'REPORT_INTERVAL'),
'SERVER': config.get(section, 'SERVER'),
'MESSAGE': config.get(section, 'MESSAGE')
})
elif config.getboolean(section, 'ENABLED'):
if config.get(section, 'MODE') == 'PEER':
CONFIG['SYSTEMS'].update({section: {

View File

@ -238,7 +238,7 @@ def decdeg2dms(dd):
def user_setting_write(dmr_id, setting, value):
## try:
# Open file and load as dict for modification
with open("./user_settings.txt", 'r') as f:
with open(user_settings_file, 'r') as f:
## if f.read() == '{}':
## user_dict = {}
user_dict = ast.literal_eval(f.read())
@ -257,7 +257,7 @@ def user_setting_write(dmr_id, setting, value):
f.close()
logger.info('Loaded user settings. Preparing to write...')
# Write modified dict to file
with open("./user_settings.txt", 'w') as user_dict_file:
with open(user_settings_file, 'w') as user_dict_file:
user_dict_file.write(str(user_dict))
user_dict_file.close()
logger.info('User setting saved')

View File

@ -34,7 +34,7 @@ def mailbox_write(call, dmr_id, time, message, recipient):
def aprs_filter(packet):
user_settings = ast.literal_eval(os.popen('cat ../../user_settings.txt').read())
user_settings = ast.literal_eval(os.popen('cat ' + user_settings_file).read())
if 'addresse' in aprslib.parse(packet):
#print(aprslib.parse(packet))
recipient = re.sub('-.*','', aprslib.parse(packet)['addresse'])
@ -71,7 +71,7 @@ if __name__ == '__main__':
user_settings_file = mailbox_file = parser.get('GPS_DATA', 'USER_SETTINGS_FILE')
AIS = aprslib.IS(aprs_login, passwd=int(aprs_passcode), host=aprs_server, port=int(aprs_port))
user_settings = ast.literal_eval(os.popen('cat ../../user_settings.txt').read())
user_settings = ast.literal_eval(os.popen('cat ' + user_settings_file).read())
print('APRS message receive script for GPS/Data Application.\nAuthor: Eric, KF7EEL - kf7eel@qsl.net')
AIS.set_filter(parser.get('GPS_DATA', 'APRS_FILTER'))
AIS.connect()