mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
added respond to call
This commit is contained in:
parent
4b5622647e
commit
8b2412de96
|
@ -1499,6 +1499,10 @@ class DATA:
|
||||||
Args:
|
Args:
|
||||||
data_in:bytes:
|
data_in:bytes:
|
||||||
"""
|
"""
|
||||||
|
# if we don't want to respond to calls, return False
|
||||||
|
if not static.RESPOND_TO_CALL:
|
||||||
|
return False
|
||||||
|
|
||||||
self.IS_ARQ_SESSION_MASTER = False
|
self.IS_ARQ_SESSION_MASTER = False
|
||||||
static.ARQ_SESSION_STATE = "connecting"
|
static.ARQ_SESSION_STATE = "connecting"
|
||||||
|
|
||||||
|
@ -1902,6 +1906,11 @@ class DATA:
|
||||||
"""
|
"""
|
||||||
# We've arrived here from process_data which already checked that the frame
|
# We've arrived here from process_data which already checked that the frame
|
||||||
# is intended for this station.
|
# is intended for this station.
|
||||||
|
|
||||||
|
# stop processing if we don't want to respond to a call when not in a arq session
|
||||||
|
if not static.RESPOND_TO_CALL and not static.ARQ_SESSION:
|
||||||
|
return False
|
||||||
|
|
||||||
self.arq_file_transfer = True
|
self.arq_file_transfer = True
|
||||||
self.is_IRS = True
|
self.is_IRS = True
|
||||||
|
|
||||||
|
@ -2208,7 +2217,7 @@ class DATA:
|
||||||
dxcallsign = str(dxcallsign, "UTF-8"),
|
dxcallsign = str(dxcallsign, "UTF-8"),
|
||||||
snr=str(static.SNR),
|
snr=str(static.SNR),
|
||||||
)
|
)
|
||||||
|
if static.RESPOND_TO_CALL:
|
||||||
ping_frame = bytearray(self.length_sig0_frame)
|
ping_frame = bytearray(self.length_sig0_frame)
|
||||||
ping_frame[:1] = bytes([FR_TYPE.PING_ACK.value])
|
ping_frame[:1] = bytes([FR_TYPE.PING_ACK.value])
|
||||||
ping_frame[1:4] = static.DXCALLSIGN_CRC
|
ping_frame[1:4] = static.DXCALLSIGN_CRC
|
||||||
|
@ -2476,7 +2485,7 @@ class DATA:
|
||||||
static.HAMLIB_FREQUENCY,
|
static.HAMLIB_FREQUENCY,
|
||||||
)
|
)
|
||||||
|
|
||||||
if static.RESPOND_TO_CQ:
|
if static.RESPOND_TO_CQ and static.RESPOND_TO_CALL:
|
||||||
self.transmit_qrv(dxcallsign)
|
self.transmit_qrv(dxcallsign)
|
||||||
|
|
||||||
def transmit_qrv(self, dxcallsign: bytes) -> None:
|
def transmit_qrv(self, dxcallsign: bytes) -> None:
|
||||||
|
|
12
tnc/sock.py
12
tnc/sock.py
|
@ -226,6 +226,18 @@ def process_tnc_commands(data):
|
||||||
"[SCK] CQ command execution error", e=err, command=received_json
|
"[SCK] CQ command execution error", e=err, command=received_json
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# SET ENABLE/DISABLE RESPOND TO CALL -----------------------------------------------------
|
||||||
|
if received_json["type"] == "set" and received_json["command"] == "respond_to_call":
|
||||||
|
try:
|
||||||
|
static.RESPOND_TO_CALL = received_json["state"] in ['true', 'True', True]
|
||||||
|
command_response("respond_to_call", True)
|
||||||
|
|
||||||
|
except Exception as err:
|
||||||
|
command_response("respond_to_call", False)
|
||||||
|
log.warning(
|
||||||
|
"[SCK] CQ command execution error", e=err, command=received_json
|
||||||
|
)
|
||||||
|
|
||||||
# SET ENABLE RESPOND TO CQ -----------------------------------------------------
|
# SET ENABLE RESPOND TO CQ -----------------------------------------------------
|
||||||
if received_json["type"] == "set" and received_json["command"] == "respond_to_cq":
|
if received_json["type"] == "set" and received_json["command"] == "respond_to_cq":
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -73,6 +73,7 @@ SCATTER: list = []
|
||||||
ENABLE_SCATTER: bool = False
|
ENABLE_SCATTER: bool = False
|
||||||
ENABLE_FSK: bool = False
|
ENABLE_FSK: bool = False
|
||||||
RESPOND_TO_CQ: bool = False
|
RESPOND_TO_CQ: bool = False
|
||||||
|
RESPOND_TO_CALL: bool = True # respond to cq, ping, connection request, file request if not in session
|
||||||
# ---------------------------------
|
# ---------------------------------
|
||||||
|
|
||||||
# Audio Defaults
|
# Audio Defaults
|
||||||
|
|
Loading…
Reference in a new issue