mirror of https://github.com/kf7eel/hbnet.git
fix PEER folder creation, adjust CSBK to 1 block, add error for *MH
This commit is contained in:
parent
1c60c525fe
commit
0872ca716e
|
|
@ -172,7 +172,7 @@ def sms_format_retrieve(sub):
|
||||||
def mqtt_main(mqtt_user, mqtt_pass, mqtt_user2, mqtt_pass2, broker_url = 'localhost', broker_port = 1883, broker_url2 = 'localhost', broker_port2 = 1883):
|
def mqtt_main(mqtt_user, mqtt_pass, mqtt_user2, mqtt_pass2, broker_url = 'localhost', broker_port = 1883, broker_url2 = 'localhost', broker_port2 = 1883):
|
||||||
global mqtt_client, mqtt_client2
|
global mqtt_client, mqtt_client2
|
||||||
if broker_url2 != '':
|
if broker_url2 != '':
|
||||||
logger.info('Enabling MQTT Server 22')
|
logger.info('Enabling MQTT Server 2')
|
||||||
mqtt_client2 = mqtt.Client(client_id = mqtt_shortcut_gen + '-' + str(random.randint(1,99)))
|
mqtt_client2 = mqtt.Client(client_id = mqtt_shortcut_gen + '-' + str(random.randint(1,99)))
|
||||||
elif broker_url2 == '':
|
elif broker_url2 == '':
|
||||||
mqtt_client2 = ''
|
mqtt_client2 = ''
|
||||||
|
|
@ -913,8 +913,8 @@ def process_sms(_rf_src, sms, call_type, system_name):
|
||||||
elif '*MH' in parse_sms[0]:
|
elif '*MH' in parse_sms[0]:
|
||||||
grid_square = parse_sms[1]
|
grid_square = parse_sms[1]
|
||||||
if len(grid_square) < 6:
|
if len(grid_square) < 6:
|
||||||
pass
|
send_sms(False, int_id(_rf_src), data_id[0], data_id[0], 'unit', 'Grid square needs to be 6 characters.')
|
||||||
else:
|
elif len(grid_square) > 5:
|
||||||
lat = decdeg2dms(mh.to_location(grid_square)[0])
|
lat = decdeg2dms(mh.to_location(grid_square)[0])
|
||||||
lon = decdeg2dms(mh.to_location(grid_square)[1])
|
lon = decdeg2dms(mh.to_location(grid_square)[1])
|
||||||
|
|
||||||
|
|
@ -1134,7 +1134,7 @@ def csbk_gen2(to_id, from_id, tot_block):
|
||||||
csbk_lst = []
|
csbk_lst = []
|
||||||
csbk_pk = 'BD0080'
|
csbk_pk = 'BD0080'
|
||||||
csbk_n = 0
|
csbk_n = 0
|
||||||
csbk_tot = 2
|
csbk_tot = 1
|
||||||
while csbk_n < csbk_tot:
|
while csbk_n < csbk_tot:
|
||||||
csbk_lst.append(csbk_pk)
|
csbk_lst.append(csbk_pk)
|
||||||
csbk_n = csbk_n + 1
|
csbk_n = csbk_n + 1
|
||||||
|
|
@ -2258,6 +2258,11 @@ if __name__ == '__main__':
|
||||||
aprs_thread = threading.Thread(target=aprs_rx, args=(aprs_callsign, aprs_passcode, aprs_server, aprs_port, aprs_filter, user_ssid,))
|
aprs_thread = threading.Thread(target=aprs_rx, args=(aprs_callsign, aprs_passcode, aprs_server, aprs_port, aprs_filter, user_ssid,))
|
||||||
aprs_thread.daemon = True
|
aprs_thread.daemon = True
|
||||||
aprs_thread.start()
|
aprs_thread.start()
|
||||||
|
# Create folder so hbnet.py can access list PEER connections
|
||||||
|
if Path('/tmp/' + (CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/')).exists():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
Path('/tmp/' + (CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/')).mkdir()
|
||||||
reactor.run()
|
reactor.run()
|
||||||
|
|
||||||
# John 3:16 - For God so loved the world, that he gave his only Son,
|
# John 3:16 - For God so loved the world, that he gave his only Son,
|
||||||
|
|
|
||||||
|
|
@ -96,10 +96,12 @@ def decrypt_packet(key, message):
|
||||||
|
|
||||||
def write_peer_file(master, peer_dict, CONFIG):
|
def write_peer_file(master, peer_dict, CONFIG):
|
||||||
# Pull stuff for aprs out
|
# Pull stuff for aprs out
|
||||||
print(peer_dict)
|
if Path('/tmp/' + CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/' + master).is_file():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
Path('/tmp/' + CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/' + master).touch()
|
||||||
new_peers = {}
|
new_peers = {}
|
||||||
for d in peer_dict.items():
|
for d in peer_dict.items():
|
||||||
print(d[1])
|
|
||||||
new_peers[int_id(d[0])] = {'call': str(d[1]['CALLSIGN'].decode('utf-8')).strip(' '), 'lat':str(d[1]['LATITUDE'].decode('utf-8')), 'lon':str(d[1]['LONGITUDE'].decode('utf-8')), 'description':str(d[1]['DESCRIPTION'].decode('utf-8'))}
|
new_peers[int_id(d[0])] = {'call': str(d[1]['CALLSIGN'].decode('utf-8')).strip(' '), 'lat':str(d[1]['LATITUDE'].decode('utf-8')), 'lon':str(d[1]['LONGITUDE'].decode('utf-8')), 'description':str(d[1]['DESCRIPTION'].decode('utf-8'))}
|
||||||
with open('/tmp/' + CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/' + master, 'w') as peer_file:
|
with open('/tmp/' + CONFIG['LOGGER']['LOG_NAME'] + '_PEERS/' + master, 'w') as peer_file:
|
||||||
peer_file.write(str(new_peers))
|
peer_file.write(str(new_peers))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue