diff --git a/dev/json_templates.py b/dev/json_templates.py index 246086b..dd9db30 100644 --- a/dev/json_templates.py +++ b/dev/json_templates.py @@ -100,15 +100,13 @@ app_response = { 'app_shortcut':'APP', 'auth_token':'736a9ced7e7688c951490a7f8e1ebdd4', 'data':{ - 1:{'source_app':'app_name', - 'destination_id':3153591, + 1:{ 'destination_id':3153591, 'slot':2, 'msg_type':'unit', 'msg_format':'motorola', 'message':'text of the message' }, - 2:{'source_id':'app_name', - 'destination_id':3153591, + 2:{ 'destination_id':3153591, 'slot':2, 'msg_type':'unit', 'msg_format':'motorola', diff --git a/full_bridge-SAMPLE.cfg b/full_bridge-SAMPLE.cfg index e33c651..a7b504b 100644 --- a/full_bridge-SAMPLE.cfg +++ b/full_bridge-SAMPLE.cfg @@ -109,34 +109,38 @@ STALE_DAYS: 1 # GPS/Data Application - by KF7EEL # Configure the settings for the DMR GPS to APRS position application here. # -# DATA_DMR_ID - This is the DMR ID that users send DMR GPS data. +# DATA_DMR_ID - This is the DMR ID that users send SMS and 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. # UNIT_SMS_TS - Default timeslot for private SMS, where the subscriber's last TS is not known. +# UNIT_SMS_TS can be 1 or 2 [GPS_DATA] DATA_DMR_ID: 9099 CALL_TYPE: unit UNIT_SMS_TS: 2 -#APRS settings +# APRS configuration +# This section contains APRS configuration for the gateway. # 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. +# APRS_LOGIN_CALL, PASSCODE, SERVER, and PORT - Gateway login settings for APRS-IS. 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. +# Set to N0CALL if you wish to disable APRS. APRS_LOGIN_CALL: N0CALL APRS_LOGIN_PASSCODE: 12345 APRS_SERVER: rotate.aprs2.net APRS_PORT: 14580 -# The APRS filter below is used for the message received script. See http://www.aprs-is.net/javAPRSFilter.aspx for details -# about APRS filters. +# The APRS filter below is used for receiving messages. +#See http://www.aprs-is.net/javAPRSFilter.aspx for details about APRS filters. APRS_FILTER: r/47/-120/500 t/m -# The following settings are only applicable if you are using the gps_data_beacon_igate script. -# They do not affect the operation gps_data itself. -# Time in minutes. If time is set to 0, no beacon will be sent. +# The following configuration options are for uploading a position of the gateway itself. +# When the gateway uploads a position, APRS software such as aprs.fi will see it as an Igate, +# this is useful if you want aprs.fi to keep statistics. +# Time in minutes. Set IGATE_BEACON_TIME to 0 to disable Igate beaconing. IGATE_BEACON_TIME = 45 IGATE_BEACON_COMMENT = HBLink3 D-APRS Gateway IGATE_BEACON_ICON = /I @@ -150,38 +154,46 @@ IGATE_LONGITUDE = 00000.00W APRS_STATIC_REPORT_INTERVAL: 15 APRS_STATIC_MESSAGE:Connected to HBLink + +###### Removing Soon ################### # The email gateway settingns below are OPTIONAL. They are NOT REQUIRED if you don't want # http://www.aprs-is.net/javAPRSFilter.aspx# to enable the email gateway. Leave as is to disable. EMAIL_SENDER: test@example.org EMAIL_PASSWORD: letmein SMTP_SERVER: smtp.gmail.com SMTP_PORT: 465 +######################################## -# The options below are required for operation of the dashboard and will cause errors in gps_data.py -# if configured wrong. Leave them as default unless you know what you are doing. -# If you do change, you must use absolute paths. + +# The options below are required for operation of the dashboard and will cause errors if configures incorrectly. +# Leave them as default unless you know what you are doing. +# If you do change, you MUST use absolute paths. LOCATION_FILE: /tmp/gps_data_user_loc.txt BULLETIN_BOARD_FILE: /tmp/gps_data_user_bb.txt MAILBOX_FILE: /tmp/gps_data_user_mailbox.txt EMERGENCY_SOS_FILE: /tmp/gps_data_user_sos.txt +# REQUIRED TO CHANGE # User settings file, MUST configure using absolute path. USER_SETTINGS_FILE: /path/to/user_settings.txt -# API settings -# Authorized Apps file - data used for the dashboard API -# Authorized Tokens File - location of file to store token for app requests, can be left as default -# Authorized Users File - Stores login data for other servers to send messages -# Access Systems File - Contains data for external applications or other networks/servers -# that this server can access. -# My API Name - Short abbreviation, must match other users access files. -# Server name - can be different than dashboard title, used to identify this network/server +# API Configuration +# MY_SERVER_SHORTCUT - Short abbreviation, must match other users access. +# Server name - can be different than dashboard title, used to identify this network/server. +# AUTHORIZED_TOKENS_FILE, OK to leave as default. This is the file where one time tokens are saved. +# MY_SERVER_SHORTCUT, should be something short, ideally 3 or 4 letters. This is used in the authentication and +# sending process. Should be unique from other servers, especially if you plan on allowing public access. +# SERVER_NAME, the name of your server or network. This is used to identify your server with some external applications. +# USE_PUBLIC_APPS, Allow your users to use publically accessible external applications. +# PUBLIC_APPS_LIST, URL to list of public external applications. Leave as default. USE_API: True AUTHORIZED_TOKENS_FILE: /tmp/hblink_auth_tokens.txt MY_SERVER_SHORTCUT: ABC -SERVER_NAME: Test HBLink Network +SERVER_NAME: Regional HBLink3 Server USE_PUBLIC_APPS: True PUBLIC_APPS_LIST: https://raw.githubusercontent.com/kf7eel/hblink_sms_external_apps/main/public_systems.txt + +# REQUIRED TO CHANGE RULES_PATH: /path/to/rules.py @@ -191,6 +203,7 @@ DASHBOARD_TITLE: HBLink3 D-APRS Dashboard # Used for API, RSS feed link, etc. This MUST be accessible. # Do not add a trailing / +# You must set this if you are using the API. DASHBOARD_URL: http://localhost:8092 # Logo used on dashboard page @@ -220,7 +233,7 @@ MAP_CENTER_LON: -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), +# 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 ##################################################################### diff --git a/full_bridge.py b/full_bridge.py index 2a31d9b..f39e87f 100644 --- a/full_bridge.py +++ b/full_bridge.py @@ -936,8 +936,12 @@ UNIT_MAP = {} time_20 = 630720000 # Build a UNIT_MAP based on values in STATIC_MAP. -for i in STATIC_UNIT: +try: + for i in STATIC_UNIT: UNIT_MAP[bytes_3(i[0])] = i[1], time() + time_20, i[2] +# If empty, return empty dictionary +except: + UNIT_MAP = {} # Timed loop used for reporting HBP status # @@ -1829,6 +1833,8 @@ class routerHBP(HBSYSTEM): _target_status = systems[_target].STATUS _target_system = self._CONFIG['SYSTEMS'][_target] +## print(self._targets) + #print(_target_system) if self._CONFIG['SYSTEMS'][_target]['MODE'] == 'OPENBRIDGE': if (_stream_id not in _target_status): diff --git a/requirements.txt b/requirements.txt index 512d3d4..fa0736b 100755 --- a/requirements.txt +++ b/requirements.txt @@ -10,5 +10,4 @@ flask folium libscrc requests -json -hashlib + diff --git a/rules_full_bridge-SAMPLE.py b/rules_full_bridge-SAMPLE.py index 64fe6a9..5db794d 100755 --- a/rules_full_bridge-SAMPLE.py +++ b/rules_full_bridge-SAMPLE.py @@ -33,17 +33,13 @@ configuration file. ''' BRIDGES = { -## 'ENGLISH': [ -## {'SYSTEM': 'CHANGE_ME-1', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}, -## {'SYSTEM': 'CHANGE_ME-2', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}, -## ], -## 'STATEWIDE': [ -## {'SYSTEM': 'CHANGE_ME-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, -## {'SYSTEM': 'CHANGE_ME-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, -## ], + 'STATEWIDE': [ + {'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, + {'SYSTEM': 'PEER-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}, + ], 'ECHO': [ {'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 9999, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [9999,], 'OFF': [9,10], 'RESET': []}, - {'SYSTEM': 'ECHO', 'TS': 2, 'TGID': 9999, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [9999,], 'OFF': [9,10], 'RESET': []}, + {'SYSTEM': 'PEER-1', 'TS': 2, 'TGID': 9999, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [9999,], 'OFF': [9,10], 'RESET': []}, ] } @@ -69,15 +65,15 @@ Input the DMR ID and SYSTEM of a subscriber that you would like to have always h This will not flood all systems. ''' STATIC_UNIT = [ - [ 9099, 'MASTER-1'] - ] +# [ 9099, 'MASTER-1'] + ] ''' Manually specify other networks/servers that are authorized to send SMS to your server ''' authorized_users = { -## 'DEF':{ +## 'ABC':{ ## 'mode':'msg_xfer', ## 'user':'test_name', ## 'password':'passw0rd'