diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py new file mode 100644 index 0000000..7fbdafd --- /dev/null +++ b/dashboard/dashboard.py @@ -0,0 +1,764 @@ +############################################################################### +# HBLink - Copyright (C) 2020 Cortney T. Buffington, N0MJS +# GPS/Data - Copyright (C) 2020 Eric Craw, KF7EEL +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################### + +''' +This is a web dashboard for the GPS/Data application. +''' + +from flask import Flask, render_template, request, Response, Markup +import ast, os +#from dashboard_settings import * +import folium +from folium.plugins import MarkerCluster +import re +from datetime import datetime +import argparse +from configparser import ConfigParser + + + +app = Flask(__name__) + + +tbl_hdr = ''' + +''' +tbl_ftr = ''' + +
+''' + +def get_loc_data(): + try: + dash_loc = ast.literal_eval(os.popen('cat ' + loc_file).read()) + tmp_loc = '' + loc_hdr = ''' + + +

 Callsign 

+ + +

 Latitude 

+ + +

 Longitude 

+ + +

 Time 

+ + + ''' + last_known_loc_list = [] + display_number = 15 + for e in dash_loc: + if display_number == 0: + break + else: + if e['call'] in last_known_loc_list: + pass + if e['call'] not in last_known_loc_list: + if type(e['time']) == str: + loc_time = str(e['time']) + if type(e['time']) == int or type(e['time']) == float: + loc_time = datetime.fromtimestamp(e['time']).strftime(time_format) + last_known_loc_list.append(e['call']) + display_number = display_number - 1 + tmp_loc = tmp_loc + ''' + ''' + e['call'] + ''' +  ''' + str(e['lat']) + '''  +  ''' + str(e['lon']) + '''  +  ''' + loc_time + '''  + ''' + return str(str('

Last Known Location

') + tbl_hdr + loc_hdr + tmp_loc + tbl_ftr) + except: + return str('

No data

') + + +def get_bb_data(): + try: + dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read()) + tmp_bb = '' + + bb_hdr = ''' + + +

 Callsign 

+ + +

 ID 

+ + +

 Bulletin 

+ + +

 Time 

+ + + ''' + display_number = 10 + + for e in dash_bb: + if display_number == 0: + break + else: + if type(e['time']) == str: + loc_time = str(e['time']) + if type(e['time']) == int or type(e['time']) == float: + loc_time = datetime.fromtimestamp(e['time']).strftime(time_format) + display_number = display_number - 1 + tmp_bb = tmp_bb + ''' +  ''' + e['call'] + '''  + ''' + str(e['dmr_id']) + ''' +  ''' + e['bulletin'] + '''  +  ''' + loc_time + '''  + ''' + + return str('

Bulletin Board

' + tbl_hdr + bb_hdr + tmp_bb + tbl_ftr) + except: + return str('

No data

') + +def check_emergency(): + # open emergency txt + try: + sos_file = ast.literal_eval(os.popen('cat ' + emergency_sos_file).read()) + if type(sos_file['time']) == str: + loc_time = str(sos_file['time']) + if type(sos_file['time']) == int or type(sos_file['time']) == float: + loc_time = datetime.fromtimestamp(sos_file['time']).strftime(time_format) + if '@NOTICE' in sos_file['message'] and '@SOS' not in sos_file['message']: + notice_header = 'NOTICE:' + else: + notice_header = 'EMERGENCY ACTIVATION' + value = Markup(""" +

""" + notice_header + """

+ + + + + + + + + + + + + + + +
From:""" + sos_file['call'] + """ - """ + str(sos_file['dmr_id']) + """
Message:""" + sos_file['message'] + """
Time:""" + loc_time + """
+

 

+ +

View on aprs.fi

+
+ + """) + return value + except Exception as e: + return '' + +def aprs_to_latlon(x): + degrees = int(x) // 100 + 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') + #return get_data() + return render_template('index.html', title = dashboard_title, logo = logo, emergency = check_emergency()) +@app.route('/bulletin_board') +def dash_bb(): + return get_bb_data() + #return render_template('index.html', data = str(get_data())) +@app.route('/positions') +def dash_loc(): + return get_loc_data() + +@app.route('/help/') +def help(): + #return get_data() + return render_template('help.html', title = dashboard_title, logo = logo, description = description, data_call_type = data_call_type, data_call_id = data_call_id, aprs_ssid = aprs_ssid) +@app.route('/about/') +def about(): + #return get_data() + return render_template('about.html', title = dashboard_title, logo = logo, contact_name = contact_name, contact_call = contact_call, contact_email = contact_email, contact_website = contact_website) +@app.route('/view_map') +def view_map(): + reload_time = request.args.get('reload') + track_call = request.args.get('track') + 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)) + #marker_cluster = MarkerCluster().add_to(folium_map) + for user_coord in user_loc: + user_lat = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lat']))) + user_lon = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lon']))) + if type(user_coord['time']) == str: + loc_time = str(user_coord['time']) + if type(user_coord['time']) == int or type(user_coord['time']) == float: + loc_time = datetime.fromtimestamp(user_coord['time']).strftime(time_format) + if 'S' in user_coord['lat']: + user_lat = -user_lat + if 'W' in user_coord['lon']: + user_lon = -user_lon + loc_comment = '' + if 'comment' in user_coord: + loc_comment = """ + + Comment: + + + """+ str(user_coord['comment']) +""" + """ + if user_coord['call'] not in last_known_list and user_coord['call'] == track_call: + folium_map = folium.Map(location=[user_lat, user_lon], tiles=map_theme, zoom_start=15) + marker_cluster = MarkerCluster().add_to(folium_map) + folium.Marker([user_lat, user_lon], popup=""" + + + + + + + + + + + """ + loc_comment + """ + + +
Last Location:
"""+ str(user_coord['call']) +"""
"""+ loc_time +"""
+
+ """, 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 and user_coord['call'] == track_call: + 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_() + if not reload_time: + reload_time = 120 + if not map_size: + map_view = ''' + + + + + +
+ ''' + folium_map._repr_html_() + '''
''' + if map_size == 'full': + map_view = folium_map._repr_html_() + + content = ''' + + + + """ + dashboard_title + """ - Tracking """+ track_call + """ + +

""" + dashboard_title + """ - Tracking """ + track_call + """

+

Page automatically reloads every """ + str(reload_time) + """ seconds.

+

+ +

+

+ """ + map_view + return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(content)) + except Exception as e: + content = """

Station not found.

+ #

+ #

""" + return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(content)) + + if not track_call: + folium_map = folium.Map(location=(map_center_lat, map_center_lon), tiles=map_theme, zoom_start=int(zoom_level)) + marker_cluster = MarkerCluster().add_to(folium_map) + for user_coord in user_loc: + user_lat = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lat']))) + user_lon = aprs_to_latlon(float(re.sub('[A-Za-z]','', user_coord['lon']))) + if type(user_coord['time']) == str: + loc_time = str(user_coord['time']) + if type(user_coord['time']) == int or type(user_coord['time']) == float: + loc_time = datetime.fromtimestamp(user_coord['time']).strftime(time_format) + if 'S' in user_coord['lat']: + user_lat = -user_lat + 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 = """ + + Comment: + + + """+ str(user_coord['comment']) +""" + """ + if user_coord['call'] not in last_known_list: + folium.Marker([user_lat, user_lon], popup=""" + + + + + + + + + + + + """ + loc_comment + """ + + + + +
Last Location:
""" + user_coord['call'] + """
""" + loc_time + """
Track Station
+ +
""", 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: + 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_() + +@app.route('/map/') +def map(): + return render_template('map.html', title = dashboard_title, logo = logo) + +@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 request.method == 'POST' and request.form.get('dmr_id'): + if int(request.form.get('dmr_id')) in user_settings: + user_id = request.form.get('dmr_id') + ssid = user_settings[int(request.form.get('dmr_id'))][1]['ssid'] + icon = user_settings[int(request.form.get('dmr_id'))][2]['icon'] + comment = user_settings[int(request.form.get('dmr_id'))][3]['comment'] + try: + pin = user_settings[int(request.form.get('dmr_id'))][4]['pin'] + if ssid == '': + ssid = aprs_ssid + if icon == '': + icon = '\[' + if comment == '': + comment = default_comment + ' ' + user_id + user_result = """ + Use this tool to change the stored APRS settings for your DMR ID. When a position is sent, the stored settings will be used to format the APRS packet. Leave field(s) blank for default value. +

 Modify Settings for ID: """ + user_id + """

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Callsign:""" + str(user_settings[int(user_id)][0]['call']) + """
SSID:
Icon:
Comment:
DMR ID:
PIN:
+

+
+

 

+ + + """ + except: + user_result = """

No PIN set for """ + str(user_settings[int(user_id)][0]['call']) + """ - """ + request.form.get('dmr_id') + """

+

+

""" + if int(request.form.get('dmr_id')) not in user_settings: + user_result = """

DMR ID not found.

+

+

""" + #if edit_user: + + if request.method == 'POST' and request.form.get('dmr_id') and request.form.get('pin'): + if int(request.form.get('pin')) == pin: + ssid = request.form.get('ssid') + icon = request.form.get('icon') + comment = request.form.get('comment') + user_setting_write(request.form.get('dmr_id'), request.form.get('ssid'), request.form.get('icon'), request.form.get('comment')) + user_result = """

Changed settings for """ + str(user_settings[int(user_id)][0]['call']) + """ - """ + request.form.get('dmr_id') + """

+

+

""" + if int(request.form.get('pin')) != pin: + user_result = """

Incorrect PIN.

+

+

""" + + if request.method == 'GET' and not request.args.get('user_id'): + user_result = """ + Use this tool to find, check, and change the stored APRS settings for your DMR ID. When a position is sent, the stored settings will be used to format the APRS packet. + + + + + + + +
+ + + + + + + + + + + + +
+

+
+
+ + + + + + + + + + + + +
+

+
+
+

 

+ + +""" + #else: + if request.method == 'GET' and request.args.get('user_id'): + try: + call = user_settings[int(user_id)][0]['call'] + ssid = user_settings[int(user_id)][1]['ssid'] + icon = user_settings[int(user_id)][2]['icon'] + comment = user_settings[int(user_id)][3]['comment'] + if ssid == '': + ssid = aprs_ssid + if icon == '': + icon = '\[' + if comment == '': + comment = default_comment + ' ' + user_id + #for result in user_settings: + #return user_settings[int(user_id)][0] + #return user_id + #return user_settings + user_result = """

 Settings for ID: """ + user_id + """

+ + + + + + + + + + + + + + + + + + + +
Callsign:""" + user_settings[int(user_id)][0]['call'] + """
SSID:""" + ssid + """
Icon:""" + icon + """
Comment:""" + comment + """
+

+

+ """ + except: + user_result = '''

User ID not found.

+

+

''' + + return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(user_result)) + +@app.route('/mailbox') +def mailbox(): + recipient = request.args.get('recipient') + if not recipient: + mail_content = """ +

The Mailbox is a place where users can leave messages via DMR SMS. A user can leave a message for someone else by sending a specially formatted SMS to """ + data_call_id + """. + The message recipient can then use the mailbox to check for messages. You can also check for APRS mesages addressed to your DMR radio. Enter your call sign (without APRS SSID) below to check for messages. See the help page for more information.

+
+ + + + + + + + + + + + +
+

+
+
+

 

+ +""" + + else: + mailbox_file = ast.literal_eval(os.popen('cat ' + the_mailbox_file).read()) + mail_content = '

Messages for: ' + recipient.upper() + ''' +

\n

\n +

Mailbox RSS Feed for ''' + recipient.upper() + '''

+ ''' + for messages in mailbox_file: + if messages['recipient'] == recipient.upper(): + sender = """ + + DMR ID: + """ + str(messages['dmr_id']) + """ + + """ + if type(messages['time']) == str: + loc_time = str(messages['time']) + if type(messages['time']) == int or type(messages['time']) == float: + loc_time = datetime.fromtimestamp(messages['time']).strftime(time_format) + if type(messages['dmr_id']) == str: + sender = """ + + APRS Call: + """ + str(messages['dmr_id']) + """ + + """ + mail_content = mail_content + """ + + + + + + + """ + sender + """ + + + + + + + + + +
From:""" + messages['call'] + """
Time:""" + loc_time + """
Message:""" + messages['message'] + """
+

 

+ + """ + return render_template('generic.html', title = dashboard_title, logo = logo, content = Markup(mail_content)) + + +@app.route('/bulletin_rss.xml') +def bb_rss(): + try: + dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read()) + post_data = '' + rss_header = """ + + + """ + dashboard_title + """ - Bulletin Board Feed + """ + rss_link + """ + This is the Bulletin Board feed from """ + dashboard_title + """""" + for entry in dash_bb: + if type(entry['time']) == str: + loc_time = str(entry['time']) + if type(entry['time']) == int or type(entry['time']) == float: + loc_time = datetime.fromtimestamp(entry['time']).strftime(time_format) + post_data = post_data + """ + + """ + entry['call'] + ' - ' + str(entry['dmr_id']) + """ + """ + rss_link + """ + """ + entry['bulletin'] + """ - """ + loc_time + """ + """ + datetime.fromtimestamp(entry['time']).strftime('%a, %d %b %y') +""" + + """ + return Response(rss_header + post_data + "\n\n", mimetype='text/xml') + except Exception as e: + #return str('

No data

') + return str(e) + +@app.route('/mailbox_rss') +def mail_rss(): + mailbox_file = ast.literal_eval(os.popen('cat ' + the_mailbox_file).read()) + post_data = '' + recipient = request.args.get('recipient').upper() + rss_header = """ + + + """ + dashboard_title + """ - Mailbox Feed for """ + recipient + """ + """ + rss_link + """ + This is a Mailbox feed from """ + dashboard_title + """ for """ + recipient + """.""" + for entry in mailbox_file: + if type(entry['time']) == str: + loc_time = str(entry['time']) + if type(entry['time']) == int or type(entry['time']) == float: + loc_time = datetime.fromtimestamp(entry['time']).strftime(time_format) + if entry['recipient'] == recipient: + post_data = post_data + """ + + """ + entry['call'] + ' - ' + str(entry['dmr_id']) + """ + """ + rss_link + """ + """ + entry['message'] + """ - """ + loc_time + """ + """ + datetime.fromtimestamp(entry['time']).strftime('%a, %d %b %y') +""" + + """ + return Response(rss_header + post_data + "\n\n", mimetype='text/xml') + +if __name__ == '__main__': + arg_parser = argparse.ArgumentParser() + arg_parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually gps_data.cfg)') + cli_args = arg_parser.parse_args() + parser = ConfigParser() + if not cli_args.CONFIG_FILE: + print('\n\nMust specify a config file with -c argument.\n\n') + parser.read(cli_args.CONFIG_FILE) + ###### Definitions ##### + # Title of the Dashboard + dashboard_title = parser.get('GPS_DATA', 'DASHBOARD_TITLE') + # Logo used on dashboard page + logo = parser.get('GPS_DATA', 'LOGO') + dash_port = int(parser.get('GPS_DATA', 'DASH_PORT')) + # IP to run server on + dash_host = parser.get('GPS_DATA', 'DASH_HOST') + #Description of dashboard to show on main page + description = parser.get('GPS_DATA', 'DESCRIPTION') + # The following will generate a help page for your users. + + # Data call type + if parser.get('GPS_DATA', 'CALL_TYPE') == 'unit': + data_call_type = 'Private Call' + if parser.get('GPS_DATA', 'CALL_TYPE') == 'group': + data_call_type = 'Group Call' + if parser.get('GPS_DATA', 'CALL_TYPE') == 'both': + data_call_type = 'Private or Group Call' + # DMR ID of GPS/Data application + data_call_id = parser.get('GPS_DATA', 'DATA_DMR_ID') + # Default APRS ssid + aprs_ssid = parser.get('GPS_DATA', 'USER_APRS_SSID') + + # Gateway contact info displayed on about page. + contact_name = parser.get('GPS_DATA', 'CONTACT_NAME') + contact_call = parser.get('GPS_DATA', 'CONTACT_CALL') + contact_email = parser.get('GPS_DATA', 'CONTACT_EMAIL') + contact_website = parser.get('GPS_DATA', 'CONTACT_WEBSITE') + + # Center dashboard map over these coordinates + map_center_lat = float(parser.get('GPS_DATA', 'MAP_CENTER_LAT')) + map_center_lon = float(parser.get('GPS_DATA', 'MAP_CENTER_LON')) + zoom_level = int(parser.get('GPS_DATA', 'ZOOM_LEVEL')) + map_theme = parser.get('GPS_DATA', 'MAP_THEME') + + # Time format for display + time_format = parser.get('GPS_DATA', 'TIME_FORMAT') + + # RSS feed link, shows in the link section of each RSS item. + rss_link = parser.get('GPS_DATA', 'RSS_LINK') + + # Default APRS comment for users. + default_comment = parser.get('GPS_DATA', 'USER_APRS_COMMENT') + + + # DO NOT MODIFY BELOW HERE. + bb_file = parser.get('GPS_DATA', 'BULLETIN_BOARD_FILE') + loc_file = parser.get('GPS_DATA', 'LOCATION_FILE') + emergency_sos_file = parser.get('GPS_DATA', 'EMERGENCY_SOS_FILE') + the_mailbox_file = parser.get('GPS_DATA', 'MAILBOX_FILE') + user_settings_file = parser.get('GPS_DATA', 'USER_SETTINGS_FILE') + ######################## + + app.run(debug = True, port=dash_port, host=dash_host) diff --git a/dashboard/dashboard_settings-SAMPLE.py b/dashboard/dashboard_settings-SAMPLE.py new file mode 100644 index 0000000..4560859 --- /dev/null +++ b/dashboard/dashboard_settings-SAMPLE.py @@ -0,0 +1,63 @@ +############################################################################### +# HBLink - Copyright (C) 2020 Cortney T. Buffington, N0MJS +# GPS/Data - Copyright (C) 2020 Eric Craw, KF7EEL +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################### + +''' +Settings for web dashboard. +''' + +# Title of the Dashboard +dashboard_title = 'HBLink3 D-APRS Dashboard' +# Logo used on dashboard page +logo = 'https://raw.githubusercontent.com/kf7eel/hblink3/gps/HBlink.png' +# Port to run server +dash_port = 8092 +# IP to run server on +dash_host = '127.0.0.1' +#Description of dashboard to show on main page +description = ''' +Welcome to the ''' + dashboard_title + '''. +''' +# The following will generate a help page for your users. + +# Data call type +data_call_type = 'Private Call' +# DMR ID of GPS/Data application +data_call_id = '9099' +# Default APRS ssid +aprs_ssid = '15' + +# Gateway contact info displayed on about page. +contact_name = 'your name' +contact_call = 'N0CALL' +contact_email = 'email@example.org' +contact_website = 'https://hbl.ink' + +# Time format for display +time_format = '%H:%M:%S - %m/%d/%y' + +# Center dashboard map over these coordinates +map_center = (47.00, -120.00) +zoom_level = 7 +# List and preview of some map themes at http://leaflet-extras.github.io/leaflet-providers/preview/ +# The following are options for map themes and just work, you should use one of these: “OpenStreetMap”, “Stamen” (Terrain, Toner, and Watercolor), +map_theme = 'Stamen Toner' + +# RSS feed link, shows in the link section of each RSS item. +rss_link = 'http://localhost:8092' + diff --git a/dashboard/templates/about.html b/dashboard/templates/about.html new file mode 100644 index 0000000..503f177 --- /dev/null +++ b/dashboard/templates/about.html @@ -0,0 +1,28 @@ +{% include 'page.html' %} +{% include 'header.html' %} +{{description}} +

 

+

Contact information for this gateway.

+ + + + + + + + + + + + + + + + + + + +
Name{{contact_name}}
Callsign {{contact_call}}
E-Mail {{contact_email}}
Website {{contact_website}}
+

 

+{% include 'footer.html' %} + diff --git a/dashboard/templates/footer.html b/dashboard/templates/footer.html new file mode 100644 index 0000000..722c511 --- /dev/null +++ b/dashboard/templates/footer.html @@ -0,0 +1,5 @@ +
+
+
Dashboard created by KF7EEL - https://github.com/kf7eel/hblink3
HBLink created by N0MJS.
HBLink GitHub page
This is branch: gps
+ + diff --git a/dashboard/templates/generic.html b/dashboard/templates/generic.html new file mode 100644 index 0000000..6e5b22c --- /dev/null +++ b/dashboard/templates/generic.html @@ -0,0 +1,5 @@ +{% include 'page.html' %} +{% include 'header.html' %} +{{content}} +{% include 'footer.html' %} + diff --git a/dashboard/templates/header.html b/dashboard/templates/header.html new file mode 100644 index 0000000..820086e --- /dev/null +++ b/dashboard/templates/header.html @@ -0,0 +1,17 @@ +

Logo

+

{{title}}

+
+ + + + + + + + + + + +
+
+ diff --git a/dashboard/templates/help.html b/dashboard/templates/help.html new file mode 100644 index 0000000..6afeae7 --- /dev/null +++ b/dashboard/templates/help.html @@ -0,0 +1,117 @@ +{% include 'page.html' %} +{% include 'header.html' %} +

Attention:

+

Please be aware that many (if not all) DMR radios DO NOT transmit your callsign when sending a GPS position. It is your responsibility to identify your station per the regulations of your country.

+

 

+

{{description}}

+

Configure your radio to send GPS positions with the following settings:

+ + + + + + + + + + + +
Data Call TypeDMR ID
 {{data_call_type}} {{data_call_id}}
+

 

+

When a position is received by this gateway, it will extract the coordinates and create an APRS position packet. This gateway will find your callsign based your radio's DMR ID. It is essential to have your information up to date with RadioID.net. A predefined APRS SSID of {{aprs_ssid}} is appended your callsign. The APRS location packet is then uploaded to APRS-IS. No setup or account creation is required beforehand. This is pretty much "plug and play."

+

For example, N0CALL has a DMR ID of 1234567. N0CALL's radio sends a position to this gateway with the call type settings above. This gateway will query the RadioID.net database for DMR ID 1234567. The result will be an APRS location packet with APRS SSID {{aprs_ssid}}.

+

You can change the default APRS settings for your radio via SMS.

+

Commands

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Command

+
+

Description

+
+

Example

+
@COMChange the comment of the APRS.@COM This is a test comment.
@ICONChange the icon of the APRS position. *See http://aprs.net/vm/DOS/SYMBOLS.HTM for icon list.@ICON /p
@SSIDChange SSID of your callsign.@SSID 7
@PINSet a PIN. This is used for changing your APRS settings ia the dashboard. You must set this for each DMR ID you wish to change via the dashboard.@PIN 1234
@MHSet you location by maidenhead grid square. Designed for radios with no GPS or that are not compatable yet.@MH DN97uk
@BBPost a bulliten to the web dashboard.@BB This is a test bulletin.
@[CALLSIGN W/ SSID] A-[MESSAGE]Send a message to another station via APRS.@N0CALL-15 A-This is a test.
[EMAIL ADDRESS] E-[MESSAGE]Send an email to an email address.test@example.org E-This is a test.
@[RECIPIENT CALLSIGN] M-[MESSAGE]Post a message to the Mailbox.@N0CALL M-This is a test.
@REM MAILRemove all mail addressed to you.@REM MAIL
@SOSEMERGENCY activation displays a banner on the main dashboard page.THIS IS AN EMERGENCY. @SOS
@NOTICEUsed to prominantly display a notice, similar to EMERGENCY activation.@NOTICE Server going down at 1800
@REM SOSRemoves an EMERGENCY or notice.@REM SOS
+

 

+

Commands should be in upper case. Send an SMS to {{data_call_id}} as a {{data_call_type}} with the desired command followed by the value. For example, to change your icon to a dog, the command would be @ICON /p (see the icon table for values). Changing your SSID is as simple as @SSID 7, and @COM Testing 123 will change the comment.

+

Sending @BB Test will result in a post to the bulletin board with the messaage of "Test".

+

To remove any of the stored values, just send the appropriate command without any input. @COM will remove the stored comment, @ICON will remove the stored icon, and @ICON will remove the strored icon. Any position reports sent will have the default settings.

+ +

EMERGENCY Activation

+

The EMERGENCY Activation function will display a prominant banner accross the main dashboard page. The banner contains a message, time, callsign of station, and a link to the last known location of the station. This feature is intended to be used in situations where a user is in distress. To trigger an EMERGENCY activation, simply send an SMS to {{data_call_id}} with @SOS in the message. The @SOS command can be anywhere in the message. A less intimidating banner can be displayed for testing, or other purposes, by using @NOTICE. To remove the EMERGENCY activation, simply send the @REM SOS command.

+

The Map

+

This dashboard now has a built in map. The map will display the last know location of stations and some previous plots from them. You can track a station by clicking on the red pin, and selecting the Track Station link. When tracking a station, you have a few options for a refresh rate, located in a drop down menu.

+

The Mailbox

+

The Mailbox is a place where users can leave messages via DMR SMS. A user can leave a message for someone else by sending a formatted SMS to {{data_call_id}}. See the table above for a syntax example of posting a message to the Mailbox. The message recipient can then use the mailbox to check for messages. Message recipients can delete all of their messages by sending the command @REM MAIL. There is no way to remove a single message, it's all or none.

+ +{% include 'footer.html' %} diff --git a/dashboard/templates/index.html b/dashboard/templates/index.html new file mode 100644 index 0000000..bbd02d1 --- /dev/null +++ b/dashboard/templates/index.html @@ -0,0 +1,49 @@ + + + + + + {{title}} + + +
+ +{% include 'header.html' %} +{{emergency}} +

Page automatically reloads every 2 minutes.

+

Bulletin Board RSS Feed

+ + + + + + + +

+

+
+ {% include 'footer.html' %} + diff --git a/dashboard/templates/map.html b/dashboard/templates/map.html new file mode 100644 index 0000000..35e169f --- /dev/null +++ b/dashboard/templates/map.html @@ -0,0 +1,8 @@ +{% include 'page.html' %} +{% include 'header.html' %} +

Red: Last location received. Blue: Location history.

+

 

+

+

 

+{% include 'footer.html' %} + diff --git a/dashboard/templates/page.html b/dashboard/templates/page.html new file mode 100644 index 0000000..1c67ad4 --- /dev/null +++ b/dashboard/templates/page.html @@ -0,0 +1,22 @@ + + + + + {{title}} + + +
+