clean data_gateway-SAMPLE, comment out sstuff before deletion

This commit is contained in:
KF7EEL 2022-02-21 19:21:14 -08:00
parent 9ec30997e3
commit 52bd918a23
3 changed files with 76 additions and 135 deletions

View File

@ -84,10 +84,10 @@ REPORT_CLIENTS: 127.0.0.1
# used. # used.
# #
[LOGGER] [LOGGER]
LOG_FILE: /tmp/hblink.log LOG_FILE: /tmp/hbnet_data_gateway.log
LOG_HANDLERS: console-timed LOG_HANDLERS: console-timed
LOG_LEVEL: DEBUG LOG_LEVEL: DEBUG
LOG_NAME: HBlink LOG_NAME: HBNet Data Gateway
# DOWNLOAD AND IMPORT SUBSCRIBER, PEER and TGID ALIASES # DOWNLOAD AND IMPORT SUBSCRIBER, PEER and TGID ALIASES
# Ok, not the TGID, there's no master list I know of to download # Ok, not the TGID, there's no master list I know of to download
@ -109,29 +109,18 @@ STALE_DAYS: 7
# This is where to configure the details for use with a user managment script # This is where to configure the details for use with a user managment script
[WEB_SERVICE] [WEB_SERVICE]
THIS_SERVER_NAME: DATA_GATEWAY THIS_SERVER_NAME: DATA_GATEWAY
# This must be set to True in order to use the web service an any mode.
REMOTE_CONFIG_ENABLED: False REMOTE_CONFIG_ENABLED: False
# URL of the user managment server # URL of the user managment server
URL: http://localhost:8080/svr URL: http://localhost:8080/svr
# Integer appended to DMR ID during the generation of a passphrase ### Secret used to authenticate with web service
##APPEND_INT: 1
##EXTRA_INT_1: 5
##EXTRA_INT_2: 8
##EXTRA_1: TeSt
##EXTRA_2: DmR4
### Secret used to authenticate with user managment server, before checking if user login is approved
SHARED_SECRET: test SHARED_SECRET: test
# Shorten passphrases
SHORTEN_PASSPHRASE: True
SHORTEN_SAMPLE: 4
SHORTEN_LENGTH: 4
BURN_FILE: ./burn_ids.txt
BURN_INT: 5
[DATA_CONFIG] [DATA_CONFIG]
USE_DASHBOARD: True USE_DASHBOARD: True
DATA_DMR_ID: 9099 DATA_DMR_ID: 9099
CALL_TYPE: both CALL_TYPE: both
UNIT_SMS_TS: 2 ##UNIT_SMS_TS: 2
USER_APRS_SSID: 5 USER_APRS_SSID: 5
USER_APRS_COMMENT: HBNet APRS Gateway USER_APRS_COMMENT: HBNet APRS Gateway
@ -141,6 +130,10 @@ APRS_LOGIN_CALL: N0CALL
APRS_LOGIN_PASSCODE: 12345 APRS_LOGIN_PASSCODE: 12345
APRS_FILTER: r/47/-120/500 t/m APRS_FILTER: r/47/-120/500 t/m
# User settings file, MUST configure using absolute path.
USER_SETTINGS_FILE: /tmp/user_settings.txt
# The following settings are only applicable if you are using the gps_data_beacon_igate script. # 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. # They do not affect the operation gps_data itself.
# Time in minutes. # Time in minutes.
@ -150,73 +143,14 @@ IGATE_BEACON_ICON = /I
IGATE_LATITUDE = 4730. N IGATE_LATITUDE = 4730. N
IGATE_LONGITUDE = 11930. W IGATE_LONGITUDE = 11930. W
############################ NOT IMPLEMENTED YET ##############################
# The following settings are for the static positions only, for hotspots or repeaters connected to MASTER stanzas. # The following settings are for the static positions only, for hotspots or repeaters connected to MASTER stanzas.
# Implementation by IU7IGU # Implementation by IU7IGU
# REPORT_INTERVAL in Minute (ALLOW only > 3 Minutes) # REPORT_INTERVAL in Minute (ALLOW only > 3 Minutes)
# MESSAGE: This message will print on APRS description together RX and TX Frequency # MESSAGE: This message will print on APRS description together RX and TX Frequency
APRS_STATIC_REPORT_INTERVAL: 15 APRS_STATIC_REPORT_INTERVAL: 15
APRS_STATIC_MESSAGE:Connected to HBLink APRS_STATIC_MESSAGE:Connected to HBLink
###############################################################################
# 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.
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
SMS_FILE: /tmp/gps_data_user_sms.txt
# User settings file, MUST configure using absolute path.
USER_SETTINGS_FILE: /tmp/user_settings.txt
# API settings
# Authorized Apps file - data used for the dashboard API
USE_API: True
AUTHORIZED_APPS_FILE: /tmp/authorized_apps.txt
AUTHORIZED_TOKENS_FILE: /tmp/hblink_auth_tokens.txt
AUTHORIZED_USERS_FILE: /home/eric/Sync/hblink3_sms_dev/authorized_users.txt
ACCESS_SYSTEMS_FILE: /home/eric/Sync/hblink3_sms_dev/access_systems.txt
MY_SERVER_SHORTCUT: XYZ
SERVER_NAME: Test HBLink Network
USE_PUBLIC_APPS: True
PUBLIC_APPS_LIST: https://raw.githubusercontent.com/kf7eel/hblink_sms_external_apps/main/public_systems.txt
RULES_PATH: /home/eric/Sync/hblink3_sms_dev/rules.py
# The following options are used for the dashboard. The dashboard is optional.
# Title of the Dashboard
DASHBOARD_TITLE: HBNet D-APRS Dashboard
# Used for API, RSS feed link, etc
DASHBOARD_URL: http://localhost:8092
# 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.
# 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_LAT: 47.00
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),
MAP_THEME: Stamen Toner
# OPENBRIDGE INSTANCES - DUPLICATE SECTION FOR MULTIPLE CONNECTIONS # OPENBRIDGE INSTANCES - DUPLICATE SECTION FOR MULTIPLE CONNECTIONS

View File

@ -532,70 +532,77 @@ def aprs_send(packet):
logger.info('Packet sent to APRS-IS.') logger.info('Packet sent to APRS-IS.')
def dashboard_loc_write(call, lat, lon, time, comment, dmr_id): def dashboard_loc_write(call, lat, lon, time, comment, dmr_id):
if LOCAL_CONFIG['DATA_CONFIG']['USE_DASHBOARD'] == True: ## if LOCAL_CONFIG['DATA_CONFIG']['USE_DASHBOARD'] == True:
if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True: if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
send_dash_loc(CONFIG, call, lat, lon, time, comment, dmr_id) send_dash_loc(CONFIG, call, lat, lon, time, comment, dmr_id)
else: logger.info('Sent to web service/dashboard')
dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time, 'comment':comment})
# Clear old entries
list_index = 0
call_count = 0
new_dash_entries = []
for i in dash_entries:
if i['call'] == call:
if call_count >= 25:
pass
else:
new_dash_entries.append(i)
call_count = call_count + 1
if call != i['call']:
new_dash_entries.append(i)
pass
list_index = list_index + 1
with open(loc_file, 'w') as user_loc_file:
user_loc_file.write(str(new_dash_entries[:500]))
user_loc_file.close()
logger.info('User location saved for dashboard')
#logger.info(dash_entries)
else: else:
pass logger.info('Web service/dashboard not enabled.')
## dash_entries = ast.literal_eval(os.popen('cat ' + loc_file).read())
## dash_entries.insert(0, {'call': call, 'lat': lat, 'lon': lon, 'time':time, 'comment':comment})
## # Clear old entries
## list_index = 0
## call_count = 0
## new_dash_entries = []
## for i in dash_entries:
## if i['call'] == call:
## if call_count >= 25:
## pass
## else:
## new_dash_entries.append(i)
## call_count = call_count + 1
##
## if call != i['call']:
## new_dash_entries.append(i)
## pass
## list_index = list_index + 1
## with open(loc_file, 'w') as user_loc_file:
## user_loc_file.write(str(new_dash_entries[:500]))
## user_loc_file.close()
## logger.info('User location saved for dashboard')
#logger.info(dash_entries)
## else:
## pass
def dashboard_bb_write(call, dmr_id, time, bulletin, system_name): def dashboard_bb_write(call, dmr_id, time, bulletin, system_name):
if LOCAL_CONFIG['DATA_CONFIG']['USE_DASHBOARD'] == True: ## if LOCAL_CONFIG['DATA_CONFIG']['USE_DASHBOARD'] == True:
if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True: if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
send_bb(CONFIG, call, dmr_id, bulletin, system_name) send_bb(CONFIG, call, dmr_id, bulletin, system_name)
else:
#try:
dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read())
# except:
# dash_entries = []
dash_bb.insert(0, {'call': call, 'dmr_id': dmr_id, 'time': time, 'bulletin':bulletin})
with open(bb_file, 'w') as user_bb_file:
user_bb_file.write(str(dash_bb[:20]))
user_bb_file.close()
logger.info('User bulletin entry saved.')
#logger.info(dash_bb)
else: else:
pass logger.info('Web service/dashboard not enabled.')
## #try:
## dash_bb = ast.literal_eval(os.popen('cat ' + bb_file).read())
## # except:
## # dash_entries = []
## dash_bb.insert(0, {'call': call, 'dmr_id': dmr_id, 'time': time, 'bulletin':bulletin})
## with open(bb_file, 'w') as user_bb_file:
## user_bb_file.write(str(dash_bb[:20]))
## user_bb_file.close()
## logger.info('User bulletin entry saved.')
## #logger.info(dash_bb)
## else:
## pass
def dashboard_sms_write(snd_call, rcv_call, rcv_dmr_id, snd_dmr_id, sms, time, system_name): def dashboard_sms_write(snd_call, rcv_call, rcv_dmr_id, snd_dmr_id, sms, time, system_name):
if LOCAL_CONFIG['DATA_CONFIG']['USE_DASHBOARD'] == True: ## if LOCAL_CONFIG['DATA_CONFIG']['USE_DASHBOARD'] == True:
if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True: if CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED'] == True:
send_sms_log(CONFIG, snd_call, rcv_call, sms, rcv_dmr_id, snd_dmr_id, system_name) send_sms_log(CONFIG, snd_call, rcv_call, sms, rcv_dmr_id, snd_dmr_id, system_name)
else: logger.info('Web service/dashboard not enabled.')
#try:
dash_sms = ast.literal_eval(os.popen('cat ' + sms_file).read())
# except:
# dash_entries = []
dash_sms.insert(0, {'snd_call': snd_call, 'rcv_call':rcv_call, 'snd_dmr_id': snd_dmr_id, 'rcv_dmr_id':rcv_dmr_id, 'time': time, 'sms':sms})
with open(sms_file, 'w') as user_sms_file:
user_sms_file.write(str(dash_sms[:25]))
user_sms_file.close()
logger.info('User SMS entry saved.')
else: else:
pass logger.info('Web service/dashboard not enabled.')
## #try:
## dash_sms = ast.literal_eval(os.popen('cat ' + sms_file).read())
## # except:
## # dash_entries = []
## dash_sms.insert(0, {'snd_call': snd_call, 'rcv_call':rcv_call, 'snd_dmr_id': snd_dmr_id, 'rcv_dmr_id':rcv_dmr_id, 'time': time, 'sms':sms})
## with open(sms_file, 'w') as user_sms_file:
## user_sms_file.write(str(dash_sms[:25]))
## user_sms_file.close()
## logger.info('User SMS entry saved.')
## else:
## pass
def mailbox_write(call, dmr_id, time, message, recipient): def mailbox_write(call, dmr_id, time, message, recipient):

View File

@ -167,7 +167,7 @@ def build_config(_config_file):
elif section == 'DATA_CONFIG': elif section == 'DATA_CONFIG':
CONFIG['DATA_CONFIG'].update({ CONFIG['DATA_CONFIG'].update({
'USE_DASHBOARD': config.getboolean(section, 'USE_DASHBOARD'), ## 'USE_DASHBOARD': config.getboolean(section, 'USE_DASHBOARD'),
'DATA_DMR_ID': config.get(section, 'DATA_DMR_ID'), 'DATA_DMR_ID': config.get(section, 'DATA_DMR_ID'),
'USER_APRS_SSID': config.get(section, 'USER_APRS_SSID'), 'USER_APRS_SSID': config.get(section, 'USER_APRS_SSID'),
'CALL_TYPE': config.get(section, 'CALL_TYPE'), 'CALL_TYPE': config.get(section, 'CALL_TYPE'),