diff --git a/bridge_gps_data.py b/bridge_gps_data.py
index bde6475..ab28376 100755
--- a/bridge_gps_data.py
+++ b/bridge_gps_data.py
@@ -252,7 +252,6 @@ def user_setting_write(dmr_id, setting, value):
logger.info('Current settings: ' + str(user_dict))
if dmr_id not in user_dict:
user_dict[dmr_id] = [{'call': str(get_alias((dmr_id), subscriber_ids))}, {'ssid': ''}, {'icon': ''}, {'comment': ''}]
-
if setting.upper() == 'ICON':
user_dict[dmr_id][2]['icon'] = value
if setting.upper() == 'SSID':
@@ -261,6 +260,11 @@ def user_setting_write(dmr_id, setting, value):
user_comment = user_dict[dmr_id][3]['comment'] = value[0:35]
if setting.upper() == 'APRS':
user_dict[dmr_id] = [{'call': str(get_alias((dmr_id), subscriber_ids))}, {'ssid': ''}, {'icon': ''}, {'comment': ''}]
+ if setting.upper() == 'PIN':
+ try:
+ user_dict[dmr_id][4]['pin'] = value
+ except:
+ user_dict[dmr_id].append({'pin': value})
f.close()
logger.info('Loaded user settings. Preparing to write...')
# Write modified dict to file
@@ -270,11 +274,7 @@ def user_setting_write(dmr_id, setting, value):
logger.info('User setting saved')
f.close()
packet_assembly = ''
-## except:
-## logger.info('No data file found, creating one.')
-## #Path('./user_settings.txt').mkdir(parents=True, exist_ok=True)
-## Path('./user_settings.txt').touch()
-
+
# Process SMS, do something bases on message
def process_sms(_rf_src, sms):
@@ -288,6 +288,8 @@ def process_sms(_rf_src, sms):
user_setting_write(int_id(_rf_src), re.sub(' .*|@','',sms), re.sub('@SSID| ','',sms))
elif '@COM' in sms:
user_setting_write(int_id(_rf_src), re.sub(' .*|@','',sms), re.sub('@COM |@COM','',sms))
+ elif '@PIN' in sms:
+ user_setting_write(int_id(_rf_src), re.sub(' .*|@','',sms), int(re.sub('@PIN |@PIN','',sms)))
# Write blank entry to cause APRS receive to look for packets for this station.
elif '@APRS' in sms:
user_setting_write(int_id(_rf_src), 'APRS', '')
diff --git a/config.py b/config.py
index 21164bc..8cf29fd 100755
--- a/config.py
+++ b/config.py
@@ -279,7 +279,6 @@ def build_config(_config_file):
CONFIG['SYSTEMS'].update({section: {
'MODE': config.get(section, 'MODE'),
'ENABLED': config.getboolean(section, 'ENABLED'),
- 'APRS': config.getboolean(section, 'APRS'),
'REPEAT': config.getboolean(section, 'REPEAT'),
'MAX_PEERS': config.getint(section, 'MAX_PEERS'),
'IP': gethostbyname(config.get(section, 'IP')),
diff --git a/gps_data.py b/gps_data.py
index f968962..60acfaa 100644
--- a/gps_data.py
+++ b/gps_data.py
@@ -152,15 +152,41 @@ def aprs_send(packet):
AIS.sendall(packet)
AIS.close()
logger.info('Packet sent to APRS-IS.')
+# For future use
+##def position_timer(aprs_call):
+## dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
+## for i in dash_entries:
+## if aprs_call == i['call']:
+## if time.time()
+
def dashboard_loc_write(call, lat, lon, time, comment):
#try:
dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
# except:
# dash_entries = []
- dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time, 'comment': comment})
+ list_index = 0
+ call_count = 0
+ new_dash_entries = []
+ for i in dash_entries:
+ if i['call'] == call:
+ if call_count >= 25:
+ print(call_count)
+ pass
+
+ else:
+ new_dash_entries.append(i)
+ call_count = call_count + 1
+
+ if call != i['call']:
+ print('Record call: |' + i['call'] + '|')
+ print('Filter Call: |' + call + '|')
+ new_dash_entries.append(i)
+
+ pass
+ list_index = list_index + 1
with open(loc_file, 'w') as user_loc_file:
- user_loc_file.write(str(dash_entries[:200]))
+ user_loc_file.write(str(new_dash_entries[:500]))
user_loc_file.close()
logger.info('User location saved for dashboard')
#logger.info(dash_entries)
@@ -245,7 +271,6 @@ def user_setting_write(dmr_id, setting, value):
logger.info('Current settings: ' + str(user_dict))
if dmr_id not in user_dict:
user_dict[dmr_id] = [{'call': str(get_alias((dmr_id), subscriber_ids))}, {'ssid': ''}, {'icon': ''}, {'comment': ''}]
-
if setting.upper() == 'ICON':
user_dict[dmr_id][2]['icon'] = value
if setting.upper() == 'SSID':
@@ -254,6 +279,11 @@ def user_setting_write(dmr_id, setting, value):
user_comment = user_dict[dmr_id][3]['comment'] = value[0:35]
if setting.upper() == 'APRS':
user_dict[dmr_id] = [{'call': str(get_alias((dmr_id), subscriber_ids))}, {'ssid': ''}, {'icon': ''}, {'comment': ''}]
+ if setting.upper() == 'PIN':
+ try:
+ user_dict[dmr_id][4]['pin'] = value
+ except:
+ user_dict[dmr_id].append({'pin': value})
f.close()
logger.info('Loaded user settings. Preparing to write...')
# Write modified dict to file
@@ -263,11 +293,7 @@ def user_setting_write(dmr_id, setting, value):
logger.info('User setting saved')
f.close()
packet_assembly = ''
-## except:
-## logger.info('No data file found, creating one.')
-## #Path('./user_settings.txt').mkdir(parents=True, exist_ok=True)
-## Path('./user_settings.txt').touch()
-
+
# Process SMS, do something bases on message
def process_sms(_rf_src, sms):
@@ -281,6 +307,8 @@ def process_sms(_rf_src, sms):
user_setting_write(int_id(_rf_src), re.sub(' .*|@','',sms), re.sub('@SSID| ','',sms))
elif '@COM' in sms:
user_setting_write(int_id(_rf_src), re.sub(' .*|@','',sms), re.sub('@COM |@COM','',sms))
+ elif '@PIN' in sms:
+ user_setting_write(int_id(_rf_src), re.sub(' .*|@','',sms), int(re.sub('@PIN |@PIN','',sms)))
# Write blank entry to cause APRS receive to look for packets for this station.
elif '@APRS' in sms:
user_setting_write(int_id(_rf_src), 'APRS', '')
diff --git a/scripts/dashboard/dashboard.py b/scripts/dashboard/dashboard.py
index e3fd1c5..7fbdafd 100644
--- a/scripts/dashboard/dashboard.py
+++ b/scripts/dashboard/dashboard.py
@@ -60,7 +60,7 @@ def get_loc_data():
Longitude
- Local Time
+ Time
|
'''
@@ -101,13 +101,13 @@ def get_bb_data():
Callsign
- DMR ID
+ ID
|
Bulletin
|
- Local Time
+ Time
|
'''
@@ -178,6 +178,22 @@ def aprs_to_latlon(x):
minutes = x - 100*degrees
return degrees + minutes/60
+def user_setting_write(dmr_id, input_ssid, input_icon, input_comment):
+ dmr_id = int(dmr_id)
+ user_settings = ast.literal_eval(os.popen('cat ' + user_settings_file).read())
+ new_dict = user_settings
+ new_dict[dmr_id][1]['ssid'] = input_ssid
+ new_dict[dmr_id][2]['icon'] = input_icon
+ new_dict[dmr_id][3]['comment'] = input_comment
+ print(input_comment)
+ print(new_dict[dmr_id])
+
+ # Write modified dict to file
+ with open(user_settings_file, 'w') as user_dict_file:
+ user_dict_file.write(str(new_dict))
+ user_dict_file.close()
+
+
@app.route('/')
def index():
value = Markup('The HTML String')
@@ -206,6 +222,7 @@ def view_map():
map_size = request.args.get('map_size')
user_loc = ast.literal_eval(os.popen('cat ' + loc_file).read())
last_known_list = []
+ coord_list = []
try:
if track_call:
#folium_map = folium.Map(location=map_center, zoom_start=int(zoom_level))
@@ -320,6 +337,7 @@ def view_map():
if 'W' in user_coord['lon']:
user_lon = -user_lon
loc_comment = ''
+ coord_list.append([user_lat, user_lon])
if 'comment' in user_coord:
loc_comment = """
@@ -351,18 +369,21 @@ def view_map():
""", icon=folium.Icon(color="red", icon="record"), tooltip=str(user_coord['call'])).add_to(folium_map)
last_known_list.append(user_coord['call'])
if user_coord['call'] in last_known_list:
- folium.CircleMarker([user_lat, user_lon], popup="""
-
-
-
- """ + user_coord['call'] + """ |
-
-
- """ + loc_time + """ |
-
-
-
- """, tooltip=str(user_coord['call']), fill=True, fill_color="#3186cc", radius=4).add_to(marker_cluster)
+ if coord_list.count([user_lat, user_lon]) > 15:
+ pass
+ else:
+ folium.CircleMarker([user_lat, user_lon], popup="""
+
+
+
+ """ + user_coord['call'] + """ |
+
+
+ """ + loc_time + """ |
+
+
+
+ """, tooltip=str(user_coord['call']), fill=True, fill_color="#3186cc", radius=4).add_to(marker_cluster)
return folium_map._repr_html_()
@@ -370,37 +391,136 @@ def view_map():
def map():
return render_template('map.html', title = dashboard_title, logo = logo)
-@app.route('/user')
+@app.route('/user', methods = ['GET', 'POST'])
def user_settings():
+ user_settings = ast.literal_eval(os.popen('cat ' + user_settings_file).read())
user_id = request.args.get('user_id')
- if not user_id:
- user_result = """
- Use this tool to find and check the stored APRS settings for your DMR ID. When a position is sent, the stored settings will be used to format the APRS packet.
-