Merge remote-tracking branch 'origin/tetra-contrib' into tetra-sip-usrp

This commit is contained in:
Adi Bier / DL1HRC 2022-11-10 21:06:01 +01:00
commit 9d8c696a53
4 changed files with 55 additions and 15 deletions

View File

@ -289,6 +289,12 @@ https://github.com/DecentralizedAmateurPagingNetwork/Core/wiki/
.TP
.B DAPNET_TXGROUP
The sender group via which the message is to be sent e.g. de-all
.TP
.B PEI_PTY
If defined a pseudo tty is created. It receives AT commands sent by
a command line or a program and forward it to the PEI device directly.
The idea is to have a debug mode to check the response without stopping
SvxLink.
.
.SH AUTHOR
.

View File

@ -53,6 +53,7 @@ DAPNET_RUBRIC_REGISTRATION=RicRegistration
#DAPNET_WEBPORT=8080
#DAPNET_WEBPATH=/calls
#DAPNET_TXGROUP=dl-all
#PEI_PTY=/tmp/pei_pty
[Ric2ISSI]
# RIC=ISSI

View File

@ -131,7 +131,7 @@ using namespace SvxLink;
#define MAX_TRIES 5
#define TETRA_LOGIC_VERSION "02112022"
#define TETRA_LOGIC_VERSION "10112022"
/****************************************************************************
*
@ -206,7 +206,7 @@ TetraLogic::TetraLogic(void)
proximity_warning(3.1), time_between_sds(3600), own_lat(0.0),
own_lon(0.0), endCmd(""), new_sds(false), inTransmission(false),
cmgs_received(true), share_userinfo(true), current_cci(0), dmnc(0),
dmcc(0), infosds(""), is_tx(false), last_sdsid(0)
dmcc(0), infosds(""), is_tx(false), last_sdsid(0), pei_pty_path(""), pei_pty(0)
{
peiComTimer.expired.connect(mem_fun(*this, &TetraLogic::onComTimeout));
peiActivityTimer.expired.connect(mem_fun(*this,
@ -230,7 +230,6 @@ bool TetraLogic::initialize(Async::Config& cfgobj, const std::string& logic_name
own_lat = getDecimalDegree(LocationInfo::instance()->getCoordinate(true));
own_lon = getDecimalDegree(LocationInfo::instance()->getCoordinate(false));
}
cfg().getValue(name(), "MUTE_RX_ON_TX", mute_rx_on_tx);
cfg().getValue(name(), "MUTE_TX_ON_RX", mute_tx_on_rx);
cfg().getValue(name(), "RGR_SOUND_ALWAYS", rgr_sound_always);
@ -318,7 +317,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);
@ -674,9 +673,25 @@ bool TetraLogic::initialize(Async::Config& cfgobj, const std::string& logic_name
cfg().getValue(name(),"SHARE_USERINFO", share_userinfo);
pei = new Serial(port);
// PEI pty path: inject messages to send to PEI directly
cfg().getValue(name(), "PEI_PTY", pei_pty_path);
if (!pei_pty_path.empty())
{
pei_pty = new Pty(pei_pty_path);
if (!pei_pty->open())
{
cerr << "*** ERROR: Could not open Pei PTY "
<< pei_pty_path << " as specified in configuration variable "
<< name() << "/" << "PEI_PTY" << endl;
isok = false;
}
pei_pty->dataReceived.connect(
mem_fun(*this, &TetraLogic::peiPtyReceived));
}
if (!pei->open(true))
// hadle the Pei serial port
pei = new Serial(port);
if (!pei->open())
{
cerr << "*** ERROR: Opening serial port " << name() << "/PORT="
<< port << endl;
@ -697,7 +712,7 @@ bool TetraLogic::initialize(Async::Config& cfgobj, const std::string& logic_name
rxValveSetOpen(true);
setTxCtrlMode(Tx::TX_AUTO);
processEvent("startup");
cout << ">>> Started SvxLink with special TetraLogic extension (v"
@ -942,7 +957,7 @@ void TetraLogic::handlePeiAnswer(std::string m_message)
int response = handleMessage(m_message);
log(LOGTRACE, "TetraLogic::handlePeiAnswer: reponse=" + to_string(response));
log(LOGTRACE, "TetraLogic::handlePeiAnswer: response=" + to_string(response));
switch (response)
{
@ -2298,6 +2313,22 @@ void TetraLogic::log(uint8_t logtype, std::string logmessage)
}
} /* TetraLogic::log */
// Pty device that receive AT commands and send it to the "real" Pei
void TetraLogic::peiPtyReceived(const void *buf, size_t count)
{
const char *buffer = reinterpret_cast<const char*>(buf);
std::string in = "";
for (size_t i=0; i<count-1; i++)
{
in += *buffer++;
}
log(LOGDEBUG, "Command received by Pty device: " + in);
sendPei(in);
} /* TetraLogic::peiPtyReceived */
/*
* This file has not been truncated
*/

View File

@ -245,7 +245,7 @@ class TetraLogic : public Logic
time_t sent_last_sds = 0;
};
std::map<std::string, User> userdata;
struct DmoRpt {
int issi;
std::string mni;
@ -253,7 +253,7 @@ class TetraLogic : public Logic
time_t last_activity;
};
std::map<int, DmoRpt> dmo_rep_gw;
std::map<int, std::string> sds_on_activity;
std::map<unsigned int, std::string> sds_to_command;
@ -284,13 +284,13 @@ class TetraLogic : public Logic
{
OUTGOING, INCOMING
} SdsDirection;
// type of Sds
typedef enum
{
STATE, TEXT, LIP_SHORT, COMPLEX_SDS_TL, RAW
} SdsType;
// Sds sent state
typedef enum
{
@ -304,7 +304,7 @@ class TetraLogic : public Logic
Async::Timer peiActivityTimer;
Async::Timer peiBreakCommandTimer;
Call* call;
struct pSds {
int sdstype;
int aiservice;
@ -313,7 +313,7 @@ class TetraLogic : public Logic
time_t last_activity;
};
pSds pSDS;
std::map<unsigned int, std::string> state_sds;
StrList m_cmds;
int pending_sdsid;
@ -337,6 +337,8 @@ class TetraLogic : public Logic
std::string infosds;
bool is_tx;
int last_sdsid;
std::string pei_pty_path;
Async::Pty *pei_pty;
void initPei(void);
void onCharactersReceived(char *buf, int count);
@ -384,7 +386,7 @@ class TetraLogic : public Logic
bool checkIfDapmessage(std::string message);
std::string joinList(std::list<std::string> members);
void log(uint8_t type, std::string logmessage);
void peiPtyReceived(const void *buf, size_t count);
}; /* class TetraLogic */