====== Repeater for Emergency use ======
When an emergency plan is activated locally, amateur radio repeater are used emergency structures, as [[http://www.fnrasec.org| FNRASEC]] in France . This page explains how to configure and add emergency mode on SvxLink Repeater. Once activated mode, an information say "the repeater is currently reserved for an emergency plan... leave priority to emergency services. Thanks for your understanding".
{{:documents:en_emergency.mp3|}}
Open and close standards messages and Beacons aren't running.
===== Edit /Logic.tcl =====
Add declaration of global variable ''emergency'' in the ''namespace Logic'':
###############################################################################
#
# Generic Logic event handlers
#
###############################################################################
#
# This is the namespace in which all functions and variables below will exist.
#
namespace eval Logic {
#
# A global variable for emergency mode
#
variable emergency 0;
#
# A variable used to store a timestamp for the last identification.
#
variable prev_ident 0;
===== Activation and deactivation of emergency mode =====
To turn on and turn off the emergency mode with DTMF code, add following lines in the function ''dtmf_cmd_received'' in ''Logic.tcl''. Here we use the code ''281'' for deactivation, and ''280'' for activation. We recommend choose a "hard" DTMF code "compliqué" only for administrator. You can add too a security code like [[fr:sysop_code|le principe des code sysop]].
proc dtmf_cmd_received {cmd} {variable emergency;
if {$cmd == "281"} {
set emergency 1
puts "Emergency actived status: $emergency"
playMsg "SVXCard/Emergency" "EmergencyMode"
playMsg "repeater_commands" "activating"
playSilence 500
playMsg "SVXCard" "Emergency/EmergencyBeacon"
return 1
}
if {$cmd == "280"} {
set emergency 0
puts "Emergency desactived status: $emergency"
playMsg "SVXCard/Emergency" "EmergencyMode"
playMsg "repeater_commands" "deactivating"
return 1
}
In ''Logic.tcl'', add a function to inform the statuts of emergency mode to Logic of repeater (''RepearLogic.tcl'').
proc status_emergency {} {
variable emergency;
return $emergency;
}
===== Beacon filter =====
When the emergency mode is activated, we don't want the standard announcement of the repeater opening. The filter make a logical test of the emergency activation mode status in the existing function '' repeater_up '' in '' RepeaterLogic.tcl ''
if ![Logic::status_emergency] {
# Normal Execution
}
You can replace the open message with the emergency message (Beacon message), add following lines ( insert between **# Normal Execution** and ** }** of before code ):
} else {
playMsg "SVXCard" "Emergency/EmergencyBeacon";
===== Regulary emergency beacon =====
When the relay is in emergency mode , we will regularly play the information message. For example, following message " the repeater is currently reserved for an emergency plan ... leave priority to emergency services . Thanks for your understanding.". The sound file in wav format will be in the directory ''/usr/share/svxlink/sounds/fr_FR/SVXCard/Emergency/''.
{{:documents:en_emergency.mp3|Balise d'information mode d'urgence}}
We will add the following code in the function ''checkPeriodicIdentify'' in file ''Logic.tcl'' placed between variable declaration ''global logic_name;'' and test logic '' if {$short_ident_interval == 0} { ...''.
proc checkPeriodicIdentify {} {
variable prev_ident;
variable short_ident_interval;
variable long_ident_interval;
variable min_time_between_ident;
variable ident_only_after_tx;
variable need_ident;
global logic_name;
if {[Logic::status_emergency]} {
set now [clock seconds];
set hour [clock format $now -format "%k"];
regexp {([1-5]?\d)$} [clock format $now -format "%M"] -> minute;
set emergency_ident_interval 2; #period of emergency beacon (in minutes)
set emergency_ident_now \
[expr {($hour * 60 + $minute) % $emergency_ident_interval == 0}];
puts "$hour $now $minute $emergency_ident_now";
if { $emergency_ident_now } {
puts "$logic_name: Sending Emergency identification...";
playMsg "SVXCard" "Emergency/EmergencyBeacon"
}
return; #Following standard identification no more executed
}
if {$short_ident_interval == 0} {
return;
}
This line ''set $emergency_ident_interval 2;'' set the time between emergency beacon, you can adjust the time as you wish it.
{{youtube>75a9yZz6PjY?medium}}