add APRS beacon script for gps_data

This commit is contained in:
KF7EEL 2020-12-11 12:47:43 -08:00
parent 804cb1c025
commit 76ad6adea4
4 changed files with 77 additions and 2 deletions

View File

@ -152,6 +152,12 @@ def build_config(_config_file):
'APRS_LOGIN_PASSCODE': config.get(section, 'APRS_LOGIN_PASSCODE'),
'APRS_SERVER': config.get(section, 'APRS_SERVER'),
'APRS_PORT': config.get(section, 'APRS_PORT'),
'IGATE_BEACON_TIME': config.get(section, 'IGATE_BEACON_TIME'),
'IGATE_BEACON_ICON': config.get(section, 'IGATE_BEACON_ICON'),
'IGATE_BEACON_COMMENT': config.get(section, 'IGATE_BEACON_COMMENT'),
'IGATE_LATITUDE': config.get(section, 'IGATE_LATITUDE'),
'IGATE_LONGITUDE': config.get(section, 'IGATE_LONGITUDE'),
})
if not CONFIG['LOGGER']['LOG_FILE']:
CONFIG['LOGGER']['LOG_FILE'] = '/dev/null'

View File

@ -118,12 +118,19 @@ STALE_DAYS: 1
DATA_DMR_ID: 9099
CALL_TYPE: unit
USER_APRS_SSID: 15
USER_APRS_COMMENT: HBLink3 GPS Decode -
USER_APRS_COMMENT: HBLink3 D-APRS -
APRS_LOGIN_CALL: N0CALL
APRS_LOGIN_PASSCODE: 12345
APRS_SERVER: rotate.aprs2.net
APRS_PORT: 14580
# 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.
IGATE_BEACON_TIME = 45
IGATE_BEACON_COMMENT = HBLink3 D-APRS Gateway
IGATE_BEACON_ICON = /I
IGATE_LATITUDE = 0000.00N
IGATE_LONGITUDE = 00000.00W
# OPENBRIDGE INSTANCES - DUPLICATE SECTION FOR MULTIPLE CONNECTIONS
# OpenBridge is a protocol originall created by DMR+ for connection between an

View File

@ -379,6 +379,8 @@ class DATA_SYSTEM(HBSYSTEM):
# End APRS-IS upload
# Assume this is an SMS message
if '$GPRMC' not in final_packet:
if '0005' in hdr_start:
logger('This may be an NMEA coded packet from an MD-380!')
# Revisit below later.
#### # Motorola type SMS header

60
gps_data_igate_beacon.py Normal file
View File

@ -0,0 +1,60 @@
#!/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 script uploads a beacon to APRS-IS for the GPS/Data Application itself, cuasing it to appear as an igate
an aprs.fi.
'''
import aprslib
import argparse
import os
import config
import time
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', action='store', dest='CONFIG_FILE', help='/full/path/to/config.file (usually gps_data.cfg)')
cli_args = parser.parse_args()
if not cli_args.CONFIG_FILE:
cli_args.CONFIG_FILE = os.path.dirname(os.path.abspath(__file__))+'/gps_data.cfg'
CONFIG = config.build_config(cli_args.CONFIG_FILE)
print('''
GPS/Data Application Beacon Script by Eric, KF7EEL. https://github.com/kf7eel/hblink3 \n
This script will upload an APRS position for the GPS/Data Application. This usually causes most APRS-IS clients to see the GPS/Data Application
as an i-gate. \n
Using the following setting to upload beacon.\n
Callsign: ''' + CONFIG['GPS_DATA']['APRS_LOGIN_CALL'] + ''' - Position comment: ''' + CONFIG['GPS_DATA']['IGATE_BEACON_COMMENT'] + '''
Beacon time: ''' + CONFIG['GPS_DATA']['IGATE_BEACON_TIME'] + '''
''')
beacon_packet = CONFIG['GPS_DATA']['APRS_LOGIN_CALL'] + '>APHBL3,TCPIP*:!' + CONFIG['GPS_DATA']['IGATE_LATITUDE'] + str(CONFIG['GPS_DATA']['IGATE_BEACON_ICON'][0]) + CONFIG['GPS_DATA']['IGATE_LONGITUDE'] + str(CONFIG['GPS_DATA']['IGATE_BEACON_ICON'][1]) + '/' + CONFIG['GPS_DATA']['IGATE_BEACON_COMMENT']
#print(beacon_packet)
AIS = aprslib.IS(CONFIG['GPS_DATA']['APRS_LOGIN_CALL'], passwd=CONFIG['GPS_DATA']['APRS_LOGIN_PASSCODE'],host=CONFIG['GPS_DATA']['APRS_SERVER'], port=CONFIG['GPS_DATA']['APRS_PORT'])
while int(CONFIG['GPS_DATA']['IGATE_BEACON_TIME']) > 15:
AIS.connect()
AIS.sendall(beacon_packet)
print(beacon_packet)
AIS.close()
time.sleep(int(CONFIG['GPS_DATA']['IGATE_BEACON_TIME']))