Add announcement for reflector connection status

If the connection to the reflector is not up when a talk group is
locally activated, an announcemnt will tell the user that the reflector
is disconnected. The connection status will also be announced for the
"*" ReflectorLogic command.

Fixes #592
This commit is contained in:
Tobias Blomberg 2022-08-20 14:32:24 +02:00
parent 7ebd9ed530
commit e7e69b0e70
3 changed files with 52 additions and 1 deletions

View File

@ -759,6 +759,7 @@ void ReflectorLogic::onConnected(void)
timerclear(&m_last_talker_timestamp);
m_con_state = STATE_EXPECT_AUTH_CHALLENGE;
m_con.setMaxFrameSize(ReflectorMsg::MAX_PREAUTH_FRAME_SIZE);
processEvent("reflector_connection_status_update 1");
} /* ReflectorLogic::onConnected */
@ -786,6 +787,7 @@ void ReflectorLogic::onDisconnected(TcpConnection *con,
timerclear(&m_last_talker_timestamp);
}
m_con_state = STATE_DISCONNECTED;
processEvent("reflector_connection_status_update 0");
} /* ReflectorLogic::onDisconnected */

View File

@ -31,6 +31,10 @@ variable announce_remote_min_interval 0
# activity") is active. See configuration variable QSY_PENDING_TIMEOUT.
variable qsy_pending_active 0
# This variable will be set to 1 if the connection to the reflector is
# established and to 0 if disconnected.
variable reflector_connection_established 0
#
# Checking to see if this is the correct logic core
#
@ -72,6 +76,25 @@ proc command_failed {cmd} {
}
#
# Executed when the reflector connection status is updated
#
# is_established - 0=disconnected, 1=established
#
proc reflector_connection_status_update {is_established} {
variable reflector_connection_established
if {$is_established != $reflector_connection_established} {
set reflector_connection_established $is_established
#playMsg "Core" "reflector"
#if {$is_established} {
# playMsg "Core" "connected"
#} else {
# playMsg "Core" "disconnected"
#}
}
}
#
# Executed when manual TG announcement is triggered
#
@ -80,7 +103,15 @@ proc report_tg_status {} {
variable previous_tg
variable prev_announce_time
variable prev_announce_tg
variable reflector_connection_established
playSilence 100
playMsg "Core" "reflector"
if {$reflector_connection_established} {
playMsg "Core" "connected"
} else {
playMsg "Core" "disconnected"
}
playSilence 200
if {$selected_tg > 0} {
set prev_announce_time [clock seconds]
set prev_announce_tg $selected_tg
@ -125,12 +156,18 @@ proc tg_local_activation {new_tg old_tg} {
variable prev_announce_time
variable prev_announce_tg
variable selected_tg
variable reflector_connection_established
#puts "### tg_local_activation"
if {$new_tg != $old_tg} {
set prev_announce_time [clock seconds]
set prev_announce_tg $new_tg
playSilence 100
if {!$reflector_connection_established} {
playMsg "Core" "reflector"
playMsg "Core" "disconnected"
playSilence 200
}
playMsg "Core" "talk_group"
say_talkgroup $new_tg
}
@ -185,11 +222,17 @@ proc tg_remote_prio_activation {new_tg old_tg} {
proc tg_command_activation {new_tg old_tg} {
variable prev_announce_time
variable prev_announce_tg
variable reflector_connection_established
#puts "### tg_command_activation"
set prev_announce_time [clock seconds]
set prev_announce_tg $new_tg
playSilence 100
if {!$reflector_connection_established} {
playMsg "Core" "reflector"
playMsg "Core" "disconnected"
playSilence 200
}
playMsg "Core" "talk_group"
say_talkgroup $new_tg
}
@ -205,11 +248,17 @@ proc tg_default_activation {new_tg old_tg} {
#variable prev_announce_time
#variable prev_announce_tg
#variable selected_tg
#variable reflector_connection_established
#puts "### tg_default_activation"
#if {$new_tg != $old_tg} {
# set prev_announce_time [clock seconds]
# set prev_announce_tg $new_tg
# playSilence 100
# if {!$reflector_connection_established} {
# playMsg "Core" "reflector"
# playMsg "Core" "disconnected"
# playSilence 200
# }
# playMsg "Core" "talk_group"
# say_talkgroup $new_tg
#}

View File

@ -11,7 +11,7 @@ LIBECHOLIB=1.3.3.99.2
LIBASYNC=1.6.99.23
# SvxLink versions
SVXLINK=1.7.99.71
SVXLINK=1.7.99.72
MODULE_HELP=1.0.0
MODULE_PARROT=1.1.1
MODULE_ECHO_LINK=1.5.99.3