Ref T730, code style, adding namespaces

This commit is contained in:
Klaus Basan
2019-09-21 03:29:58 +02:00
committed by Mat Sutcliffe
parent 329b1e8c9a
commit 99edc9cb13
47 changed files with 1136 additions and 801 deletions

View File

@@ -22,16 +22,19 @@ namespace BlackCore
{
namespace Afv
{
struct IMsgPack
{ };
// struct IMsgPack { };
//! Channel config DTO
struct CryptoDtoChannelConfigDto
{
//! Properties @{
QString channelTag;
QByteArray aeadReceiveKey;
QByteArray aeadTransmitKey;
QByteArray hmacKey;
//! @}
//! To JSON
QJsonObject toJson() const
{
QJsonObject json;
@@ -42,6 +45,7 @@ namespace BlackCore
return json;
}
//! From JSON
static CryptoDtoChannelConfigDto fromJson(const QJsonObject &json)
{
CryptoDtoChannelConfigDto dto;
@@ -54,12 +58,16 @@ namespace BlackCore
}
};
//! Voice server DTO
struct VoiceServerConnectionDataDto
{
//! Properties @{
QString addressIpV4; // Example: 123.123.123.123:50000
QString addressIpV6; // Example: 123.123.123.123:50000
CryptoDtoChannelConfigDto channelConfig;
//! @}
//! To JSON
QJsonObject toJson() const
{
QJsonObject json;
@@ -69,6 +77,7 @@ namespace BlackCore
return json;
}
//! From JSON
static VoiceServerConnectionDataDto fromJson(const QJsonObject &json)
{
VoiceServerConnectionDataDto dto;
@@ -79,12 +88,16 @@ namespace BlackCore
}
};
//! Callsign DTO
struct PostCallsignResponseDto
{
VoiceServerConnectionDataDto VoiceServer;
//! Properties @{
// DataServerConnectionDataDto DataServer;
VoiceServerConnectionDataDto VoiceServer;
bool isValid = false;
//! @}
//! To JSON
QJsonObject toJson() const
{
QJsonObject json;
@@ -93,6 +106,7 @@ namespace BlackCore
return json;
}
//! From JSON
static PostCallsignResponseDto fromJson(const QJsonObject &json)
{
PostCallsignResponseDto dto;
@@ -103,16 +117,20 @@ namespace BlackCore
}
};
//! Transceiver DTO
struct TransceiverDto
{
//! Properties @{
quint16 id;
quint32 frequency;
double LatDeg = 0.0;
double LonDeg = 0.0;
double HeightMslM = 0.0;
double HeightAglM = 0.0;
//! @}
MSGPACK_DEFINE(id, frequency, LatDeg, LonDeg, HeightMslM, HeightAglM)
//! To JSON
QJsonObject toJson() const
{
QJsonObject json;
@@ -125,11 +143,12 @@ namespace BlackCore
return json;
}
//! From JSON
static TransceiverDto fromJson(const QJsonObject &json)
{
TransceiverDto dto;
dto.id = json.value("id").toInt();
dto.frequency = json.value("frequency").toInt();
dto.id = static_cast<quint16>(json.value("id").toInt());
dto.frequency = static_cast<quint32>(json.value("frequency").toInt());
dto.LatDeg = json.value("latDeg").toDouble();
dto.LonDeg = json.value("lonDeg").toDouble();
dto.HeightMslM = json.value("heightMslM").toDouble();
@@ -138,33 +157,39 @@ namespace BlackCore
}
};
//! Station DTO
struct StationDto
{
//! Properties @{
QUuid id;
QString name;
quint32 frequency;
quint32 frequencyAlias;
//! @}
//! From JSON
static StationDto fromJson(const QJsonObject &json)
{
StationDto dto;
dto.id = json.value("id").toString();
dto.name = json.value("name").toString();
dto.frequency = json.value("frequency").toInt();
dto.frequencyAlias = json.value("frequencyAlias").toInt();
dto.frequency = static_cast<quint32>(json.value("frequency").toInt());
dto.frequencyAlias = static_cast<quint32>(json.value("frequencyAlias").toInt());
return dto;
}
};
//! Heartbeat DTO
struct HeartbeatDto
{
static QByteArray getDtoName() { return "HeartbeatDto"; }
static QByteArray getShortDtoName() { return "H"; }
std::string callsign;
std::string callsign; //!< callsign
MSGPACK_DEFINE(callsign)
};
//! Heartbeat DTO
struct HeartbeatAckDto
{
static QByteArray getDtoName() { return "HeartbeatAckDto"; }
@@ -172,20 +197,22 @@ namespace BlackCore
MSGPACK_DEFINE()
};
//! Receive transceiver DTO
struct RxTransceiverDto
{
//! Properties @{
uint16_t id;
uint32_t frequency;
float distanceRatio;
// std::string RelayCallsign;
//! @}
MSGPACK_DEFINE(id, frequency, distanceRatio/*, RelayCallsign*/)
};
//! Transmit transceiver DTO
struct TxTransceiverDto
{
uint16_t id;
uint16_t id; //!< id
MSGPACK_DEFINE(id)
};
@@ -194,11 +221,13 @@ namespace BlackCore
static QByteArray getDtoName() { return "AudioTxOnTransceiversDto"; }
static QByteArray getShortDtoName() { return "AT"; }
//! Properties @{
std::string callsign;
uint sequenceCounter;
std::vector<char> audio;
bool lastPacket;
std::vector<TxTransceiverDto> transceivers;
//! @}
MSGPACK_DEFINE(callsign, sequenceCounter, audio, lastPacket, transceivers)
};
@@ -207,20 +236,23 @@ namespace BlackCore
static QByteArray getDtoName() { return "AudioRxOnTransceiversDto"; }
static QByteArray getShortDtoName() { return "AR"; }
//! Properties @{
std::string callsign;
uint sequenceCounter;
std::vector<char> audio;
bool lastPacket;
std::vector<RxTransceiverDto> transceivers;
//! @}
MSGPACK_DEFINE(callsign, sequenceCounter, audio, lastPacket, transceivers)
};
//! Audio DTO
struct IAudioDto
{
QString callsign; // Callsign that audio originates from
uint sequenceCounter; // Receiver optionally uses this in reordering algorithm/gap detection
QByteArray audio; // Opus compressed audio
bool lastPacket; // Used to indicate to receiver that the sender has stopped sending
QString callsign; //!< Callsign that audio originates from
uint sequenceCounter; //!< Receiver optionally uses this in reordering algorithm/gap detection
QByteArray audio; //!< Opus compressed audio
bool lastPacket; //!< Used to indicate to receiver that the sender has stopped sending
};
} // ns
} // ns