diff --git a/DummyRepeaterProtocolHandler.cpp b/DummyRepeaterProtocolHandler.cpp new file mode 100644 index 0000000..d4d732a --- /dev/null +++ b/DummyRepeaterProtocolHandler.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2013 by Jonathan Naylor G4KLX + * Copyright (C) 2021 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 "DummyRepeaterProtocolHandler.h" + +#include "DStarDefines.h" +#include "Utils.h" +#include "Log.h" + +CDummyRepeaterProtocolHandler::CDummyRepeaterProtocolHandler() +{ +} + +CDummyRepeaterProtocolHandler::~CDummyRepeaterProtocolHandler() +{ +} + +bool CDummyRepeaterProtocolHandler::open() +{ + return true; +} + +bool CDummyRepeaterProtocolHandler::writeHeader(CHeaderData& header) +{ + unsigned char buffer[50U]; + unsigned int length = header.getHBRepeaterData(buffer, 50U, true); + + wxLogMessage("Sending Header to port: %u, id: %04X", header.getYourPort(), header.getId()); + + CUtils::dump("Data", buffer + 8U, length - 8U); + + return true; +} + +bool CDummyRepeaterProtocolHandler::writeAMBE(CAMBEData& data) +{ + unsigned char buffer[30U]; + unsigned int length = data.getHBRepeaterData(buffer, 30U); + + wxLogMessage("Sending AMBE to port: %u, seq: %02X, id: %04X", data.getYourPort(), data.getSeq(), data.getId()); + + CUtils::dump("Data", buffer + 9U, length - 9U); + + return true; +} + +bool CDummyRepeaterProtocolHandler::writeDD(CDDData& data) +{ + unsigned char buffer[2000U]; + unsigned int length = data.getHBRepeaterData(buffer, 2000U); + + CUtils::dump("DD Data", buffer, length); + + return true; +} + +bool CDummyRepeaterProtocolHandler::writeText(CTextData& text) +{ + unsigned char buffer[40U]; + unsigned int length = text.getHBRepeaterData(buffer, 40U); + + CUtils::dump("Sending Text", buffer, length); + + return true; +} + +bool CDummyRepeaterProtocolHandler::writeStatus(CStatusData& status) +{ + unsigned char buffer[30U]; + unsigned int length = status.getHBRepeaterData(buffer, 30U); + + CUtils::dump("Sending Status", buffer, length); + + return true; +} + +REPEATER_TYPE CDummyRepeaterProtocolHandler::read() +{ + return RT_NONE; +} + +CPollData* CDummyRepeaterProtocolHandler::readPoll() +{ + return NULL; +} + +CHeaderData* CDummyRepeaterProtocolHandler::readHeader() +{ + return NULL; +} + +CAMBEData* CDummyRepeaterProtocolHandler::readAMBE() +{ + return NULL; +} + +CHeaderData* CDummyRepeaterProtocolHandler::readBusyHeader() +{ + return NULL; +} + +CAMBEData* CDummyRepeaterProtocolHandler::readBusyAMBE() +{ + return NULL; +} + +CHeardData* CDummyRepeaterProtocolHandler::readHeard() +{ + return NULL; +} + +CDDData* CDummyRepeaterProtocolHandler::readDD() +{ + return NULL; +} + +void CDummyRepeaterProtocolHandler::close() +{ +} diff --git a/DummyRepeaterProtocolHandler.h b/DummyRepeaterProtocolHandler.h new file mode 100644 index 0000000..949f6f0 --- /dev/null +++ b/DummyRepeaterProtocolHandler.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2013 by Jonathan Naylor G4KLX + * Copyright (C) 2021 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. + */ + +#ifndef DummyRepeaterProtocolHandler_H +#define DummyRepeaterProtocolHandler_H + +#include + +#include "RepeaterProtocolHandler.h" +#include "DStarDefines.h" +#include "HeaderData.h" +#include "StatusData.h" +#include "HeardData.h" +#include "AMBEData.h" +#include "TextData.h" +#include "PollData.h" +#include "DDData.h" + +class CDummyRepeaterProtocolHandler : public IRepeaterProtocolHandler { +public: + CDummyRepeaterProtocolHandler(); + virtual ~CDummyRepeaterProtocolHandler(); + + virtual bool open(); + + virtual bool writeHeader(CHeaderData& header); + virtual bool writeAMBE(CAMBEData& data); + virtual bool writeDD(CDDData& data); + virtual bool writeText(CTextData& text); + virtual bool writeStatus(CStatusData& status); + + virtual REPEATER_TYPE read(); + virtual CPollData* readPoll(); + virtual CHeardData* readHeard(); + virtual CHeaderData* readHeader(); + virtual CAMBEData* readAMBE(); + virtual CDDData* readDD(); + virtual CHeaderData* readBusyHeader(); + virtual CAMBEData* readBusyAMBE(); + + virtual void close(); + +private: +}; + +#endif