#17 add mising parts, still nedd to glue it all together
parent
0a551fe10e
commit
7f9e1930e8
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2010,2011 by Jonathan Naylor G4KLX
|
||||
* Copyright (c) 2022 by Geoffrey Merck F4FXL / KC3FRA
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "DGWRemoteControlConfig.h"
|
||||
#include "Log.h"
|
||||
|
||||
bool load()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDGWRemoteControlConfig::open(CConfig & cfg)
|
||||
{
|
||||
try {
|
||||
return cfg.load();
|
||||
}
|
||||
catch(...) {
|
||||
CLog::logError("Can't read %s\n", m_fileName.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2010,2011 by Jonathan Naylor G4KLX
|
||||
* Copyright (c) 2022 by Geoffrey Merck F4FXL / KC3FRA
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Config.h"
|
||||
|
||||
typedef struct {
|
||||
std::string callsign;
|
||||
std::string address;
|
||||
} TRemoteGateway;
|
||||
|
||||
class CDGWRemoteControlConfig
|
||||
{
|
||||
public:
|
||||
CDGWRemoteControlConfig(const std::string& pathName);
|
||||
bool load();
|
||||
|
||||
private:
|
||||
bool open(CConfig& config);
|
||||
|
||||
std::string m_fileName;
|
||||
};
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#include "RemoteControlCallsignData.h"
|
||||
|
||||
CRemoteControlCallsignData::CRemoteControlCallsignData() :
|
||||
m_repeaters(),
|
||||
m_starNets()
|
||||
{
|
||||
}
|
||||
|
||||
CRemoteControlCallsignData::~CRemoteControlCallsignData()
|
||||
{
|
||||
}
|
||||
|
||||
void CRemoteControlCallsignData::addRepeater(const std::string& callsign)
|
||||
{
|
||||
m_repeaters.push_back(callsign);
|
||||
}
|
||||
|
||||
void CRemoteControlCallsignData::addStarNet(const std::string& callsign)
|
||||
{
|
||||
m_starNets.push_back(callsign);
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlCallsignData::getRepeaterCount() const
|
||||
{
|
||||
return m_repeaters.size();
|
||||
}
|
||||
|
||||
std::string CRemoteControlCallsignData::getRepeater(unsigned int n) const
|
||||
{
|
||||
return m_repeaters[n];
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlCallsignData::getStarNetCount() const
|
||||
{
|
||||
return m_starNets.size();
|
||||
}
|
||||
|
||||
std::string CRemoteControlCallsignData::getStarNet(unsigned int n) const
|
||||
{
|
||||
return m_starNets[n];
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlCallsignData_H
|
||||
#define RemoteControlCallsignData_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class CRemoteControlCallsignData {
|
||||
public:
|
||||
CRemoteControlCallsignData();
|
||||
~CRemoteControlCallsignData();
|
||||
|
||||
void addRepeater(const std::string& callsign);
|
||||
void addStarNet(const std::string& callsign);
|
||||
|
||||
unsigned int getRepeaterCount() const;
|
||||
unsigned int getStarNetCount() const;
|
||||
|
||||
std::string getRepeater(unsigned int n) const;
|
||||
std::string getStarNet(unsigned int n) const;
|
||||
|
||||
private:
|
||||
std::vector<std::string> m_repeaters;
|
||||
std::vector<std::string> m_starNets;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlDefs_H
|
||||
#define RemoteControlDefs_H
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
const std::string APPLICATION_NAME = wxT("Remote Control");
|
||||
|
||||
const std::string CONFIG_FILE_NAME = wxT(".Remote Control");
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#include "RemoteControlLinkData.h"
|
||||
|
||||
CRemoteControlLinkData::CRemoteControlLinkData(const std::string& callsign, int32_t protocol, int32_t linked, int32_t direction, int32_t dongle) :
|
||||
m_callsign(callsign),
|
||||
m_protocol(PROTOCOL(protocol)),
|
||||
m_linked(false),
|
||||
m_direction(DIRECTION(direction)),
|
||||
m_dongle(false)
|
||||
{
|
||||
m_linked = linked == 1;
|
||||
m_dongle = dongle == 1;
|
||||
}
|
||||
|
||||
CRemoteControlLinkData::~CRemoteControlLinkData()
|
||||
{
|
||||
}
|
||||
|
||||
std::string CRemoteControlLinkData::getCallsign() const
|
||||
{
|
||||
return m_callsign;
|
||||
}
|
||||
|
||||
PROTOCOL CRemoteControlLinkData::getProtocol() const
|
||||
{
|
||||
return m_protocol;
|
||||
}
|
||||
|
||||
bool CRemoteControlLinkData::isLinked() const
|
||||
{
|
||||
return m_linked;
|
||||
}
|
||||
|
||||
DIRECTION CRemoteControlLinkData::getDirection() const
|
||||
{
|
||||
return m_direction;
|
||||
}
|
||||
|
||||
bool CRemoteControlLinkData::isDongle() const
|
||||
{
|
||||
return m_dongle;
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlLinkData_H
|
||||
#define RemoteControlLinkData_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Defs.h"
|
||||
|
||||
|
||||
class CRemoteControlLinkData {
|
||||
public:
|
||||
CRemoteControlLinkData(const std::string& callsign, int32_t protocol, int32_t linked, int32_t direction, int32_t dongle);
|
||||
~CRemoteControlLinkData();
|
||||
|
||||
std::string getCallsign() const;
|
||||
PROTOCOL getProtocol() const;
|
||||
bool isLinked() const;
|
||||
DIRECTION getDirection() const;
|
||||
bool isDongle() const;
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
PROTOCOL m_protocol;
|
||||
bool m_linked;
|
||||
DIRECTION m_direction;
|
||||
bool m_dongle;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,561 @@
|
||||
/*
|
||||
* Copyright (C) 2011,2013 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "Utils.h"
|
||||
#include "RemoteControlRemoteControlHandler.h"
|
||||
#include "DStarDefines.h"
|
||||
|
||||
const unsigned int BUFFER_LENGTH = 2000U;
|
||||
|
||||
const unsigned int MAX_RETRIES = 3U;
|
||||
|
||||
CRemoteControlRemoteControlHandler::CRemoteControlRemoteControlHandler(const std::string& address, unsigned int port) :
|
||||
m_socket("", 0U),
|
||||
m_address(),
|
||||
m_port(port),
|
||||
m_loggedIn(false),
|
||||
m_retryCount(0U),
|
||||
m_type(RCT_NONE),
|
||||
m_inBuffer(NULL),
|
||||
m_inLength(0U),
|
||||
m_outBuffer(NULL),
|
||||
m_outLength(0U)
|
||||
{
|
||||
assert(!address.empty());
|
||||
assert(port > 0U);
|
||||
|
||||
m_address = CUDPReaderWriter::lookup(address);
|
||||
|
||||
m_inBuffer = new unsigned char[BUFFER_LENGTH];
|
||||
m_outBuffer = new unsigned char[BUFFER_LENGTH];
|
||||
}
|
||||
|
||||
CRemoteControlRemoteControlHandler::~CRemoteControlRemoteControlHandler()
|
||||
{
|
||||
delete[] m_inBuffer;
|
||||
delete[] m_outBuffer;
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::open()
|
||||
{
|
||||
return m_socket.open();
|
||||
}
|
||||
|
||||
RC_TYPE CRemoteControlRemoteControlHandler::readType()
|
||||
{
|
||||
m_type = RCT_NONE;
|
||||
|
||||
in_addr address;
|
||||
unsigned int port;
|
||||
|
||||
int length = m_socket.read(m_inBuffer, BUFFER_LENGTH, address, port);
|
||||
if (length <= 0)
|
||||
return m_type;
|
||||
|
||||
m_inLength = length;
|
||||
|
||||
if (::memcmp(m_inBuffer, "ACK", 3U) == 0) {
|
||||
m_retryCount = 0U;
|
||||
m_type = RCT_ACK;
|
||||
return m_type;
|
||||
} else if (::memcmp(m_inBuffer, "NAK", 3U) == 0) {
|
||||
m_retryCount = 0U;
|
||||
m_type = RCT_NAK;
|
||||
return m_type;
|
||||
} else if (::memcmp(m_inBuffer, "RND", 3U) == 0) {
|
||||
m_retryCount = 0U;
|
||||
m_type = RCT_RANDOM;
|
||||
return m_type;
|
||||
} else if (::memcmp(m_inBuffer, "CAL", 3U) == 0) {
|
||||
m_retryCount = 0U;
|
||||
m_type = RCT_CALLSIGNS;
|
||||
return m_type;
|
||||
} else if (::memcmp(m_inBuffer, "RPT", 3U) == 0) {
|
||||
m_retryCount = 0U;
|
||||
m_type = RCT_REPEATER;
|
||||
return m_type;
|
||||
} else if (::memcmp(m_inBuffer, "SNT", 3U) == 0) {
|
||||
m_retryCount = 0U;
|
||||
m_type = RCT_STARNET;
|
||||
return m_type;
|
||||
}
|
||||
|
||||
return m_type;
|
||||
}
|
||||
|
||||
std::string CRemoteControlRemoteControlHandler::readNAK()
|
||||
{
|
||||
if (m_type != RCT_NAK)
|
||||
return "";
|
||||
|
||||
std::string text((char*)(m_inBuffer + 3U));
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlRemoteControlHandler::readRandom()
|
||||
{
|
||||
if (m_type != RCT_RANDOM)
|
||||
return 0U;
|
||||
|
||||
uint32_t random;
|
||||
::memcpy(&random, m_inBuffer + 3U, sizeof(uint32_t));
|
||||
|
||||
return CUtils::swap_endian_be(random);
|
||||
}
|
||||
|
||||
CRemoteControlCallsignData* CRemoteControlRemoteControlHandler::readCallsigns()
|
||||
{
|
||||
if (m_type != RCT_CALLSIGNS)
|
||||
return NULL;
|
||||
|
||||
CRemoteControlCallsignData* data = new CRemoteControlCallsignData;
|
||||
|
||||
unsigned char* p = m_inBuffer + 3U;
|
||||
unsigned int pos = 3U;
|
||||
|
||||
while (pos < m_inLength) {
|
||||
unsigned char type = *p;
|
||||
pos += 1U;
|
||||
p += 1U;
|
||||
|
||||
std::string callsign((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
switch (type) {
|
||||
case 'R':
|
||||
data->addRepeater(callsign);
|
||||
break;
|
||||
case 'S':
|
||||
data->addStarNet(callsign);
|
||||
break;
|
||||
default: // ????
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
CRemoteControlRepeaterData* CRemoteControlRemoteControlHandler::readRepeater()
|
||||
{
|
||||
if (m_type != RCT_REPEATER)
|
||||
return NULL;
|
||||
|
||||
unsigned char* p = m_inBuffer + 3U;
|
||||
unsigned int pos = 3U;
|
||||
|
||||
std::string callsign((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
int32_t reconnect;
|
||||
::memcpy(&reconnect, p, sizeof(int32_t));
|
||||
pos += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
std::string reflector((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
CRemoteControlRepeaterData* data = new CRemoteControlRepeaterData(callsign, CUtils::swap_endian_be(reconnect), reflector);
|
||||
|
||||
while (pos < m_inLength) {
|
||||
std::string callsign((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
int32_t protocol;
|
||||
::memcpy(&protocol, p, sizeof(int32_t));
|
||||
pos += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
int32_t linked;
|
||||
::memcpy(&linked, p, sizeof(int32_t));
|
||||
pos += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
int32_t direction;
|
||||
::memcpy(&direction, p, sizeof(int32_t));
|
||||
pos += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
int32_t dongle;
|
||||
::memcpy(&dongle, p, sizeof(int32_t));
|
||||
pos += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
data->addLink(callsign, CUtils::swap_endian_be(protocol), CUtils::swap_endian_be(linked), CUtils::swap_endian_be(direction), CUtils::swap_endian_be(dongle));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
CRemoteControlStarNetGroup* CRemoteControlRemoteControlHandler::readStarNetGroup()
|
||||
{
|
||||
if (m_type != RCT_STARNET)
|
||||
return NULL;
|
||||
|
||||
unsigned char* p = m_inBuffer + 3U;
|
||||
unsigned int pos = 3U;
|
||||
|
||||
std::string callsign((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
std::string logoff((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
uint32_t timer;
|
||||
::memcpy(&timer, p, sizeof(uint32_t));
|
||||
pos += sizeof(uint32_t);
|
||||
p += sizeof(uint32_t);
|
||||
|
||||
uint32_t timeout;
|
||||
::memcpy(&timeout, p, sizeof(uint32_t));
|
||||
pos += sizeof(uint32_t);
|
||||
p += sizeof(uint32_t);
|
||||
|
||||
CRemoteControlStarNetGroup* group = new CRemoteControlStarNetGroup(callsign, logoff, CUtils::swap_endian_be(timer), CUtils::swap_endian_be(timeout));
|
||||
|
||||
while (pos < m_inLength) {
|
||||
std::string callsign((char*)p, LONG_CALLSIGN_LENGTH);
|
||||
pos += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
::memcpy(&timer, p, sizeof(uint32_t));
|
||||
pos += sizeof(uint32_t);
|
||||
p += sizeof(uint32_t);
|
||||
|
||||
::memcpy(&timeout, p, sizeof(uint32_t));
|
||||
pos += sizeof(uint32_t);
|
||||
p += sizeof(uint32_t);
|
||||
|
||||
group->addUser(callsign, CUtils::swap_endian_be(timer), CUtils::swap_endian_be(timeout));
|
||||
}
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::login()
|
||||
{
|
||||
if (m_loggedIn)
|
||||
return false;
|
||||
|
||||
if (m_address.s_addr == INADDR_NONE)
|
||||
return false;
|
||||
|
||||
::memcpy(m_outBuffer, "LIN", 3U);
|
||||
m_outLength = 3U;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void CRemoteControlRemoteControlHandler::setLoggedIn(bool set)
|
||||
{
|
||||
m_loggedIn = set;
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::getCallsigns()
|
||||
{
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
::memcpy(m_outBuffer, "GCS", 3U);
|
||||
m_outLength = 3U;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::sendHash(const unsigned char* hash, unsigned int length)
|
||||
{
|
||||
assert(hash != NULL);
|
||||
assert(length > 0U);
|
||||
|
||||
if (m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
unsigned char* p = m_outBuffer;
|
||||
m_outLength = 0U;
|
||||
|
||||
::memcpy(p, "SHA", 3U);
|
||||
m_outLength += 3U;
|
||||
p += 3U;
|
||||
|
||||
::memcpy(p, hash, length);
|
||||
m_outLength += length;
|
||||
p += length;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::getRepeater(const std::string& callsign)
|
||||
{
|
||||
assert(!callsign.empty());
|
||||
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
unsigned char* p = m_outBuffer;
|
||||
m_outLength = 0U;
|
||||
|
||||
::memcpy(p, "GRP", 3U);
|
||||
m_outLength += 3U;
|
||||
p += 3U;
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < callsign.length(); i++)
|
||||
p[i] = callsign.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::getStarNet(const std::string& callsign)
|
||||
{
|
||||
assert(!callsign.empty());
|
||||
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
unsigned char* p = m_outBuffer;
|
||||
m_outLength = 0U;
|
||||
|
||||
::memcpy(p, "GSN", 3U);
|
||||
m_outLength += 3U;
|
||||
p += 3U;
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < callsign.length(); i++)
|
||||
p[i] = callsign.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::link(const std::string& callsign, RECONNECT reconnect, const std::string& reflector)
|
||||
{
|
||||
assert(!callsign.empty());
|
||||
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
unsigned char* p = m_outBuffer;
|
||||
m_outLength = 0U;
|
||||
|
||||
::memcpy(p, "LNK", 3U);
|
||||
m_outLength += 3U;
|
||||
p += 3U;
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < callsign.length(); i++)
|
||||
p[i] = callsign.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
int32_t temp1 = int32_t(reconnect);
|
||||
int32_t temp2 = CUtils::swap_endian_be(temp1);
|
||||
::memcpy(p, &temp2, sizeof(int32_t));
|
||||
m_outLength += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < reflector.length(); i++)
|
||||
p[i] = reflector.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::unlink(const std::string& callsign, PROTOCOL protocol, const std::string& reflector)
|
||||
{
|
||||
assert(!callsign.empty());
|
||||
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
unsigned char* p = m_outBuffer;
|
||||
m_outLength = 0U;
|
||||
|
||||
::memcpy(p, "UNL", 3U);
|
||||
m_outLength += 3U;
|
||||
p += 3U;
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < callsign.length(); i++)
|
||||
p[i] = callsign.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
int32_t temp1 = int32_t(protocol);
|
||||
int32_t temp2 = CUtils::swap_endian_be(temp1);
|
||||
::memcpy(p, &temp2, sizeof(int32_t));
|
||||
m_outLength += sizeof(int32_t);
|
||||
p += sizeof(int32_t);
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < reflector.length(); i++)
|
||||
p[i] = reflector.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::logoff(const std::string& callsign, const std::string& user)
|
||||
{
|
||||
assert(!callsign.empty());
|
||||
assert(!user.empty());
|
||||
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
unsigned char* p = m_outBuffer;
|
||||
m_outLength = 0U;
|
||||
|
||||
::memcpy(p, "LGO", 3U);
|
||||
m_outLength += 3U;
|
||||
p += 3U;
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < callsign.length(); i++)
|
||||
p[i] = callsign.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
::memset(p, ' ', LONG_CALLSIGN_LENGTH);
|
||||
for (unsigned int i = 0U; i < user.length(); i++)
|
||||
p[i] = user.at(i);
|
||||
|
||||
m_outLength += LONG_CALLSIGN_LENGTH;
|
||||
p += LONG_CALLSIGN_LENGTH;
|
||||
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
} else {
|
||||
m_retryCount = 1U;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::logout()
|
||||
{
|
||||
if (!m_loggedIn || m_retryCount > 0U)
|
||||
return false;
|
||||
|
||||
::memcpy(m_outBuffer, "LOG", 3U);
|
||||
m_outLength = 3U;
|
||||
|
||||
for (unsigned int i = 0U; i < 5U; i++) {
|
||||
bool ret = m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
if (!ret) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
m_retryCount = 1U;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRemoteControlRemoteControlHandler::retry()
|
||||
{
|
||||
if (m_retryCount > 0U) {
|
||||
m_retryCount++;
|
||||
if (m_retryCount >= MAX_RETRIES) {
|
||||
m_retryCount = 0U;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_socket.write(m_outBuffer, m_outLength, m_address, m_port);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CRemoteControlRemoteControlHandler::close()
|
||||
{
|
||||
m_socket.close();
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2011,2013 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlRemoteControlHandler_H
|
||||
#define RemoteControlRemoteControlHandler_H
|
||||
|
||||
#include "RemoteControlRepeaterData.h"
|
||||
#include "RemoteControlStarNetGroup.h"
|
||||
#include "RemoteControlCallsignData.h"
|
||||
#include "UDPReaderWriter.h"
|
||||
|
||||
enum RC_TYPE {
|
||||
RCT_NONE,
|
||||
RCT_ACK,
|
||||
RCT_NAK,
|
||||
RCT_RANDOM,
|
||||
RCT_CALLSIGNS,
|
||||
RCT_REPEATER,
|
||||
RCT_STARNET
|
||||
};
|
||||
|
||||
class CRemoteControlRemoteControlHandler {
|
||||
public:
|
||||
CRemoteControlRemoteControlHandler(const std::string& address, unsigned int port);
|
||||
~CRemoteControlRemoteControlHandler();
|
||||
|
||||
bool open();
|
||||
|
||||
RC_TYPE readType();
|
||||
|
||||
std::string readNAK();
|
||||
unsigned int readRandom();
|
||||
CRemoteControlCallsignData* readCallsigns();
|
||||
CRemoteControlRepeaterData* readRepeater();
|
||||
CRemoteControlStarNetGroup* readStarNetGroup();
|
||||
|
||||
bool login();
|
||||
bool sendHash(const unsigned char* hash, unsigned int length);
|
||||
|
||||
void setLoggedIn(bool set);
|
||||
|
||||
bool getCallsigns();
|
||||
bool getRepeater(const std::string& callsign);
|
||||
bool getStarNet(const std::string& callsign);
|
||||
|
||||
bool link(const std::string& callsign, RECONNECT reconnect, const std::string& reflector);
|
||||
bool unlink(const std::string& callsign, PROTOCOL protocol, const std::string& reflector);
|
||||
bool logoff(const std::string& callsign, const std::string& user);
|
||||
|
||||
bool logout();
|
||||
|
||||
bool retry();
|
||||
|
||||
void close();
|
||||
|
||||
private:
|
||||
CUDPReaderWriter m_socket;
|
||||
in_addr m_address;
|
||||
unsigned int m_port;
|
||||
bool m_loggedIn;
|
||||
unsigned int m_retryCount;
|
||||
RC_TYPE m_type;
|
||||
unsigned char* m_inBuffer;
|
||||
unsigned int m_inLength;
|
||||
unsigned char* m_outBuffer;
|
||||
unsigned int m_outLength;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#include "RemoteControlRepeaterData.h"
|
||||
|
||||
|
||||
CRemoteControlRepeaterData::CRemoteControlRepeaterData(const std::string& callsign, int32_t reconnect, const std::string& reflector) :
|
||||
m_callsign(callsign),
|
||||
m_reconnect(RECONNECT(reconnect)),
|
||||
m_reflector(reflector),
|
||||
m_links()
|
||||
{
|
||||
}
|
||||
|
||||
CRemoteControlRepeaterData::~CRemoteControlRepeaterData()
|
||||
{
|
||||
for(auto data : m_links) {
|
||||
delete data;
|
||||
}
|
||||
m_links.clear();
|
||||
}
|
||||
|
||||
void CRemoteControlRepeaterData::addLink(const std::string& callsign, int32_t protocol, int32_t linked, int32_t direction, int32_t dongle)
|
||||
{
|
||||
CRemoteControlLinkData * data = new CRemoteControlLinkData(callsign, protocol, linked, direction, dongle);
|
||||
|
||||
m_links.push_back(data);
|
||||
}
|
||||
|
||||
std::string CRemoteControlRepeaterData::getCallsign() const
|
||||
{
|
||||
return m_callsign;
|
||||
}
|
||||
|
||||
RECONNECT CRemoteControlRepeaterData::getReconnect() const
|
||||
{
|
||||
return m_reconnect;
|
||||
}
|
||||
|
||||
std::string CRemoteControlRepeaterData::getReflector() const
|
||||
{
|
||||
return m_reflector;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlRepeaterData::getLinkCount() const
|
||||
{
|
||||
return m_links.size();
|
||||
}
|
||||
|
||||
CRemoteControlLinkData* CRemoteControlRepeaterData::getLink(unsigned int n) const
|
||||
{
|
||||
return m_links[n];
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlRepeaterData_H
|
||||
#define RemoteControlRepeaterData_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "RemoteControlLinkData.h"
|
||||
|
||||
|
||||
class CRemoteControlRepeaterData {
|
||||
public:
|
||||
CRemoteControlRepeaterData(const std::string& callsign, int32_t reconnect, const std::string& reflector);
|
||||
~CRemoteControlRepeaterData();
|
||||
|
||||
void addLink(const std::string& callsign, int32_t protocol, int32_t linked, int32_t direction, int32_t dongle);
|
||||
|
||||
std::string getCallsign() const;
|
||||
RECONNECT getReconnect() const;
|
||||
std::string getReflector() const;
|
||||
|
||||
unsigned int getLinkCount() const;
|
||||
CRemoteControlLinkData * getLink(unsigned int n) const;
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
RECONNECT m_reconnect;
|
||||
std::string m_reflector;
|
||||
std::vector<CRemoteControlLinkData *> m_links;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#include "RemoteControlStarNetGroup.h"
|
||||
|
||||
|
||||
CRemoteControlStarNetGroup::CRemoteControlStarNetGroup(const std::string& callsign, const std::string& logoff, uint32_t timer, uint32_t timeout) :
|
||||
m_callsign(callsign),
|
||||
m_logoff(logoff),
|
||||
m_timer((unsigned int)timer),
|
||||
m_timeout((unsigned int)timeout),
|
||||
m_users()
|
||||
{
|
||||
if (m_logoff == " ")
|
||||
m_logoff.clear();
|
||||
}
|
||||
|
||||
CRemoteControlStarNetGroup::~CRemoteControlStarNetGroup()
|
||||
{
|
||||
for(auto user : m_users) {
|
||||
delete user;
|
||||
}
|
||||
m_users.clear();
|
||||
}
|
||||
|
||||
void CRemoteControlStarNetGroup::addUser(const std::string& callsign, uint32_t timer, uint32_t timeout)
|
||||
{
|
||||
CRemoteControlStarNetUser * user = new CRemoteControlStarNetUser(callsign, timer, timeout);
|
||||
|
||||
m_users.push_back(user);
|
||||
}
|
||||
|
||||
std::string CRemoteControlStarNetGroup::getCallsign() const
|
||||
{
|
||||
return m_callsign;
|
||||
}
|
||||
|
||||
std::string CRemoteControlStarNetGroup::getLogoff() const
|
||||
{
|
||||
return m_logoff;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlStarNetGroup::getTimer() const
|
||||
{
|
||||
return m_timer;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlStarNetGroup::getTimeout() const
|
||||
{
|
||||
return m_timeout;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlStarNetGroup::getUserCount() const
|
||||
{
|
||||
return m_users.size();
|
||||
}
|
||||
|
||||
CRemoteControlStarNetUser * CRemoteControlStarNetGroup::getUser(unsigned int n) const
|
||||
{
|
||||
return m_users[n];
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlStarNetGroup_H
|
||||
#define RemoteControlStarNetGroup_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "RemoteControlStarNetUser.h"
|
||||
|
||||
|
||||
|
||||
class CRemoteControlStarNetGroup {
|
||||
public:
|
||||
CRemoteControlStarNetGroup(const std::string& callsign, const std::string& logoff, uint32_t timer, uint32_t timeout);
|
||||
~CRemoteControlStarNetGroup();
|
||||
|
||||
void addUser(const std::string& callsign, uint32_t timer, uint32_t timeout);
|
||||
|
||||
std::string getCallsign() const;
|
||||
std::string getLogoff() const;
|
||||
unsigned int getTimer() const;
|
||||
unsigned int getTimeout() const;
|
||||
|
||||
unsigned int getUserCount() const;
|
||||
CRemoteControlStarNetUser * getUser(unsigned int n) const;
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
std::string m_logoff;
|
||||
unsigned int m_timer;
|
||||
unsigned int m_timeout;
|
||||
std::vector<CRemoteControlStarNetUser *> m_users;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#include "RemoteControlStarNetUser.h"
|
||||
|
||||
CRemoteControlStarNetUser::CRemoteControlStarNetUser(const std::string& callsign, uint32_t timer, uint32_t timeout) :
|
||||
m_callsign(callsign),
|
||||
m_timer((unsigned int)timer),
|
||||
m_timeout((unsigned int)timeout)
|
||||
{
|
||||
}
|
||||
|
||||
CRemoteControlStarNetUser::~CRemoteControlStarNetUser()
|
||||
{
|
||||
}
|
||||
|
||||
std::string CRemoteControlStarNetUser::getCallsign() const
|
||||
{
|
||||
return m_callsign;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlStarNetUser::getTimer() const
|
||||
{
|
||||
return m_timer;
|
||||
}
|
||||
|
||||
unsigned int CRemoteControlStarNetUser::getTimeout() const
|
||||
{
|
||||
return m_timeout;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2011 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.
|
||||
*/
|
||||
|
||||
#ifndef RemoteControlStarNetUser_H
|
||||
#define RemoteControlStarNetUser_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class CRemoteControlStarNetUser {
|
||||
public:
|
||||
CRemoteControlStarNetUser(const std::string& callsign, uint32_t timer, uint32_t timeout);
|
||||
~CRemoteControlStarNetUser();
|
||||
|
||||
std::string getCallsign() const;
|
||||
unsigned int getTimer() const;
|
||||
unsigned int getTimeout() const;
|
||||
|
||||
private:
|
||||
std::string m_callsign;
|
||||
unsigned int m_timer;
|
||||
unsigned int m_timeout;
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,12 @@
|
||||
# You can specifiy up to 4 sections with different target gateways
|
||||
# When invoking dgwremotecontrol without name parameter, the first gateway of the config file is used
|
||||
|
||||
[gateway_1]
|
||||
address=127.0.0.1
|
||||
port=4242
|
||||
password=CHANGE_ME
|
||||
|
||||
[gateway_2]
|
||||
address=127.0.0.1
|
||||
port=4242
|
||||
password=CHANGE_ME
|
||||
Loading…
Reference in new issue