From ddc8194bd690ba066648a9c01a8d2ab75a1ae4cd Mon Sep 17 00:00:00 2001 From: Xavier Date: Fri, 2 Dec 2022 13:27:53 +0100 Subject: [PATCH] first commit --- README.md | 27 + .../dashboard_settings.cpython-310.pyc | Bin 0 -> 706 bytes .../dashboard_settings.cpython-38.pyc | Bin 0 -> 703 bytes dashboard/dashboard.py | 131 +++ dashboard/dashboard_settings-SAMPLE.py | 49 ++ dashboard/dashboard_settings.py | 49 ++ dashboard/templates/about.html | 29 + dashboard/templates/footer.html | 5 + dashboard/templates/header.html | 14 + dashboard/templates/help.html | 96 +++ dashboard/templates/index.html | 160 ++++ dashboard/templates/page.html | 137 +++ gps_data-SAMPLE.cfg | 242 ++++++ gps_data.cfg | 287 +++++++ gps_data.py | 804 ++++++++++++++++++ gps_data_igate_beacon.py | 60 ++ gps_functions.py | 11 + hbdaprs.service | 14 + 18 files changed, 2115 insertions(+) create mode 100755 README.md create mode 100644 dashboard/__pycache__/dashboard_settings.cpython-310.pyc create mode 100644 dashboard/__pycache__/dashboard_settings.cpython-38.pyc create mode 100644 dashboard/dashboard.py create mode 100644 dashboard/dashboard_settings-SAMPLE.py create mode 100644 dashboard/dashboard_settings.py create mode 100644 dashboard/templates/about.html create mode 100644 dashboard/templates/footer.html create mode 100644 dashboard/templates/header.html create mode 100644 dashboard/templates/help.html create mode 100644 dashboard/templates/index.html create mode 100644 dashboard/templates/page.html create mode 100644 gps_data-SAMPLE.cfg create mode 100644 gps_data.cfg create mode 100644 gps_data.py create mode 100644 gps_data_igate_beacon.py create mode 100644 gps_functions.py create mode 100644 hbdaprs.service diff --git a/README.md b/README.md new file mode 100755 index 0000000..a4f5d96 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ + DAPRS 1.0 +============================ + + +## Version en production 1.0 + +## 1.0 + + +placer:
+le répertoire dashboard dans FreeDMR/script
+puis les fichiers:
+tout les fichier gps_* dans FreeDMR +puis éditer fichier pour le service hbdaprs.service +changer +/opt/FreeDMR/gps_data.py par votre chemin +puis copier le fichier hbdaprs.service +dans +/lib/systemd/system +puis sudo systemctl enable hbdaprs.service + + +73 +Xavier + + + diff --git a/dashboard/__pycache__/dashboard_settings.cpython-310.pyc b/dashboard/__pycache__/dashboard_settings.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..aa59af8b813427a13d0da9880210e59fcc1304c3 GIT binary patch literal 706 zcmYjP%Z}496iw3fm8P9REJiHQMC?W?d9>*?K?u!=YIeY=T_AaZ<=Sp*DTzaDS|$sY zd;xme0Mqyx+Gp6~E4#_)}Zce%IpvFqF7bThu@_pb;JD z!~h0qfCe#vNt#qY(@5(~15MHfEz$vP(ghu2fv(yX>46@xflc}g?P5?qw-!`NmaT=e z;)S!LONSt_S#nem*D6nEFRyRs3ukuBmESi~=Hiv-35g`b?v8yuFw9dgrGz05qcNKL zFd+0Y45Ot##VDLiLbME~aTJr$I9$d7j=rVak(+00ZyR_kmL%Q|jv{}!*&|9I9wuuT z3_ruj_jpdTJS`Hw=B_fCvmfW0R@y;4a)Zmr_1!2cPpywMQ7)(>xg$5!DGgPEeOs_C zlGJ&Nk_4EsAIHE5CZKgQzYadk$|pg%D#XYS##gI?Qg>C9&*~agiM!p-J$&rq1gWF< z7yYUYA>kOp>g1tQP%@d&%B<~G-8v0(UdRL8a3QN6p#m2ymyBoCfFOw=R)(Ow%V}jl zYDTIq$_oL7P}IgelL$+gp;TQvs`_QsKPs9cmQ*K4soEo$q(8M{pk`zbe?rwj>D{RM zX7A?SKO@3>@c+o5IE;gv-&LL0DJNeN`bMuO?u7#Lso6A*da2NjdqX$x&DK8CFm+S! G=zjq?@zqTL literal 0 HcmV?d00001 diff --git a/dashboard/__pycache__/dashboard_settings.cpython-38.pyc b/dashboard/__pycache__/dashboard_settings.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9d2b0af2defb243837dc96b1720ad85d3e955dc8 GIT binary patch literal 703 zcmYjP&5qMB5KhzdFKu@h32DUv5sr&W61V9#K?v=NYHz@*6(Ctc#0l*{l0Bz`|$MH=T9xe_+63z&D7*Vhpd1a(4aL~ zqb4+I9oDG@E!tqUQ-d~74cMS9*raXPq8-?#HtguIX%}{B5B6w(Zk!zzkL@{Aif>lZ zS&Gcb*}|b%t``Dl)U}I~>GR9$+1!~PYQ>MWQmK65c~W7;iJS9p`;3UhOBm(YBY1=- zJ_3}T2SK>-CjcbOHBsup#Jd7iube_aw|ef0LM zU$zjUf*@2L-wg^Wu3}bNmAbN1l~F1(wNKYVsidx?3a-p=@r?*pFqz~c~`o> z>6@8%D@1yC`tLI&_uJs6H)Z=}BIwtcy?R(JoTI^NSmv#pHS=#3R&&SeR;}`X0`}Ch literal 0 HcmV?d00001 diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py new file mode 100644 index 0000000..02c4c34 --- /dev/null +++ b/dashboard/dashboard.py @@ -0,0 +1,131 @@ +############################################################################### +# 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 +import ast, os +from dashboard_settings import * + +app = Flask(__name__) + + +tbl_hdr = ''' +
+ +''' + +tbl_ftr = ''' +
+''' + +def get_loc_data(): + try: + dash_loc = ast.literal_eval(os.popen('cat /tmp/gps_data_user_loc.txt').read()) + tmp_loc = '' + loc_hdr = ''' + +IndicatifLatitudeLongitudeDate et heure + ''' + cpt=0 + for e in dash_loc: + cpt = cpt + 1 + tmp_color="#f9f9f9f9" + if cpt >= 2: + tmp_color="#d9d9d9d9" + cpt = 0 + tmp_loc = tmp_loc + ''' + +''' + e['call'] + ''' + ''' + str(e['lat']) + '''  + ''' + str(e['lon']) + '''  + ''' + e['time'] + '''  + +''' + return str(str('

Positions Reçues

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

Pas de données

') + + +def get_log_data(): + + #try: + dash_log = (os.popen('cat /tmp/gps_data.log | nl | sort -n -r | cut -f2').read()) + dash_log = dash_log.replace('\n', '
') + return str(''+dash_log+'') + #except: + # return str('Pas de données') + +def get_bb_data(): + try: + dash_bb = ast.literal_eval(os.popen('cat /tmp/gps_data_user_bb.txt').read()) + tmp_bb = '' + + bb_hdr = ''' + +IndicatifDMR idBulletinDate et heure +''' + + for e in dash_bb: + tmp_bb = tmp_bb + ''' + + ''' + e['call'] + '''  +''' + str(e['dmr_id']) + ''' + ''' + e['bulliten'] + '''  + ''' + e['time'] + '''  + +''' + + return str('

Bulletins

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

No data

') + +@app.route('/') +def index(): + #return get_data() + return render_template('index.html', title = dashboard_title, logo = logo) +@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() + #return render_template('index.html', data = str(get_data())) +@app.route('/logdaprs') +def dash_log(): + return get_log_data() +##@app.route('//') +##def render_static(page_name): +## return render_template('%s.html' % page_name, title = dashboard_title, logo = logo, description = description) +@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) + + + +if __name__ == '__main__': + 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..1eb2b6b --- /dev/null +++ b/dashboard/dashboard_settings-SAMPLE.py @@ -0,0 +1,49 @@ +############################################################################### +# 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' diff --git a/dashboard/dashboard_settings.py b/dashboard/dashboard_settings.py new file mode 100644 index 0000000..aa52a44 --- /dev/null +++ b/dashboard/dashboard_settings.py @@ -0,0 +1,49 @@ +############################################################################### +# 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 = 'D-APRS Dashboard' +# Logo used on dashboard page +logo = 'https://monsite.com/logo.png' +# Port to run server +dash_port = 8086 +# IP to run server on +dash_host = '192.168.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 = 'MYCALL' +contact_call = 'MYCALL' +contact_email = 'mail@free.fr' +contact_website = 'http://www.monsite.com' diff --git a/dashboard/templates/about.html b/dashboard/templates/about.html new file mode 100644 index 0000000..df04c8f --- /dev/null +++ b/dashboard/templates/about.html @@ -0,0 +1,29 @@ +{% include 'page.html' %} +{% include 'header.html' %} +
+

 

+

Nous contacter.

+ +
+
+ + + + + + + + + + + + + + +
Indicatif {{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..f200a85 --- /dev/null +++ b/dashboard/templates/footer.html @@ -0,0 +1,5 @@ +
+
+
Copyright (c) 2016 - 2021. All rights reserved.
+ + diff --git a/dashboard/templates/header.html b/dashboard/templates/header.html new file mode 100644 index 0000000..b9963b2 --- /dev/null +++ b/dashboard/templates/header.html @@ -0,0 +1,14 @@ +

Logo

+

{{title}}

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

Attention:

+

Veuillez noter que de nombreuses radios DMR (sinon toutes) NE transmettent PAS votre indicatif lors de l'envoi d'une position GPS. Il est de votre responsabilité d'identifier votre station conformément aux réglementations de votre pays.

+

 

+

Configurez votre radio pour envoyer des positions GPS avec les paramètres suivants:

+ +
+
+ + + + + + + + + +
Data Call TypeSLOTTG ID
 {{data_call_type}} SL1 et SL2 {{data_call_id}}
+
+ +

 

+

Lorsqu'une position est reçue par cette passerelle, elle extrait les coordonnées et crée un paquet de position APRS. Cette passerelle trouvera votre indicatif en fonction de l'identifiant DMR de votre radio. Il est essentiel d'avoir vos informations à jour avec Le réseaux DMR FRA et DMRNET>. Un SSID APRS prédéfini à {{aprs_ssid}} est ajouté à votre indicatif (il peut être personalisé). Le paquet de localisation APRS est ensuite téléchargé vers APRS-IS (la carte APRS). Aucune configuration ou création de compte n'est requise au préalable, il faut juste être enregistré sur le réseaux. C'est à peu près "plug and play"."

+

Par exemple, N0CALL a un ID DMR de 1234567. La radio de N0CALL envoie une position à cette passerelle avec les paramètres ci-dessus. Cette passerelle interrogera le réseaux, et la base de données pour l'ID DMR 1234567. Le résultat sera un paquet d'emplacement APRS avec la position sur la carte APRS INDICATIF-SSID {{aprs_ssid}}.

+

Vous pouvez modifier les paramètres APRS par défaut de votre radio par SMS.

+

Les commandes

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CommandeDescriptionExemple
TESTTester la reception de SMS sur le dashboard.TEST
MAILTESTTester l'envoie de mail. Attention il faut activer la fonction voir @MAILMAILTEST
SOSEnvoyer à tous un mail de SOSSOS
@COMChanger le commentaire de l'APRS.@COM c'est un test.
@ICONChanger l'icon de la position APRS. La table est par défaut /. Voir http://fra1od.fr.to:85/aprs/aide.php pour la liste des icon APRS.@icon p
@SSIDChanger votre SSID à votre indicatif idem voir lien dans la section @ICON.@SSID 7
@MAILActiver et transmettre son mail..@MAIL mail@fai.extention
@MHDéfinissez votre emplacement par carré de grille QTH Locator Attention que 6 cararctères, et respecter MAJ MIN. Conçu pour les radios sans GPS ou qui ne sont pas encore compatibles.@MH JN33no
@BBPublier un message sur le tableau de bord Web.@BB c'est un bulletin de test.
@[CALLSIGN-SSID] A-[MESSAGE]Envoyer un message à une autre station via APRS@N0CALL-15 A-C est un test.
+
+ +

 

+

Envoyez un SMS à {{data_call_id}} comme un {{data_call_type}} avec la commande souhaitée suivie de la valeur. Par exemple, pour changer votre icône en chien, la commande serait @ICON p (voir le tableau des icônes pour les valeurs). Changer votre SSID est aussi simple que @SSID 7, et @COM Testing 123 changera le commentaire.

+

Envoyer @BB Test entraînera un message sur le buletin avec le message "Test".

+

Pour supprimer l'une des valeurs stockées, envoyez simplement la commande appropriée sans aucune entrée. @COM supprimera le commentaire stocké, @ICON +supprimera l'icône stockée, et @ICON supprimera l'icône en chaîne. Tous les rapports de position envoyés auront les paramètres par défaut. +Pour activer la notification mail: @MAIL mail@fai.extention. pour supprimer la notification de mail: @MAIL. +

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

Actualisation automatique toutes les 2min.

+
+ + + + + + + +

+
 .: Log DMR Data :.  +
+