Pei initialization can now be done via an external json file. Bugfix: .json files were not installed correctly. Some typos in doc file corrected.

This commit is contained in:
Adi/DL1HRC 2022-11-02 12:08:02 +01:00
parent c235f9c655
commit 4dab65db1e
6 changed files with 110 additions and 29 deletions

View File

@ -20,6 +20,5 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TetraLogic.conf.in
install_if_not_exists(${CMAKE_CURRENT_BINARY_DIR}/TetraLogic.conf
${SVX_SYSCONF_INSTALL_DIR}/svxlink.d
)
install_if_not_exists(${CMAKE_CURRENT_BINARY_DIR}/tetra_users.json
${SVX_SYSCONF_INSTALL_DIR}
)
install_if_not_exists(tetra_users.json ${SVX_SYSCONF_INSTALL_DIR})
install_if_not_exists(pei-init.json ${SVX_SYSCONF_INSTALL_DIR})

View File

@ -33,7 +33,7 @@ cd svxlink/src
git checkout tetra-contrib
mkdir build
cd build
cmake -DUSE_QT=OFF -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONF_INSTALL_DIR=/etc -DLOCAL_STATE_DIR=/var -DCMAKE_BUILD_TYPE=Release -DWITH_CONTRIB_TETRA_LOGIC=ON ..
cmake -DUSE_QT=OFF -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONF_INSTALL_DIR=/etc -DLOCAL_STATE_DIR=/var -DCMAKE_BUILD_TYPE=Release -DWITH_CONTRIB_TETRA_LOGIC=ON ..
make
sudo make install
@ -45,6 +45,7 @@ TetraLogic extension. Without this it will not work.
systemctl stop svxlink
cd /home/svxlink/svxlink/src/build/
make clean
git pull
sudo make install
sudo systemctl restart svxlink

View File

@ -7,8 +7,9 @@ TetraLogic.conf \- Configuration file for the TetraLogic section
.SH DESCRIPTION
.
.B svxlink
is a general purpose voice service system for ham radio use with Tetra extensiojn.
This man-page describe the TetraLogic configuration file format.
is a general purpose voice service system for ham radio use with Tetra extension.
This man-page describe the TetraLogic configuration file format. Please take also
a look into the README-Tetra for installation and update instructions.
.P
If TetraLogic is compiled in into SvxLink, it looks for configuration files in
/etc/svxlink/svxlink.d/
@ -51,7 +52,7 @@ are sent and from which responses within the logic are evaluated.
Devices from Motorola (MTM5400/5500/800) and Sepura (SRG2200) are
recommended. For a full function the active data cable has to be extended by
the audio lines (microphone, line-in) and connected to the sound card.
The reception of SDS messages such as status, lip and text messages is
The reception of Sds messages such as status, lip and text messages is
currently supported.
.TP
.B TYPE
@ -97,7 +98,7 @@ MNC=16383
.TP
.B MCC
The MCC (Mobile Country Code) of the SvxLink node. This parameter should
alsways be 901. Example:
always be 901. Example:
MCC=901
.TP
.B APRSPATH
@ -116,8 +117,9 @@ Example:
TIME_BETWEEN_SDS=360
.TP
.B INIT_PEI
The initialisation commands that are send to the Tetra radio to enable a
bi-drectional communication whes SvxLink is starting. Example:
If PEI_INIT_FILE is defined INIT_PEI will be ignored!
The initialization commands that are send to the Tetra radio to enable a
bi-directional communication while SvxLink is starting. Example:
INIT_PEI=AT+CTOM=1;AT+CTSP=1,3,131;AT+CTSP=1,3,130;AT+CTSP=1,2,20
.TP
.B TETRA_USERS
@ -138,8 +140,8 @@ The format is:
.TP
.B SDS_TO_COMMAND
The section name that contain a list of status codes in decimal notation and the
according command that will be executed when the state sds has been received.
The idea behind is the possibility to connect/disconntct links.
according command that will be executed when the state Sds has been received.
The idea behind is the possibility to connect/disconnect links.
Example:
SDS_TO_COMMAND=SdsToCommand
the format is:
@ -168,7 +170,7 @@ DMO_ON, DMO_OFF and PROXIMITY.
DMO_ON: a sds is send to all active station to inform that a user has changed
it's state
to DMO mode.
DMO_OFF: a sds is send to all active stations to inform that a user has
DMO_OFF: a Sds is send to all active stations to inform that a user has
canceled DMO mode (e.g. switched to TMO).
PROXIMITY: a Sds is send to all active stations to inform that a user is active
and in the vicinity (max. 3 km away)
@ -209,19 +211,33 @@ DEBUG=2 # enable Info logging
.B END_CMD
The command that is sent last to the MS shortly before SvxLink is terminated.
It is intended for the case that the MS is in TX and SvxLink is stopped
manually. In this case dsd MS would remain in TX mode, which must be
manually. In this case the MS would remain in TX mode, which must be
prevented. However, it is not guaranteed that the execution will work if
SvxLink crashes due to a segmentation fault.
Example:
END_CMD=ATH
.TP
.B SHARE_USERDATA
If enabled the node sends and receives userspecific information to/from the
If enabled the node sends and receives user specific information to/from the
SvxReflector, e.g. Location information, ISSI, name, APRS icons, last activity
and so on. This parameter is enabled by default.
.TP
.B PEI_INIT_FILE
If set SvxLink reads the AT commands to initialize the Tetra radio from a
json-file. An example file is included in the sources.
This file corresponds with the TETRA_MODE that defines the initial line in
the json file that contain the needed AT commands to initialize the radio.
.TP
.B TETRA_MODE
If PEI_INIT_FILE is set this parameter defines in which mode the Tetra radio
will be initialized. Valid values are:
TMO - initializes the device in TMO mode
DMO-MS - initializes the device in normal DMO mode
DMO-RPT - initializes the device in repeater mode
GATEWAY - initializes the device in gateway mode
.TP
.B DAPNET_SERVER
The hosname of the DAPNet master, should alsways be:
The hosname of the DAPNet master, should always be:
DAPNET_SERVER=dapnet.afu.rwth-aachen.de
.TP
.B DAPNET_PORT
@ -229,7 +245,7 @@ The tcp port to connect to the DAPNet master, should always be
DAPNET_PORT=43434
.TP
.B DAPNET_CALLSIGN
The callsign which is used for the connection to the master server.
The call sign which is used for the connection to the master server.
This DAPNET_CALLSIGN can differ from the one that was configured in the Logic
section as CALLSIGN, as a different one may have to be used for the DAPNET
login (e.g. DL1HRC -> dl1hrc1).
@ -253,7 +269,7 @@ DAPNET_RUBRIC_REGISTRATION=RicRegistration
234342=1001,3232
.TP
.B DAPNET_USERNAME
The username (usually the callsign) used for login on www.hampager.de.
The username (usually the call sign) used for login on www.hampager.de.
it is required to send messages via the website's API.
.TP
.B DAPNET_PASSWORD

View File

@ -12,6 +12,8 @@ GSSI=1
MNC=16383
MCC=901
INIT_PEI=AT+CTOM=1;AT+CTSP=1,3,131;AT+CTSP=1,3,130;AT+CTSP=1,3,138;AT+CTSP=1,2,20;AT+CTSP=2,0,0;AT+CTSP=1,3,24;AT+CTSP=1,3,25;AT+CTSP=1,3,3;AT+CTSP=1,3,10;AT+CTSP=1,1,11;AT+CTSDC=0,0,0,1,1,0,1,1,0,0
#MODE=DMO-MS
#PEI_INIT_FILE=@SVX_SYSCONF_INSTALL_DIR@/pei-init.json
SHORT_IDENT_INTERVAL=60
LONG_IDENT_INTERVAL=60
#IDENT_ONLY_AFTER_TX=4

View File

@ -131,7 +131,7 @@ using namespace SvxLink;
#define MAX_TRIES 5
#define TETRA_LOGIC_VERSION "26102022"
#define TETRA_LOGIC_VERSION "01112022"
/****************************************************************************
*
@ -318,7 +318,7 @@ bool TetraLogic::initialize(Async::Config& cfgobj, const std::string& logic_name
t_aprs_tab = value[1];
}
}
// the pty path: inject messages to send by Sds
string sds_pty_path;
cfg().getValue(name(), "SDS_PTY", sds_pty_path);
@ -462,6 +462,77 @@ bool TetraLogic::initialize(Async::Config& cfgobj, const std::string& logic_name
}
}
// the init-pei file where init AT commands are defined
std::string pei_init_file;
if (cfg().getValue(name(), "PEI_INIT_FILE", pei_init_file))
{
std::ifstream pei_init_is(pei_init_file.c_str(), std::ios::in);
if (pei_init_is.good())
{
try
{
if (!(pei_init_is >> m_pei_init))
{
std::cerr << "*** ERROR: Failure while reading pei-init information file "
"\"" << pei_init_file << "\""
<< std::endl;
isok = false;
}
}
catch (const Json::Exception& e)
{
std::cerr << "*** ERROR: Failure while reading pei-init information "
"file \"" << pei_init_file << "\": "
<< e.what()
<< std::endl;
isok = false;
}
}
else
{
std::cerr << "*** ERROR: Could not open pei-init information file "
"\"" << pei_init_file << "\""
<< std::endl;
isok = false;
}
// valid: TMO, DMO-MS, DMO-REPEATER, GATEWAY
std::string tetra_mode = "DMO-MS";
cfg().getValue(name(), "TETRA_MODE", tetra_mode);
for (Json::Value::ArrayIndex i = 0; i < m_pei_init.size(); i++)
{
Json::Value& t_peiinit = m_pei_init[i];
if (tetra_mode == t_peiinit.get("mode","").asString())
{
Json::Value& t_a = t_peiinit["commands"];
if (debug >= LOGDEBUG)
{
cout << "+++ Init commands to PEI-device:" << endl;
}
for (Json::Value::ArrayIndex j = 0; j < t_a.size(); j++)
{
m_cmds.push_back(t_a[j].asString());
if (debug >= LOGDEBUG)
{
cout << " " << t_a[j].asString() << endl;
}
}
}
}
}
else
{
// init the Pei device
if (!cfg().getValue(name(), "INIT_PEI", initstr))
{
log(LOGWARN, "Warning: Missing parameter " + name()
+ "/INIT_PEI, using defaults");
}
SvxLink::splitStr(initcmds, initstr, ";");
m_cmds = initcmds;
}
// define sds messages send to user when received Sds's from him due to
// state changes
std::string sds_useractivity;
@ -581,15 +652,6 @@ bool TetraLogic::initialize(Async::Config& cfgobj, const std::string& logic_name
time_between_sds = atoi(value.c_str());
}
// init the Pei device
if (!cfg().getValue(name(), "INIT_PEI", initstr))
{
log(LOGWARN, "Warning: Missing parameter " + name()
+ "/INIT_PEI, using defaults");
}
SvxLink::splitStr(initcmds, initstr, ";");
m_cmds = initcmds;
cfg().getValue(name(), "END_CMD", endCmd);
std::string dapnet_server;

View File

@ -331,6 +331,7 @@ class TetraLogic : public Logic
bool cmgs_received;
bool share_userinfo;
Json::Value m_user_info;
Json::Value m_pei_init;
int current_cci;
int dmnc;
int dmcc;