First audio prototype, still need large cleanup

feature/AudioLoginLogoff
Geoffrey Merck 6 years ago
parent 170d0eed9d
commit 6a9ea255b5

@ -22,6 +22,9 @@
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <stdio.h> #include <stdio.h>
#include <fstream>
#include <cctype>
#include <string>
#include "DStarDefines.h" #include "DStarDefines.h"
#include "HeaderData.h" #include "HeaderData.h"
@ -36,7 +39,7 @@ TEXT_LANG CAudioUnit::m_language = TL_ENGLISH_UK;
const unsigned int MAX_FRAMES = 60U * DSTAR_FRAMES_PER_SEC; const unsigned int MAX_FRAMES = 60U * DSTAR_FRAMES_PER_SEC;
const unsigned int SILENCE_LENGTH = 10U; const unsigned int SILENCE_LENGTH = 10U;//Number of silence frames
void CAudioUnit::initialise() void CAudioUnit::initialise()
{ {
@ -114,18 +117,17 @@ void CAudioUnit::finalise()
delete[] m_ambe; delete[] m_ambe;
} }
CAudioUnit::CAudioUnit(IRepeaterCallback* handler, const std::string& callsign) : CAudioUnit::CAudioUnit(CG2ProtocolHandler* handler) :
m_handler(handler), m_handler(handler),
m_callsign(callsign), // m_callsign(callsign),
m_encoder(), m_encoder(),
m_status(AS_IDLE), m_status(AS_IDLE),
m_linkStatus(LS_NONE), m_ackType(AT_LOGIN),
m_tempLinkStatus(LS_NONE), m_groupName(),
m_text(), m_user(),
m_tempText(), m_repeater(),
m_reflector(), m_gateway(),
m_tempReflector(), m_destination(),
m_hasTemporary(false),
m_timer(1000U, REPLY_TIME), m_timer(1000U, REPLY_TIME),
m_data(NULL), m_data(NULL),
m_in(0U), m_in(0U),
@ -158,19 +160,29 @@ void CAudioUnit::sendStatus()
m_timer.start(); m_timer.start();
} }
void CAudioUnit::setStatus(LINK_STATUS status, const std::string& reflector, const std::string& text) // void CAudioUnit::setStatus(LINK_STATUS status, const std::string& reflector, const std::string& text)
// {
// m_linkStatus = status;
// m_reflector = reflector;
// m_text = text;
// }
// void CAudioUnit::setTempStatus(LINK_STATUS status, const std::string& reflector, const std::string& text)
// {
// m_tempLinkStatus = status;
// m_tempReflector = reflector;
// m_tempText = text;
// m_hasTemporary = true;
// }
void CAudioUnit::setAck(ACK_TYPE ackType, const std::string& groupName, const std::string& user, const std::string& repeater, const std::string& gateway, const in_addr& destination)
{ {
m_linkStatus = status; m_ackType = ackType;
m_reflector = reflector; m_groupName = groupName;
m_text = text; m_user = user;
} m_repeater = repeater;
m_gateway = gateway;
void CAudioUnit::setTempStatus(LINK_STATUS status, const std::string& reflector, const std::string& text) m_destination = destination;
{
m_tempLinkStatus = status;
m_tempReflector = reflector;
m_tempText = text;
m_hasTemporary = true;
} }
void CAudioUnit::clock(unsigned int ms) void CAudioUnit::clock(unsigned int ms)
@ -178,12 +190,8 @@ void CAudioUnit::clock(unsigned int ms)
m_timer.clock(ms); m_timer.clock(ms);
if (m_status == AS_WAIT && m_timer.hasExpired()) { if (m_status == AS_WAIT && m_timer.hasExpired()) {
if (m_hasTemporary) {
sendStatus(m_tempLinkStatus, m_tempReflector, m_tempText); sendAck(m_ackType, m_groupName, m_user, m_repeater, m_gateway, m_destination);
m_hasTemporary = false;
} else {
sendStatus(m_linkStatus, m_reflector, m_text);
}
m_timer.stop(); m_timer.stop();
@ -209,7 +217,7 @@ void CAudioUnit::clock(unsigned int ms)
if (m_in == m_out) if (m_in == m_out)
data->setEnd(true); data->setEnd(true);
m_handler->process(*data, DIR_INCOMING, AS_INFO); m_handler->writeAMBE(*data);
delete data; delete data;
@ -242,7 +250,7 @@ void CAudioUnit::cancel()
m_timer.stop(); m_timer.stop();
} }
bool CAudioUnit::lookup(unsigned int id, const std::string &name) bool CAudioUnit::lookup(unsigned int id, const std::string &name, const in_addr& destination)
{ {
CIndexRecord* info = m_index[name]; CIndexRecord* info = m_index[name];
if (info == NULL) { if (info == NULL) {
@ -259,6 +267,7 @@ bool CAudioUnit::lookup(unsigned int id, const std::string &name)
CAMBEData* dataOut = new CAMBEData; CAMBEData* dataOut = new CAMBEData;
dataOut->setSeq(m_seqNo); dataOut->setSeq(m_seqNo);
dataOut->setId(id); dataOut->setId(id);
dataOut->setDestination(destination, G2_DV_PORT);
unsigned char buffer[DV_FRAME_LENGTH_BYTES]; unsigned char buffer[DV_FRAME_LENGTH_BYTES];
memcpy(buffer + 0U, dataIn, VOICE_FRAME_LENGTH_BYTES); memcpy(buffer + 0U, dataIn, VOICE_FRAME_LENGTH_BYTES);
@ -284,48 +293,48 @@ bool CAudioUnit::lookup(unsigned int id, const std::string &name)
return true; return true;
} }
void CAudioUnit::spellReflector(unsigned int id, const std::string &reflector) // void CAudioUnit::spellReflector(unsigned int id, const std::string &reflector)
{ // {
unsigned int length = reflector.size(); // unsigned int length = reflector.size();
for (unsigned int i = 0; i < (length - 1); i++) { // for (unsigned int i = 0; i < (length - 1); i++) {
std::string c = reflector.substr(i, 1); // std::string c = reflector.substr(i, 1);
if (c.compare(" ")) // if (c.compare(" "))
lookup(id, c); // lookup(id, c);
} // }
char c = reflector.at(length - 1); // char c = reflector.at(length - 1);
if (c == ' ') // if (c == ' ')
return; // return;
std::string cstr; // std::string cstr;
cstr.push_back(c); // cstr.push_back(c);
if (m_linkStatus == LS_LINKING_DCS || m_linkStatus == LS_LINKED_DCS || // if (m_linkStatus == LS_LINKING_DCS || m_linkStatus == LS_LINKED_DCS ||
m_linkStatus == LS_LINKING_CCS || m_linkStatus == LS_LINKED_CCS) { // m_linkStatus == LS_LINKING_CCS || m_linkStatus == LS_LINKED_CCS) {
lookup(id, cstr); // lookup(id, cstr);
return; // return;
} // }
switch (c) { // switch (c) {
case 'A': // case 'A':
lookup(id, "alpha"); // lookup(id, "alpha");
break; // break;
case 'B': // case 'B':
lookup(id, "bravo"); // lookup(id, "bravo");
break; // break;
case 'C': // case 'C':
lookup(id, "charlie"); // lookup(id, "charlie");
break; // break;
case 'D': // case 'D':
lookup(id, "delta"); // lookup(id, "delta");
break; // break;
default: // default:
lookup(id, cstr); // lookup(id, cstr);
break; // break;
} // }
} // }
bool CAudioUnit::readAMBE(const std::string& name) bool CAudioUnit::readAMBE(const std::string& name)
{ {
@ -355,7 +364,7 @@ bool CAudioUnit::readAMBE(const std::string& name)
unsigned char buffer[VOICE_FRAME_LENGTH_BYTES]; unsigned char buffer[VOICE_FRAME_LENGTH_BYTES];
size_t n = fread(buffer, 4, 1, file); size_t n = fread(buffer, 1, 4, file);
if (n != 4) { if (n != 4) {
printf("Unable to read the header from %s\n", fileName.c_str()); printf("Unable to read the header from %s\n", fileName.c_str());
fclose(file); fclose(file);
@ -368,19 +377,19 @@ bool CAudioUnit::readAMBE(const std::string& name)
return false; return false;
} }
// Length of the file minus the header // Length of the file minus the header length
unsigned int length = fsize - 4U; unsigned int length = fsize - 4U;
// Hold the file data plus silence at the end // Hold the file data plus silence at the beginning
m_ambe = new unsigned char[length + SILENCE_LENGTH * VOICE_FRAME_LENGTH_BYTES]; m_ambe = new unsigned char[length + SILENCE_LENGTH * VOICE_FRAME_LENGTH_BYTES];
m_ambeLength = length / VOICE_FRAME_LENGTH_BYTES; m_ambeLength = (SILENCE_LENGTH + length) / VOICE_FRAME_LENGTH_BYTES;
// Add silence to the beginning of the buffer // Add silence to the beginning of the buffer
unsigned char* p = m_ambe; unsigned char* p = m_ambe;
for (unsigned int i = 0U; i < SILENCE_LENGTH; i++, p += VOICE_FRAME_LENGTH_BYTES) for (unsigned int i = 0U; i < SILENCE_LENGTH; i++, p += VOICE_FRAME_LENGTH_BYTES)
memcpy(p, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES); memcpy(p, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES);
n = fread(p, length, 1, file); n = fread(p, 1, length, file);
if (n != length) { if (n != length) {
printf("Unable to read the AMBE data from %s\n", fileName.c_str()); printf("Unable to read the AMBE data from %s\n", fileName.c_str());
fclose(file); fclose(file);
@ -411,8 +420,8 @@ bool CAudioUnit::readIndex(const std::string& name)
} }
} }
FILE *file = fopen(fileName.c_str(), "r"); std::ifstream file(fileName);
if (NULL == file) { if (!file.is_open()) {
printf("Cannot open %s for reading\n", fileName.c_str()); printf("Cannot open %s for reading\n", fileName.c_str());
return false; return false;
} }
@ -422,14 +431,18 @@ bool CAudioUnit::readIndex(const std::string& name)
printf("Reading %s\n", fileName.c_str()); printf("Reading %s\n", fileName.c_str());
char line[128]; std::string line;
while (fgets(line, 128, file)) { while (std::getline(file, line)) {
if (strlen(line) && '#'!=line[0]) { if (!line.empty() && '#'!=line[0]) {
//ToDo F4FXL 2020-03-14 clean this up
char linec[128];
strcpy(linec, line.c_str());
const std::string space(" \t\r\n"); const std::string space(" \t\r\n");
std::string name(strtok(line, space.c_str())); std::string name(strtok(linec, space.c_str()));
std::string strt(strtok(NULL, space.c_str())); std::string strt(strtok(NULL, space.c_str()));
std::string leng(strtok(NULL, space.c_str())); std::string leng(strtok(NULL, space.c_str()));
///End ToDo
if (name.size() && strt.size() && leng.size()) { if (name.size() && strt.size() && leng.size()) {
unsigned long start = std::stoul(strt); unsigned long start = std::stoul(strt);
@ -443,62 +456,102 @@ bool CAudioUnit::readIndex(const std::string& name)
} }
} }
fclose(file);
return true; return true;
} }
void CAudioUnit::sendStatus(LINK_STATUS status, const std::string& reflector, const std::string &text) void CAudioUnit::sendAck(ACK_TYPE ackType, const std::string& groupName, const std::string& user, const std::string& repeater, const std::string& gateway, const in_addr& destination)
{ {
m_encoder.setTextData(text); unsigned int id = CHeaderData::createId();
// Create the message CHeaderData header(groupName, " ", user, gateway, repeater);
unsigned int id = CHeaderData::createId(); header.setDestination(destination, G2_DV_PORT);
header.setId(id);
lookup(id, " ");
lookup(id, " "); lookup(id, " ", destination);
lookup(id, " ");
lookup(id, " "); switch (ackType)
{
bool found; case AT_LOGIN:
m_encoder.setTextData("Logged in");
switch (status) { lookup(id, "logged-in", destination);
case LS_NONE: break;
lookup(id, "notlinked"); case AT_LOGOFF:
break; m_encoder.setTextData("Logged in");
case LS_LINKED_CCS: lookup(id, "logged-off", destination);
case LS_LINKED_DCS: break;
// case LS_LINKED_DPLUS: default:
case LS_LINKED_DEXTRA: m_encoder.setTextData("Doh !");
case LS_LINKED_LOOPBACK: break;
found = lookup(id, "linkedto"); }
if (!found) {
lookup(id, "linked"); lookup(id, " ", destination);
lookup(id, "2");
}
spellReflector(id, reflector);
break;
default:
found = lookup(id, "linkingto");
if (!found) {
lookup(id, "linking");
lookup(id, "2");
}
spellReflector(id, reflector);
break;
}
lookup(id, " "); spellGroup(id, groupName, destination);
lookup(id, " ");
lookup(id, " ");
lookup(id, " ");
// RPT1 and RPT2 will be filled in later m_handler->writeHeader(header);
CHeaderData header; }
header.setMyCall1(m_callsign);
header.setMyCall2("INFO");
header.setYourCall("CQCQCQ ");
header.setId(id);
m_handler->process(header, DIR_INCOMING, AS_INFO); void CAudioUnit::spellGroup(unsigned int id, const std::string& groupName, const in_addr& destination)
{
for(auto it = groupName.begin(); it != groupName.end();it++)
{
std::string cstr;
cstr.push_back(std::tolower((*it)));
lookup(id, cstr, destination);
}
} }
// void CAudioUnit::sendStatus(LINK_STATUS status, const std::string& reflector, const std::string &text)
// {
// m_encoder.setTextData(text);
// // Create the message
// unsigned int id = CHeaderData::createId();
// lookup(id, " ");
// lookup(id, " ");
// lookup(id, " ");
// lookup(id, " ");
// bool found;
// switch (status) {
// case LS_NONE:
// lookup(id, "notlinked");
// break;
// case LS_LINKED_CCS:
// case LS_LINKED_DCS:
// // case LS_LINKED_DPLUS:
// case LS_LINKED_DEXTRA:
// case LS_LINKED_LOOPBACK:
// found = lookup(id, "linkedto");
// if (!found) {
// lookup(id, "linked");
// lookup(id, "2");
// }
// spellReflector(id, reflector);
// break;
// default:
// found = lookup(id, "linkingto");
// if (!found) {
// lookup(id, "linking");
// lookup(id, "2");
// }
// spellReflector(id, reflector);
// break;
// }
// lookup(id, " ");
// lookup(id, " ");
// lookup(id, " ");
// lookup(id, " ");
// // RPT1 and RPT2 will be filled in later
// CHeaderData header;
// header.setMyCall1(m_callsign);
// header.setMyCall2("INFO");
// header.setYourCall("CQCQCQ ");
// header.setId(id);
// m_handler->process(header, DIR_INCOMING, AS_INFO);
// }

@ -23,7 +23,7 @@
#include <map> #include <map>
#include <chrono> #include <chrono>
#include "RepeaterCallback.h" #include "G2ProtocolHandler.h"
#include "SlowDataEncoder.h" #include "SlowDataEncoder.h"
#include "AMBEData.h" #include "AMBEData.h"
#include "Timer.h" #include "Timer.h"
@ -65,15 +65,23 @@ enum AUDIO_STATUS {
AS_TRANSMIT AS_TRANSMIT
}; };
enum ACK_TYPE
{
AT_LOGIN,
AT_LOGOFF
};
class CAudioUnit { class CAudioUnit {
public: public:
CAudioUnit(IRepeaterCallback* handler, const std::string& callsign); CAudioUnit(CG2ProtocolHandler* handler);
~CAudioUnit(); ~CAudioUnit();
void sendStatus(); void sendStatus();
void setStatus(LINK_STATUS status, const std::string& reflector, const std::string& text); // void setStatus(LINK_STATUS status, const std::string& reflector, const std::string& text);
void setTempStatus(LINK_STATUS status, const std::string& reflector, const std::string& text); // void setTempStatus(LINK_STATUS status, const std::string& reflector, const std::string& text);
void setAck(ACK_TYPE ackType, const std::string& groupeName, const std::string& user, const std::string& repeater, const std::string& gateway, const in_addr& destination);
void cancel(); void cancel();
@ -90,18 +98,23 @@ private:
static unsigned char* m_ambe; static unsigned char* m_ambe;
static unsigned int m_ambeLength; static unsigned int m_ambeLength;
static TEXT_LANG m_language; static TEXT_LANG m_language;
CG2ProtocolHandler* m_handler;
IRepeaterCallback* m_handler; //std::string m_callsign;
std::string m_callsign;
CSlowDataEncoder m_encoder; CSlowDataEncoder m_encoder;
AUDIO_STATUS m_status; AUDIO_STATUS m_status;
LINK_STATUS m_linkStatus; ACK_TYPE m_ackType;
LINK_STATUS m_tempLinkStatus; std::string m_groupName;
std::string m_text; std::string m_user;
std::string m_tempText; std::string m_repeater;
std::string m_reflector; std::string m_gateway;
std::string m_tempReflector; in_addr m_destination;
bool m_hasTemporary; // LINK_STATUS m_linkStatus;
// LINK_STATUS m_tempLinkStatus;
// std::string m_text;
// std::string m_tempText;
// std::string m_reflector;
// std::string m_tempReflector;
// bool m_hasTemporary;
CTimer m_timer; CTimer m_timer;
CAMBEData** m_data; CAMBEData** m_data;
unsigned int m_in; unsigned int m_in;
@ -109,9 +122,12 @@ private:
unsigned int m_seqNo; unsigned int m_seqNo;
std::chrono::high_resolution_clock::time_point m_time; std::chrono::high_resolution_clock::time_point m_time;
bool lookup(unsigned int id, const std::string& name); bool lookup(unsigned int id, const std::string& name, const in_addr& destination);
void spellReflector(unsigned int id, const std::string& reflector); // void spellReflector(unsigned int id, const std::string& reflector);
void sendStatus(LINK_STATUS status, const std::string& reflector, const std::string& text); // void sendStatus(LINK_STATUS status, const std::string& reflector, const std::string& text);
void sendAck(ACK_TYPE ackType, const std::string& groupeName, const std::string& user, const std::string& repeater, const std::string& gateway, const in_addr& destination);
void spellGroup(unsigned int id, const std::string& groupName, const in_addr& destination);
static bool readAMBE(const std::string& name); static bool readAMBE(const std::string& name);
static bool readIndex(const std::string& name); static bool readIndex(const std::string& name);

@ -302,6 +302,7 @@ m_linkGateway(),
m_linkStatus(LS_NONE), m_linkStatus(LS_NONE),
m_oldlinkStatus(LS_INIT), m_oldlinkStatus(LS_INIT),
m_linkTimer(1000U, NETWORK_TIMEOUT), m_linkTimer(1000U, NETWORK_TIMEOUT),
m_audioUnit(NULL),
m_id(0x00U), m_id(0x00U),
m_announceTimer(1000U, 2U * 60U), // 2 minutes m_announceTimer(1000U, 2U * 60U), // 2 minutes
m_userTimeout(userTimeout), m_userTimeout(userTimeout),
@ -823,6 +824,10 @@ bool CGroupHandler::linkInt()
void CGroupHandler::clockInt(unsigned int ms) void CGroupHandler::clockInt(unsigned int ms)
{ {
if(m_audioUnit != NULL)
{
m_audioUnit->clock(ms);
}
m_linkTimer.clock(ms); m_linkTimer.clock(ms);
if (m_linkTimer.isRunning() && m_linkTimer.hasExpired()) { if (m_linkTimer.isRunning() && m_linkTimer.hasExpired()) {
m_linkTimer.stop(); m_linkTimer.stop();
@ -857,11 +862,12 @@ void CGroupHandler::clockInt(unsigned int ms)
CUserData* user = m_cache->findUser(callsign); CUserData* user = m_cache->findUser(callsign);
if (user) { if (user) {
if (tx->isLogin()) { if (tx->isLogin()) {
sendAck(*user, "Logged in"); sendAck(*user, AT_LOGIN);
} else if (tx->isInfo()) { } else if (tx->isInfo()) {
sendAck(*user, m_infoText); //TODO F4FXL 2020-03-15 Audio Info ?
//sendAck(*user, m_infoText);
} else if (tx->isLogoff()) { } else if (tx->isLogoff()) {
sendAck(*user, "Logged off"); sendAck(*user, AT_LOGOFF);
} }
delete user; delete user;
@ -1051,48 +1057,54 @@ void CGroupHandler::sendFromText(const std::string &my) const
} }
} }
void CGroupHandler::sendAck(const CUserData &user, const std::string &text) const void CGroupHandler::sendAck(const CUserData &user, ACK_TYPE ackType)
{ {
unsigned int id = CHeaderData::createId(); if(m_audioUnit == NULL)
{
CHeaderData header(m_groupCallsign, " ", user.getUser(), user.getGateway(), user.getRepeater()); m_audioUnit = new CAudioUnit(m_g2Handler);
header.setDestination(user.getAddress(), G2_DV_PORT);
header.setId(id);
m_g2Handler->writeHeader(header);
CSlowDataEncoder slowData;
slowData.setTextData(text);
CAMBEData data;
data.setId(id);
data.setDestination(user.getAddress(), G2_DV_PORT);
unsigned char buffer[DV_FRAME_MAX_LENGTH_BYTES];
::memcpy(buffer + 0U, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES);
for (unsigned int i = 0U; i < 20U; i++) {
if (i == 0U) {
// The first AMBE packet is a sync
::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES);
data.setData(buffer, DV_FRAME_LENGTH_BYTES);
data.setSeq(i);
} else if (i == 19U) {
// The last packet of the ack
::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, END_PATTERN_BYTES, END_PATTERN_LENGTH_BYTES);
data.setData(buffer, DV_FRAME_MAX_LENGTH_BYTES);
data.setSeq(i);
data.setEnd(true);
} else {
// The packets containing the text data
unsigned char slowDataBuffer[DATA_FRAME_LENGTH_BYTES];
slowData.getTextData(slowDataBuffer);
::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, slowDataBuffer, DATA_FRAME_LENGTH_BYTES);
data.setData(buffer, DV_FRAME_LENGTH_BYTES);
data.setSeq(i);
}
m_g2Handler->writeAMBE(data);
} }
m_audioUnit->setAck(ackType, m_groupCallsign, user.getUser(), user.getRepeater(), user.getGateway(), user.getAddress());
m_audioUnit->sendStatus();
// unsigned int id = CHeaderData::createId();
// CHeaderData header(m_groupCallsign, " ", user.getUser(), user.getGateway(), user.getRepeater());
// header.setDestination(user.getAddress(), G2_DV_PORT);
// header.setId(id);
// m_g2Handler->writeHeader(header);
// CSlowDataEncoder slowData;
// slowData.setTextData(text);
// CAMBEData data;
// data.setId(id);
// data.setDestination(user.getAddress(), G2_DV_PORT);
// unsigned char buffer[DV_FRAME_MAX_LENGTH_BYTES];
// ::memcpy(buffer + 0U, NULL_AMBE_DATA_BYTES, VOICE_FRAME_LENGTH_BYTES);
// for (unsigned int i = 0U; i < 20U; i++) {
// if (i == 0U) {
// // The first AMBE packet is a sync
// ::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, DATA_SYNC_BYTES, DATA_FRAME_LENGTH_BYTES);
// data.setData(buffer, DV_FRAME_LENGTH_BYTES);
// data.setSeq(i);
// } else if (i == 19U) {
// // The last packet of the ack
// ::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, END_PATTERN_BYTES, END_PATTERN_LENGTH_BYTES);
// data.setData(buffer, DV_FRAME_MAX_LENGTH_BYTES);
// data.setSeq(i);
// data.setEnd(true);
// } else {
// // The packets containing the text data
// unsigned char slowDataBuffer[DATA_FRAME_LENGTH_BYTES];
// slowData.getTextData(slowDataBuffer);
// ::memcpy(buffer + VOICE_FRAME_LENGTH_BYTES, slowDataBuffer, DATA_FRAME_LENGTH_BYTES);
// data.setData(buffer, DV_FRAME_LENGTH_BYTES);
// data.setSeq(i);
// }
// m_g2Handler->writeAMBE(data);
// }
} }
void CGroupHandler::linkUp(DSTAR_PROTOCOL, const std::string &callsign) void CGroupHandler::linkUp(DSTAR_PROTOCOL, const std::string &callsign)

@ -36,6 +36,7 @@
#include "AMBEData.h" #include "AMBEData.h"
#include "IRCDDB.h" #include "IRCDDB.h"
#include "Timer.h" #include "Timer.h"
#include "AudioUnit.h"
enum LOGUSER { enum LOGUSER {
LU_ON, LU_ON,
@ -93,7 +94,7 @@ private:
bool m_info; bool m_info;
bool m_logoff; bool m_logoff;
bool m_end; bool m_end;
CSGSXLUser *m_user; CSGSXLUser *m_user;
CTextCollector m_textCollector; CTextCollector m_textCollector;
}; };
@ -105,7 +106,8 @@ public:
in_addr m_address; in_addr m_address;
}; };
class CGroupHandler : public IReflectorCallback { class CGroupHandler : public IReflectorCallback, IRepeaterCallback
{
public: public:
static void add(const std::string &callsign, const std::string &logoff, const std::string &repeater, const std::string &infoText, const std::string &permanent, static void add(const std::string &callsign, const std::string &logoff, const std::string &repeater, const std::string &infoText, const std::string &permanent,
unsigned int userTimeout, CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string & eflector); unsigned int userTimeout, CALLSIGN_SWITCH callsignSwitch, bool txMsgSwitch, const std::string & eflector);
@ -179,6 +181,8 @@ private:
CTimer m_linkTimer; CTimer m_linkTimer;
DSTAR_LINKTYPE m_linkType; DSTAR_LINKTYPE m_linkType;
CAudioUnit *m_audioUnit;
unsigned int m_id; unsigned int m_id;
CTimer m_announceTimer; CTimer m_announceTimer;
unsigned int m_userTimeout; unsigned int m_userTimeout;
@ -192,6 +196,6 @@ private:
void sendFromText(const std::string &text) const; void sendFromText(const std::string &text) const;
void sendToRepeaters(CHeaderData &header) const; void sendToRepeaters(CHeaderData &header) const;
void sendToRepeaters(CAMBEData &data) const; void sendToRepeaters(CAMBEData &data) const;
void sendAck(const CUserData &user, const std::string &text) const; void sendAck(const CUserData &user, ACK_TYPE ackType);
void logUser(LOGUSER lu, const std::string channel, const std::string user); void logUser(LOGUSER lu, const std::string channel, const std::string user);
}; };

Loading…
Cancel
Save

Powered by TurnKey Linux.