mirror of https://github.com/kf7eel/hbnet.git
add SMS seqence numbers, clean bridge.py, update README, add favicon
This commit is contained in:
parent
bf54d6b599
commit
0c6bd02107
|
|
@ -1,4 +1,4 @@
|
|||
## HBNet is still under heavy development. Documentation is being added to the Wiki as I write it, so check perodically to see if there is any new information. V1.0 will be ready in the next few months. See [HBNet.xyz](https://hbnet.xyz) for the development news.
|
||||
## HBNet is still under heavy development. Documentation is being added to the Wiki as I write it, so check perodically to see if there is any new information. V1.0 will be ready in the next few months. See [HBNet.xyz](https://hbnet.xyz) or [here](https://github.com/kf7eel/hbnet/discussions/33) for the development news.
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
11
bridge.py
11
bridge.py
|
|
@ -516,7 +516,7 @@ def make_bridges(_rules, _web_serv_status):
|
|||
return _new_rules
|
||||
|
||||
def ten_loop_func():
|
||||
logger.info('10 minute loop')
|
||||
logger.info('10 minute function loop')
|
||||
# Download burn list
|
||||
if LOCAL_CONFIG['WEB_SERVICE']['REMOTE_CONFIG_ENABLED']:
|
||||
with open(CONFIG['WEB_SERVICE']['BURN_FILE'], 'w') as f:
|
||||
|
|
@ -646,18 +646,11 @@ class routerOBP(OPENBRIDGE):
|
|||
self._targets = []
|
||||
|
||||
def svrd_received(self, _mode, _data):
|
||||
print(UNIT_MAP)
|
||||
## print(UNIT_MAP)
|
||||
logger.info('SVRD Received. Mode: ' + str(_mode) + ' Data: ' + str(_data))
|
||||
if _mode == b'UNIT':
|
||||
UNIT_MAP[_data] = (self._system, time())
|
||||
|
||||
## def mmdvm_cmd(self, _cmd):
|
||||
## print('---')
|
||||
## print(_cmd)
|
||||
## print('---')
|
||||
## pass
|
||||
|
||||
|
||||
def group_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _frame_type, _dtype_vseq, _stream_id, _data):
|
||||
pkt_time = time()
|
||||
dmrpkt = _data[20:53]
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ __license__ = 'GNU GPLv3'
|
|||
__maintainer__ = 'Eric Craw, KF7EEL'
|
||||
__email__ = 'kf7eel@qsl.net'
|
||||
|
||||
sms_seq_num = 0
|
||||
|
||||
def download_aprs_settings(_CONFIG):
|
||||
user_man_url = _CONFIG['WEB_SERVICE']['URL']
|
||||
shared_secret = str(sha256(_CONFIG['WEB_SERVICE']['SHARED_SECRET'].encode()).hexdigest())
|
||||
|
|
@ -1019,6 +1021,16 @@ def process_sms(_rf_src, sms, call_type, system_name):
|
|||
|
||||
##### SMS encode #########
|
||||
############## SMS Que and functions ###########
|
||||
|
||||
def gen_sms_seq():
|
||||
global sms_seq_num
|
||||
if sms_seq_num < 255:
|
||||
sms_seq_num = sms_seq_num + 1
|
||||
if sms_seq_num > 255:
|
||||
sms_seq_num = 1
|
||||
## print(sms_seq_num)
|
||||
return str(hex(sms_seq_num))[2:].zfill(2)
|
||||
|
||||
def create_crc16(fragment_input):
|
||||
crc16 = libscrc.gsm16(bytearray.fromhex(fragment_input))
|
||||
return fragment_input + re.sub('x', '0', str(hex(crc16 ^ 0xcccc))[-4:])
|
||||
|
|
@ -1224,7 +1236,8 @@ def sms_headers(to_id, from_id):
|
|||
## #TTL and Protocol always 4011, no matter what
|
||||
## ipv4_ttl_proto = '4011'
|
||||
#ipv4 = '450000ee000d0000401100000c' + from_id + '0c' + to_id
|
||||
ipv4 = '450000ee00000000401100000c' + from_id + '0c' + to_id
|
||||
## print(gen_sms_seq())
|
||||
ipv4 = '450000ee00' + gen_sms_seq() + '0000401100000c' + from_id + '0c' + to_id
|
||||
count_index = 0
|
||||
hdr_lst = []
|
||||
while count_index < len(ipv4):
|
||||
|
|
@ -1548,6 +1561,7 @@ def data_received(self, _peer_id, _rf_src, _dst_id, _seq, _slot, _call_type, _fr
|
|||
final_packet = str(bitarray(re.sub("\)|\(|bitarray|'", '', packet_assembly)).tobytes().decode('utf-8', 'ignore'))
|
||||
sms_hex = str(ba2hx(bitarray(re.sub("\)|\(|bitarray|'", '', packet_assembly))))
|
||||
sms_hex_string = re.sub("b'|'", '', str(sms_hex))
|
||||
print(sms_hex_string)
|
||||
#NMEA GPS sentence
|
||||
if '$GPRMC' in final_packet or '$GNRMC' in final_packet:
|
||||
logger.info(final_packet + '\n')
|
||||
|
|
|
|||
13
web/app.py
13
web/app.py
|
|
@ -21,7 +21,7 @@
|
|||
Flask based application that is the web server for HBNet. Controls user authentication, DMR server config, etc.
|
||||
'''
|
||||
|
||||
from flask import Flask, render_template_string, request, make_response, jsonify, render_template, Markup, flash, redirect, url_for, current_app, Response
|
||||
from flask import Flask, render_template_string, request, make_response, jsonify, render_template, Markup, flash, redirect, url_for, current_app, Response, send_from_directory
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_user import login_required, UserManager, UserMixin, user_registered, roles_required
|
||||
from werkzeug.security import check_password_hash
|
||||
|
|
@ -53,11 +53,6 @@ import os, ast
|
|||
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
|
||||
|
||||
##script_links = {}
|
||||
##active_tgs = {}
|
||||
##ping_list = {}
|
||||
peer_locations = {}
|
||||
|
||||
# Query radioid.net for list of IDs
|
||||
|
|
@ -779,6 +774,12 @@ def hbnet_web_service():
|
|||
return dict(global_config={'mode': mode, 'messages': messages_waiting, 'registration_enabled': USER_ENABLE_REGISTER})
|
||||
|
||||
|
||||
# Serve favicon
|
||||
@app.route('/favicon.ico')
|
||||
def favicon():
|
||||
return send_from_directory(os.path.join(app.root_path, 'static'),
|
||||
'favicon.ico', mimetype='image/vnd.microsoft.icon')
|
||||
|
||||
# The Home page is accessible to anyone
|
||||
@app.route('/')
|
||||
def home_page():
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 6.6 KiB |
Loading…
Reference in New Issue