2017-05-01 15:46:43 +02:00
|
|
|
/*
|
2025-03-15 18:03:06 +01:00
|
|
|
* Copyright (C) 2017,2020,2025 by Jonathan Naylor G4KLX
|
2017-05-01 15:46:43 +02:00
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-03 16:25:33 +02:00
|
|
|
#if !defined(XLXVoice_H)
|
|
|
|
|
#define XLXVoice_H
|
2017-05-01 15:46:43 +02:00
|
|
|
|
2017-05-01 21:05:41 +02:00
|
|
|
#include "DMREmbeddedData.h"
|
2017-05-01 15:46:43 +02:00
|
|
|
#include "StopWatch.h"
|
|
|
|
|
#include "DMRData.h"
|
2017-05-01 21:05:41 +02:00
|
|
|
#include "DMRLC.h"
|
2017-05-01 15:46:43 +02:00
|
|
|
#include "Timer.h"
|
|
|
|
|
|
|
|
|
|
#include <string>
|
2017-05-01 21:05:41 +02:00
|
|
|
#include <vector>
|
2017-10-01 09:10:08 +02:00
|
|
|
#include <unordered_map>
|
2017-05-01 15:46:43 +02:00
|
|
|
|
2025-03-15 18:03:06 +01:00
|
|
|
enum class XLXVOICE_STATUS {
|
|
|
|
|
NONE,
|
|
|
|
|
WAITING,
|
|
|
|
|
SENDING
|
2017-05-01 15:46:43 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-03 17:54:35 +02:00
|
|
|
struct CXLXPositions {
|
2017-05-02 22:02:37 +02:00
|
|
|
unsigned int m_start;
|
|
|
|
|
unsigned int m_length;
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-03 16:25:33 +02:00
|
|
|
class CXLXVoice {
|
2017-05-01 15:46:43 +02:00
|
|
|
public:
|
2020-04-03 16:25:33 +02:00
|
|
|
CXLXVoice(const std::string& directory, const std::string& language, unsigned int id, unsigned int slot, unsigned int tg);
|
|
|
|
|
~CXLXVoice();
|
2017-05-01 15:46:43 +02:00
|
|
|
|
|
|
|
|
bool open();
|
|
|
|
|
|
2022-02-17 10:36:23 +01:00
|
|
|
void linkedTo(const std::string &number, unsigned int room);
|
2017-05-01 15:46:43 +02:00
|
|
|
void unlinked();
|
|
|
|
|
|
2021-03-20 13:03:19 +01:00
|
|
|
void reset();
|
|
|
|
|
|
2017-05-01 15:46:43 +02:00
|
|
|
bool read(CDMRData& data);
|
|
|
|
|
|
|
|
|
|
void clock(unsigned int ms);
|
|
|
|
|
|
|
|
|
|
private:
|
2017-05-01 21:05:41 +02:00
|
|
|
std::string m_indxFile;
|
|
|
|
|
std::string m_ambeFile;
|
|
|
|
|
unsigned int m_slot;
|
|
|
|
|
CDMRLC m_lc;
|
|
|
|
|
CDMREmbeddedData m_embeddedLC;
|
2020-04-03 17:54:35 +02:00
|
|
|
XLXVOICE_STATUS m_status;
|
2017-05-01 21:05:41 +02:00
|
|
|
CTimer m_timer;
|
|
|
|
|
CStopWatch m_stopWatch;
|
|
|
|
|
unsigned int m_seqNo;
|
|
|
|
|
unsigned int m_streamId;
|
|
|
|
|
unsigned int m_sent;
|
|
|
|
|
unsigned char* m_ambe;
|
2020-04-03 17:54:35 +02:00
|
|
|
std::unordered_map<std::string, CXLXPositions*> m_positions;
|
2017-05-01 21:05:41 +02:00
|
|
|
std::vector<CDMRData*> m_data;
|
|
|
|
|
std::vector<CDMRData*>::const_iterator m_it;
|
|
|
|
|
|
|
|
|
|
void createHeaderTerminator(unsigned char type);
|
2017-09-29 22:41:22 +02:00
|
|
|
void createVoice(const std::vector<std::string>& words);
|
2017-05-01 15:46:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|