Files
DMRGateway/XLXVoice.h
Daniel Caujolle-Bert 41a49d5785 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).
2021-03-20 13:03:19 +01:00

81 lines
2.3 KiB
C++

/*
* Copyright (C) 2017,2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(XLXVoice_H)
#define XLXVoice_H
#include "DMREmbeddedData.h"
#include "StopWatch.h"
#include "DMRData.h"
#include "DMRLC.h"
#include "Timer.h"
#include <string>
#include <vector>
#include <unordered_map>
enum XLXVOICE_STATUS {
XLXVS_NONE,
XLXVS_WAITING,
XLXVS_SENDING
};
struct CXLXPositions {
unsigned int m_start;
unsigned int m_length;
};
class CXLXVoice {
public:
CXLXVoice(const std::string& directory, const std::string& language, unsigned int id, unsigned int slot, unsigned int tg);
~CXLXVoice();
bool open();
void linkedTo(unsigned int number, unsigned int room);
void unlinked();
void reset();
bool read(CDMRData& data);
void clock(unsigned int ms);
private:
std::string m_indxFile;
std::string m_ambeFile;
unsigned int m_slot;
CDMRLC m_lc;
CDMREmbeddedData m_embeddedLC;
XLXVOICE_STATUS m_status;
CTimer m_timer;
CStopWatch m_stopWatch;
unsigned int m_seqNo;
unsigned int m_streamId;
unsigned int m_sent;
unsigned char* m_ambe;
std::unordered_map<std::string, CXLXPositions*> m_positions;
std::vector<CDMRData*> m_data;
std::vector<CDMRData*>::const_iterator m_it;
void createHeaderTerminator(unsigned char type);
void createVoice(const std::vector<std::string>& words);
};
#endif