diff --git a/dev/json_template-msg-xfer.py b/dev/json_template-msg-xfer.py index 4e2f6bd..76f6e48 100644 --- a/dev/json_template-msg-xfer.py +++ b/dev/json_template-msg-xfer.py @@ -1,20 +1,38 @@ # Types: App, s2s_msg +# Auth: public, private + +import json + msg_xfer = { 'mode':'msg_xfer', - 'type':'s2s_msg', + 'system_name':'ABC', 'response_url':'http://localhost:8093/api/', - 'user':'test_name', - 'password':'passw0rd', - 'data':{'source_id':1234567, - 'destination_id':7654321, + 'auth_type':'private', + 'credentials': { + 'user':'test_name', + 'password':'passw0rd', + }, + 'data':{ + 1:{'source_id':1234, + 'destination_id':3153591, 'slot':2, 'msg_type':'unit', 'msg_format':'motorola', 'message':'text of the message' + }, + 2:{'source_id':1234, + 'destination_id':3153591, + 'slot':2, + 'msg_type':'unit', + 'msg_format':'motorola', + 'message':'text of the 2nd message' + } } } -print(msg_xfer['data']['slot']) +json_object = json.dumps(msg_xfer, indent = 4) +print(json_object) + diff --git a/full_bridge-SAMPLE.cfg b/full_bridge-SAMPLE.cfg index 64270f1..6f6c82d 100644 --- a/full_bridge-SAMPLE.cfg +++ b/full_bridge-SAMPLE.cfg @@ -112,16 +112,19 @@ STALE_DAYS: 1 # DATA_DMR_ID - This is the DMR ID that users send DMR GPS data. # CALL_TYPE - group, unit, or both. Group if you want users to send data to a talkgroup, # unit if you want users to send data as a private call, or both if you want both options. -# USER_APRS_SSID - Default APRS SSID assigned to user APRS positions. -# USER_APRS_COMMENT - Default Comment attached to user APRS positions. -# APRS_LOGIN_CALL, PASSCODE, SERVER, and PORT - Login settings for APRS-IS. +# UNIT_SMS_TS - Default timeslot for private SMS, where the subscriber's last TS is not known. [GPS_DATA] DATA_DMR_ID: 9099 CALL_TYPE: unit +UNIT_SMS_TS: 2 + +#APRS settings +# USER_APRS_SSID - Default APRS SSID assigned to user APRS positions. +# USER_APRS_COMMENT - Default Comment attached to user APRS positions. +# APRS_LOGIN_CALL, PASSCODE, SERVER, and PORT - Login settings for APRS-IS. +# Setting APRS_LOGIN_CALL to N0CALL will cause the gateway to not upload packets to APRS server. USER_APRS_SSID: 15 USER_APRS_COMMENT: HBLink3 D-APRS - - -# Setting APRS_LOGIN_CALL to N0CALL will cause the gateway to not upload packets to APRS server. APRS_LOGIN_CALL: N0CALL APRS_LOGIN_PASSCODE: 12345 APRS_SERVER: rotate.aprs2.net @@ -165,6 +168,9 @@ EMERGENCY_SOS_FILE: /tmp/gps_data_user_sos.txt # User settings file, MUST configure using absolute path. USER_SETTINGS_FILE: /path/to/user_settings.txt +# Authorized Apps file - data used for the dashboard API +AUTHORIZED_APPS_FILE: /path/to/authorized_apps.py + # The following options are used for the dashboard. The dashboard is optional. # Title of the Dashboard DASHBOARD_TITLE: HBLink3 D-APRS Dashboard diff --git a/scripts/dashboard/authorized_apps.py b/scripts/dashboard/authorized_apps.py new file mode 100644 index 0000000..e45720f --- /dev/null +++ b/scripts/dashboard/authorized_apps.py @@ -0,0 +1,25 @@ +#global authorized_users, other_systems +# The following info will allow others to SMS into your system. +authorized_users = { + 'ABC':{ + 'mode':'msg_xfer', + 'user':'test_name', + 'password':'passw0rd' + } +} + +# The following info will allow users to access other systems. +access_systems = { + 'XYZ':{ + 'mode':'msg_xfer', + 'user':'test_name', + 'password':'passw0rd' + }, + 'APP':{ + 'mode':'app', + 'user':'test_name', + 'password':'passw0rd' + } +} + + diff --git a/scripts/dashboard/dashboard.py b/scripts/dashboard/dashboard.py index 7fbdafd..40cb720 100644 --- a/scripts/dashboard/dashboard.py +++ b/scripts/dashboard/dashboard.py @@ -21,7 +21,7 @@ This is a web dashboard for the GPS/Data application. ''' -from flask import Flask, render_template, request, Response, Markup +from flask import Flask, render_template, request, Response, Markup, jsonify, make_response import ast, os #from dashboard_settings import * import folium @@ -30,6 +30,7 @@ import re from datetime import datetime import argparse from configparser import ConfigParser +from send_sms import * @@ -185,8 +186,12 @@ def user_setting_write(dmr_id, input_ssid, input_icon, input_comment): 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]) + if input_aprs == 'True': + new_dict[dmr_id][5]['APRS'] = True + if input_aprs == 'False': + new_dict[dmr_id][5]['APRS'] = False + #print(input_comment) + #print(new_dict[dmr_id]) # Write modified dict to file with open(user_settings_file, 'w') as user_dict_file: @@ -401,8 +406,11 @@ def user_settings(): 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'] + aprs_msg_status = str(user_settings[int(request.form.get('dmr_id'))][5]['APRS']) + try: pin = user_settings[int(request.form.get('dmr_id'))][4]['pin'] + if ssid == '': ssid = aprs_ssid if icon == '': @@ -432,6 +440,15 @@ def user_settings():
""" @@ -525,6 +542,7 @@ def user_settings(): ssid = user_settings[int(user_id)][1]['ssid'] icon = user_settings[int(user_id)][2]['icon'] comment = user_settings[int(user_id)][3]['comment'] + aprs_msg_status = str(user_settings[int(user_id)][5]['APRS']) if ssid == '': ssid = aprs_ssid if icon == '': @@ -554,6 +572,10 @@ def user_settings():
@@ -699,6 +721,54 @@ def mail_rss():
"""
return Response(rss_header + post_data + "\n\n", mimetype='text/xml')
+@app.route('/api/