10 changed files with 218 additions and 9 deletions
@ -0,0 +1,40 @@
@@ -0,0 +1,40 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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 as version 3 of the License, or //
|
||||
// //
|
||||
// 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 V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_UTIL_PRETTYPRINT_H_ |
||||
#define INCLUDE_UTIL_PRETTYPRINT_H_ |
||||
|
||||
#include <QString> |
||||
|
||||
class EscapeColors |
||||
{ |
||||
public: |
||||
static const QString red; |
||||
static const QString blue; |
||||
static const QString green; |
||||
static const QString cyan; |
||||
static const QString purple; |
||||
static const QString yellow; |
||||
static const QString lightRed; |
||||
static const QString lightBlue; |
||||
static const QString lightGreen; |
||||
static const QString lightCyan; |
||||
static const QString lightPurple; |
||||
static const QString brown; |
||||
static const QString terminator; |
||||
}; |
||||
|
||||
#endif /* INCLUDE_UTIL_PRETTYPRINT_H_ */ |
||||
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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 as version 3 of the License, or //
|
||||
// //
|
||||
// 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 V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "fcdserializer.h" |
||||
|
||||
void FCDSerializer::writeSerializedData(const FCDData& data, QByteArray& serializedData) |
||||
{ |
||||
QByteArray sampleSourceSerialized; |
||||
SampleSourceSerializer::writeSerializedData(data.m_data, sampleSourceSerialized); |
||||
|
||||
SimpleSerializer s(1); |
||||
|
||||
s.writeBlob(1, sampleSourceSerialized); |
||||
s.writeS32(2, data.m_bias); |
||||
s.writeS32(3, data.m_range); |
||||
|
||||
serializedData = s.final(); |
||||
} |
||||
|
||||
bool FCDSerializer::readSerializedData(const QByteArray& serializedData, FCDData& data) |
||||
{ |
||||
bool valid = SampleSourceSerializer::readSerializedData(serializedData, data.m_data); |
||||
|
||||
QByteArray sampleSourceSerialized; |
||||
|
||||
SimpleDeserializer d(serializedData); |
||||
|
||||
if (!d.isValid()) |
||||
{ |
||||
setDefaults(data); |
||||
return false; |
||||
} |
||||
|
||||
if (d.getVersion() == SampleSourceSerializer::getSerializerVersion()) |
||||
{ |
||||
int intval; |
||||
|
||||
d.readBlob(1, &sampleSourceSerialized); |
||||
d.readS32(2, &data.m_bias); |
||||
d.readS32(3, &data.m_range); |
||||
|
||||
return SampleSourceSerializer::readSerializedData(sampleSourceSerialized, data.m_data); |
||||
} |
||||
else |
||||
{ |
||||
setDefaults(data); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
void FCDSerializer::setDefaults(FCDData& data) |
||||
{ |
||||
data.m_range = 0; |
||||
data.m_bias = 0; |
||||
} |
||||
@ -0,0 +1,39 @@
@@ -0,0 +1,39 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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 as version 3 of the License, or //
|
||||
// //
|
||||
// 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 V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef PLUGINS_SAMPLESOURCE_FCD_FCDSERIALIZER_H_ |
||||
#define PLUGINS_SAMPLESOURCE_FCD_FCDSERIALIZER_H_ |
||||
|
||||
#include "util/samplesourceserializer.h" |
||||
|
||||
class FCDSerializer |
||||
{ |
||||
public: |
||||
struct FCDData |
||||
{ |
||||
SampleSourceSerializer::Data m_data; |
||||
qint32 m_bias; |
||||
qint32 m_range; |
||||
}; |
||||
|
||||
static void writeSerializedData(const FCDData& data, QByteArray& serializedData); |
||||
static bool readSerializedData(const QByteArray& serializedData, FCDData& data); |
||||
static void setDefaults(FCDData& data); |
||||
}; |
||||
|
||||
|
||||
|
||||
#endif /* PLUGINS_SAMPLESOURCE_FCD_FCDSERIALIZER_H_ */ |
||||
@ -0,0 +1,33 @@
@@ -0,0 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2015 Edouard Griffiths, F4EXB //
|
||||
// //
|
||||
// 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 as version 3 of the License, or //
|
||||
// //
|
||||
// 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 V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "util/prettyprint.h" |
||||
|
||||
const QString EscapeColors::red = "\033[0;31m"; |
||||
const QString EscapeColors::blue = "\033[0;34m"; |
||||
const QString EscapeColors::green = "\033[0;32m"; |
||||
const QString EscapeColors::cyan = "\033[0;36m"; |
||||
const QString EscapeColors::purple = "\033[0;35m"; |
||||
const QString EscapeColors::yellow = "\033[0;33m"; |
||||
|
||||
const QString EscapeColors::lightRed = "\033[1;31m"; |
||||
const QString EscapeColors::lightBlue = "\033[1;34m"; |
||||
const QString EscapeColors::lightGreen = "\033[1;32m"; |
||||
const QString EscapeColors::lightCyan = "\033[1;36m"; |
||||
const QString EscapeColors::lightPurple = "\033[1;35m"; |
||||
const QString EscapeColors::brown = "\033[1;33m"; |
||||
|
||||
const QString EscapeColors::terminator = "\033[0m"; |
||||
Loading…
Reference in new issue