basic functioning web dashboard
This commit is contained in:
parent
5340e0b441
commit
944f1ce697
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
###############################################################################
|
||||
# HBLink - Copyright (C) 2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
@ -111,7 +111,7 @@ def decode_full(_data):
|
||||
binlc.extend([_data[68],_data[53],_data[174],_data[159],_data[144],_data[129],_data[114],_data[99],_data[84],_data[69],_data[54],_data[39]])
|
||||
binlc.extend([_data[24],_data[145],_data[130],_data[115],_data[100],_data[85],_data[70],_data[55],_data[40],_data[25],_data[10],_data[191]])
|
||||
return binlc
|
||||
|
||||
|
||||
|
||||
n_packet_assembly = 0
|
||||
|
||||
|
97
scripts/dashboard/dashboard.py
Normal file
97
scripts/dashboard/dashboard.py
Normal file
@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
###############################################################################
|
||||
# HBLink - Copyright (C) 2020 Cortney T. Buffington, N0MJS <n0mjs@me.com>
|
||||
# GPS/Data - Copyright (C) 2020 Eric Craw, KF7EEL <kf7eel@qsl.net>
|
||||
#
|
||||
# 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
|
||||
import ast, os
|
||||
|
||||
app = Flask(__name__)
|
||||
dash_entries = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read())
|
||||
#dash_bb = ast.literal_eval(os.popen('cat /tmp/gps_data_user_bb.txt').read())
|
||||
|
||||
def get_data():
|
||||
dash_loc = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read())
|
||||
dash_bb = ast.literal_eval(os.popen('cat /tmp/gps_data_user_bb.txt').read())
|
||||
tmp_bb = ''
|
||||
tmp_loc = ''
|
||||
tbl_hdr = '''
|
||||
<table style="border-color: black; margin-left: auto; margin-right: auto;" border="2" cellspacing="6" cellpadding="2"><tbody>
|
||||
'''
|
||||
tbl_ftr = '''
|
||||
</tbody>
|
||||
</table>
|
||||
'''
|
||||
bb_hdr = '''
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<h2><strong> Callsign </strong></h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>DMR ID</strong> </h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Bulletin</strong> </h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Local Time</strong> </h2>
|
||||
</td>
|
||||
</tr>
|
||||
'''
|
||||
loc_hdr = '''
|
||||
<tr>
|
||||
<td style="text-align: center;">
|
||||
<h2><strong> Callsign </strong></h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Latitude</strong> </h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Longitude</strong> </h2>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<h2> <strong>Local Time</strong> </h2>
|
||||
</td>
|
||||
</tr>
|
||||
'''
|
||||
|
||||
for e in dash_bb:
|
||||
tmp_bb = tmp_bb + '''<tr>
|
||||
<td style="text-align: center;"><strong> ''' + e['call'] + ''' </strong></td>
|
||||
<td style="text-align: center;">''' + str(e['dmr_id']) + '''</td>
|
||||
<td style="text-align: center;"><strong> ''' + e['bulliten'] + ''' </strong></td>
|
||||
<td style="text-align: center;"> ''' + e['time'] + ''' </td>
|
||||
</tr>'''
|
||||
for e in dash_loc:
|
||||
tmp_loc = tmp_loc + '''<tr>
|
||||
<td style="text-align: center;"><strong> ''' + e['call'] + ''' </strong></td>
|
||||
<td style="text-align: center;"> ''' + str(e['lat']) + ''' </td>
|
||||
<td style="text-align: center;"> ''' + str(e['lon']) + ''' </td>
|
||||
<td style="text-align: center;"> ''' + e['time'] + ''' </td>
|
||||
</tr>'''
|
||||
return str('<h1 style="text-align: center;">Bulletin Board</h1>' + tbl_hdr + bb_hdr + tmp_bb + tbl_ftr + str('<h1 style="text-align: center;">Positions Received</h1>') + tbl_hdr + loc_hdr + tmp_loc + tbl_ftr)
|
||||
|
||||
@app.route('/')
|
||||
def dash():
|
||||
#return 'Hello, World!'
|
||||
return get_data()
|
Loading…
Reference in New Issue
Block a user