mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T730, style
This commit is contained in:
committed by
Mat Sutcliffe
parent
09b38b4e6d
commit
3ddded423a
@@ -30,7 +30,6 @@ namespace BlackCore
|
||||
m_waveFormat.setCodec("audio/pcm");
|
||||
|
||||
m_mixer = new CMixingSampleProvider(this);
|
||||
|
||||
m_receiverIDs = transceiverIDs;
|
||||
|
||||
for (quint16 transceiverID : transceiverIDs)
|
||||
@@ -43,11 +42,6 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
QAudioFormat CSoundcardSampleProvider::waveFormat() const
|
||||
{
|
||||
return m_waveFormat;
|
||||
}
|
||||
|
||||
void CSoundcardSampleProvider::setBypassEffects(bool value)
|
||||
{
|
||||
for (CReceiverSampleProvider *receiverInput : m_receiverInputs)
|
||||
|
||||
@@ -33,16 +33,29 @@ namespace BlackCore
|
||||
//! Ctor
|
||||
CSoundcardSampleProvider(int sampleRate, const QVector<quint16> &transceiverIDs, QObject *parent = nullptr);
|
||||
|
||||
QAudioFormat waveFormat() const;
|
||||
//! Wave format
|
||||
const QAudioFormat &waveFormat() const { return m_waveFormat; }
|
||||
|
||||
//! Bypass effects
|
||||
void setBypassEffects(bool value);
|
||||
|
||||
//! Update PTT
|
||||
void pttUpdate(bool active, const QVector<TxTransceiverDto> &txTransceivers);
|
||||
|
||||
//! \copydoc ISampleProvider::readSamples
|
||||
virtual int readSamples(QVector<qint16> &samples, qint64 count) override;
|
||||
|
||||
//! Add OPUS samples
|
||||
void addOpusSamples(const IAudioDto &audioDto, const QVector<RxTransceiverDto> &rxTransceivers);
|
||||
|
||||
//! Update all tranceivers
|
||||
void updateRadioTransceivers(const QVector<TransceiverDto> &radioTransceivers);
|
||||
|
||||
//! Receiving callsign as single string
|
||||
QString getReceivingCallsigns(quint16 transceiverID);
|
||||
|
||||
signals:
|
||||
//! Changed callsigns
|
||||
void receivingCallsignsChanged(const TransceiverReceivingCallsignsChangedArgs &args);
|
||||
|
||||
private:
|
||||
|
||||
@@ -153,17 +153,17 @@ namespace BlackCore
|
||||
|
||||
void CClientConnection::handleSocketError(QAbstractSocket::SocketError error)
|
||||
{
|
||||
Q_UNUSED(error);
|
||||
Q_UNUSED(error)
|
||||
qDebug() << "UDP socket error" << m_udpSocket.errorString();
|
||||
}
|
||||
|
||||
void CClientConnection::voiceServerHeartbeat()
|
||||
{
|
||||
QUrl voiceServerUrl("udp://" + m_connection.m_tokens.VoiceServer.addressIpV4);
|
||||
const QUrl voiceServerUrl("udp://" + m_connection.m_tokens.VoiceServer.addressIpV4);
|
||||
qDebug() << "Sending voice server heartbeat to" << voiceServerUrl.host();
|
||||
HeartbeatDto keepAlive;
|
||||
keepAlive.callsign = m_connection.m_callsign.toStdString();
|
||||
QByteArray dataBytes = CryptoDtoSerializer::Serialize(*m_connection.voiceCryptoChannel, CryptoDtoMode::AEAD_ChaCha20Poly1305, keepAlive);
|
||||
const QByteArray dataBytes = CryptoDtoSerializer::serialize(*m_connection.voiceCryptoChannel, CryptoDtoMode::AEAD_ChaCha20Poly1305, keepAlive);
|
||||
m_udpSocket.writeDatagram(dataBytes, QHostAddress(voiceServerUrl.host()), static_cast<quint16>(voiceServerUrl.port()));
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace BlackCore
|
||||
void sendToVoiceServer(T dto)
|
||||
{
|
||||
QUrl voiceServerUrl("udp://" + m_connection.m_tokens.VoiceServer.addressIpV4);
|
||||
QByteArray dataBytes = Crypto::CryptoDtoSerializer::Serialize(*m_connection.voiceCryptoChannel, CryptoDtoMode::AEAD_ChaCha20Poly1305, dto);
|
||||
QByteArray dataBytes = Crypto::CryptoDtoSerializer::serialize(*m_connection.voiceCryptoChannel, CryptoDtoMode::AEAD_ChaCha20Poly1305, dto);
|
||||
m_udpSocket.writeDatagram(dataBytes, QHostAddress(voiceServerUrl.host()), static_cast<quint16>(voiceServerUrl.port()));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackCore
|
||||
|
||||
//! Serialize a DTO
|
||||
template<typename T>
|
||||
static QByteArray Serialize(const QString &channelTag, CryptoDtoMode mode, const QByteArray &transmitKey, uint sequenceToBeSent, T dto)
|
||||
static QByteArray serialize(const QString &channelTag, CryptoDtoMode mode, const QByteArray &transmitKey, uint sequenceToBeSent, T dto)
|
||||
{
|
||||
const CryptoDtoHeaderDto header = { channelTag.toStdString(), sequenceToBeSent, mode };
|
||||
|
||||
@@ -108,17 +108,20 @@ namespace BlackCore
|
||||
|
||||
//! Serialize a DTO
|
||||
template<typename T>
|
||||
static QByteArray Serialize(CCryptoDtoChannel &channel, CryptoDtoMode mode, T dto)
|
||||
static QByteArray serialize(CCryptoDtoChannel &channel, CryptoDtoMode mode, T dto)
|
||||
{
|
||||
uint sequenceToSend = 0;
|
||||
QByteArray transmitKey = channel.getTransmitKey(mode, sequenceToSend);
|
||||
return Serialize(channel.getChannelTag(), mode, transmitKey, sequenceToSend++, dto);
|
||||
return serialize(channel.getChannelTag(), mode, transmitKey, sequenceToSend++, dto);
|
||||
}
|
||||
|
||||
//! Deserializer
|
||||
struct Deserializer
|
||||
{
|
||||
//! Ctor
|
||||
Deserializer(CCryptoDtoChannel &channel, const QByteArray &bytes, bool loopback);
|
||||
|
||||
//! Get DTO
|
||||
template<typename T>
|
||||
T getDto()
|
||||
{
|
||||
@@ -133,18 +136,25 @@ namespace BlackCore
|
||||
return {};
|
||||
}
|
||||
|
||||
//! Header data @{
|
||||
quint16 headerLength;
|
||||
CryptoDtoHeaderDto header;
|
||||
//! @}
|
||||
|
||||
//! Name data @{
|
||||
quint16 dtoNameLength;
|
||||
QByteArray dtoNameBuffer;
|
||||
//! @}
|
||||
|
||||
//! Data @{
|
||||
quint16 dataLength;
|
||||
QByteArray dataBuffer;
|
||||
//! @}
|
||||
|
||||
bool verified = false;
|
||||
bool verified = false; //!< is verified
|
||||
};
|
||||
|
||||
//! Deserialize
|
||||
static Deserializer deserialize(CCryptoDtoChannel &channel, const QByteArray &bytes, bool loopback);
|
||||
};
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user