diff --git a/bridge.py b/bridge.py
index 40a5ada..421c0bd 100755
--- a/bridge.py
+++ b/bridge.py
@@ -1584,8 +1584,10 @@ if __name__ == '__main__':
stream_trimmer.addErrback(loopingErrHandle)
logger.info('Unit calls will be bridged to: ' + str(UNIT))
+
# Download burn list
- with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
- f.write(str(download_burnlist(CONFIG)))
+ if LOCAL_CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED']:
+ with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
+ f.write(str(download_burnlist(CONFIG)))
print(CONFIG['SYSTEMS'])
reactor.run()
diff --git a/config.py b/config.py
index 9a0f665..040821f 100755
--- a/config.py
+++ b/config.py
@@ -68,6 +68,9 @@ def acl_build(_acl, _max):
return(True, set((const.ID_MIN, _max)))
acl = [] #set()
+ print(type(_acl))
+ if type(_acl) == tuple:
+ _acl = ''.join(_acl)
sections = _acl.split(':')
if sections[0] == 'PERMIT':
diff --git a/data_gateway.py b/data_gateway.py
index 94c13e3..91a787c 100644
--- a/data_gateway.py
+++ b/data_gateway.py
@@ -65,6 +65,11 @@ import codecs
#Needed for working with NMEA
import pynmea2
+# Used with HTTP POST
+from hashlib import sha256
+import json, requests
+
+
# Modules for executing commands/scripts
import os
##from gps_functions import cmd_list
@@ -200,7 +205,7 @@ def aprs_send(packet):
AIS.sendall(packet)
logger.info('Packet sent to APRS-IS.')
-def dashboard_loc_write(call, lat, lon, time, comment):
+def dashboard_loc_write(call, lat, lon, time, comment, dmr_id):
if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
send_dash_loc(CONFIG, call, lat, lon, time, comment, dmr_id)
else:
@@ -543,7 +548,7 @@ def process_sms(_rf_src, sms, call_type):
try:
aprslib.parse(aprs_loc_packet)
aprs_send(aprs_loc_packet)
- dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, aprs_lat, aprs_lon, time(), comment)
+ dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, aprs_lat, aprs_lon, time(), comment, int_id(_rf_src))
#logger.info('Sent manual position to APRS')
except Exception as error_exception:
logger.info('Exception. Not uploaded')
@@ -1054,7 +1059,7 @@ def data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _fr
float(lon_deg) < 121
if int_id(_dst_id) == data_id:
aprs_send(aprs_loc_packet)
- dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, aprs_lat, aprs_lon, time(), comment)
+ dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, aprs_lat, aprs_lon, time(), comment, int_id(_rf_src))
#logger.info('Sent APRS packet')
except Exception as error_exception:
logger.info('Error. Failed to send packet. Packet may be malformed.')
@@ -1157,7 +1162,7 @@ def data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _fr
float(loc.lon)
if int_id(_dst_id) == data_id:
aprs_send(aprs_loc_packet)
- dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, str(loc.lat[0:7]) + str(loc.lat_dir), str(loc.lon[0:8]) + str(loc.lon_dir), time(), comment)
+ dashboard_loc_write(str(get_alias(int_id(_rf_src), subscriber_ids)) + '-' + ssid, str(loc.lat[0:7]) + str(loc.lat_dir), str(loc.lon[0:8]) + str(loc.lon_dir), time(), comment, int_id(_rf_src))
except Exception as error_exception:
logger.info('Failed to parse packet. Packet may be deformed. Not uploaded.')
logger.info(error_exception)
@@ -1268,6 +1273,7 @@ class OBP(OPENBRIDGE):
def svrd_received(self, _mode, _data):
print('SVRD RCV')
+ print(_mode)
if _mode == b'UNIT':
UNIT_MAP[_data] = (self._system, time())
print(UNIT_MAP)
diff --git a/hblink.py b/hblink.py
index 47d4a0b..55a3ba3 100755
--- a/hblink.py
+++ b/hblink.py
@@ -159,7 +159,7 @@ class OPENBRIDGE(DatagramProtocol):
logger.info('(%s) is mode OPENBRIDGE. No De-Registration required, continuing shutdown', self._system)
def send_system(self, _packet):
- if _packet[:4] == DMRD or _packet[:4] == EOBP or _packet[:4] == b'NOCK':
+ if _packet[:4] == DMRD or _packet[:4] == EOBP:
#_packet = _packet[:11] + self._config['NETWORK_ID'] + _packet[15:]
_packet = b''.join([_packet[:11], self._config['NETWORK_ID'], _packet[15:]])
#_packet += hmac_new(self._config['PASSPHRASE'],_packet,sha1).digest()
@@ -200,6 +200,7 @@ class OPENBRIDGE(DatagramProtocol):
_data = _packet[:53]
_hash = _packet[53:]
_ckhs = hmac_new(self._config['PASSPHRASE'],_data,sha1).digest()
+
if compare_digest(_hash, _ckhs) and _sockaddr == self._config['TARGET_SOCK']:
_peer_id = _data[11:15]
diff --git a/web/app.py b/web/app.py
index 91ef244..48e84e4 100644
--- a/web/app.py
+++ b/web/app.py
@@ -103,6 +103,12 @@ def convert_nato(string):
ns = ns + c + ' '
return ns
+# Convert APRS to map coordinates
+def aprs_to_latlon(x):
+ degrees = int(x) // 100
+ minutes = x - 100*degrees
+ return degrees + minutes/60
+
# Class-based application configuration
class ConfigClass(object):
from config import MAIL_SERVER, MAIL_PORT, MAIL_USE_SSL, MAIL_USE_TLS, MAIL_USERNAME, MAIL_PASSWORD, MAIL_DEFAULT_SENDER, USER_ENABLE_EMAIL, USER_ENABLE_USERNAME, USER_REQUIRE_RETYPE_PASSWORD, USER_ENABLE_CHANGE_USERNAME, USER_ENABLE_MULTIPLE_EMAILS, USER_ENABLE_CONFIRM_EMAIL, USER_ENABLE_REGISTER, USER_AUTO_LOGIN_AFTER_CONFIRM, USER_SHOW_USERNAME_DOES_NOT_EXIST
@@ -712,8 +718,43 @@ def create_app():
@app.route('/map')
@login_required
def map_page():
- print(peer_locations)
+ dev_loc = GPS_LocLog.query.order_by(GPS_LocLog.time.desc()).limit(300).all()
+ dev_list = []
f_map = folium.Map(location=center_map, zoom_start=map_zoom)
+ for i in dev_loc:
+ if i.callsign in dev_list:
+ pass
+ elif i.callsign not in dev_list:
+ dev_list.append(i.callsign)
+ lat = i.lat
+ lon = i.lon
+ if 'S' in i.lat:
+ lat = aprs_to_latlon(float(re.sub('[A-Za-z]','', i.lat)))
+ lat = -lat
+ if 'S' not in i.lat:
+ lat = aprs_to_latlon(float(re.sub('[A-Za-z]','', i.lat)))
+ if 'W' in i.lon:
+ lon = aprs_to_latlon(float(re.sub('[A-Za-z]','', i.lon)))
+ lon = -lon
+ if 'W' not in i.lon:
+ lon = aprs_to_latlon(float(re.sub('[A-Za-z]','', i.lon)))
+ folium.Marker([lat, lon], popup="""
+
+
+
+
+ """, icon=folium.Icon(color="blue", icon="record"), tooltip='' + i.callsign + '').add_to(f_map)
for l in peer_locations.items():
## folium.Marker([float(l[1][1]), float(l[1][2])], popup='''
##
+
+ Last Location:
+
+
+ """+ str(i.callsign) +"""
+
+
+
+ """+ str(i.time) +"""
+ """ + i.comment + """
+
+
+ Callsign+ |
+
+ Latitude+ |
+
+ Longitude+ |
+
+ Time+ |
+
+{% endblock %} diff --git a/web/templates/flask_user_layout.html b/web/templates/flask_user_layout.html index d41410b..db91d37 100644 --- a/web/templates/flask_user_layout.html +++ b/web/templates/flask_user_layout.html @@ -39,6 +39,7 @@ @@ -130,7 +131,7 @@