mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-23 06:45:39 +08:00
Implement remote command support.
- Defaut port is 7643 (totally arbitrary)
- Using RemoteCommandDMRG, each network can be enabled or disabled (net1 .. net5, xlx):
~ $ RemoteCommandDMRG 7643 disable net2
M: 2021-03-20 11:48:40.494 Command sent: "disable net2" to port: 7643
M: 2021-03-20 11:48:40.545 OK
- Using RemoteCommandDMRG, a connection status can be retrieved:
~ $ RemoteCommandDMRG 7643 status
M: 2021-03-20 11:49:13.513 Command sent: "status" to port: 7643
M: 2021-03-20 11:49:13.563 xlx:conn net1:conn net2:n/a net3:n/a net4:conn net5:n/a
A returned string is expected from the socket connection, this is why I did not reuse the MMDVMHost's RemoteCommand (unless MMDVMHost RemoteControl is modified as well).
The exit value can be used in scripting (also 1 if we didn't get any reply).
This commit is contained in:
15
XLXVoice.cpp
15
XLXVoice.cpp
@@ -195,7 +195,7 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
|
||||
for (unsigned int i = 0U; i < ambeLength; i += AMBE_LENGTH)
|
||||
::memcpy(ambeData + i, SILENCE, AMBE_LENGTH);
|
||||
|
||||
// Put offset in for silence at the beginning
|
||||
// Put offset in for silence at the beginning
|
||||
unsigned int pos = SILENCE_LENGTH * AMBE_LENGTH;
|
||||
for (std::vector<std::string>::const_iterator it = words.begin(); it != words.end(); ++it) {
|
||||
if (m_positions.count(*it) > 0U) {
|
||||
@@ -273,6 +273,19 @@ void CXLXVoice::createVoice(const std::vector<std::string>& words)
|
||||
m_timer.start();
|
||||
}
|
||||
|
||||
void CXLXVoice::reset()
|
||||
{
|
||||
for (std::vector<CDMRData*>::iterator it = m_data.begin(); it != m_data.end(); ++it)
|
||||
delete *it;
|
||||
|
||||
m_timer.stop();
|
||||
m_status = XLXVS_NONE;
|
||||
m_data.clear();
|
||||
m_seqNo = 0U;
|
||||
m_streamId = 0U;
|
||||
m_sent = 0U;
|
||||
}
|
||||
|
||||
bool CXLXVoice::read(CDMRData& data)
|
||||
{
|
||||
if (m_status != XLXVS_SENDING)
|
||||
|
||||
Reference in New Issue
Block a user