@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
// Copyright (C) 2018-2019 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 //
@ -14,6 +14,8 @@
@@ -14,6 +14,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
# include "remotesource.h"
# include <sys/time.h>
# include <unistd.h>
# include <boost/crc.hpp>
@ -26,25 +28,24 @@
@@ -26,25 +28,24 @@
# include "SWGChannelSettings.h"
# include "SWGChannelReport.h"
# include "SWGDaemon SourceReport.h"
# include "SWGRemote SourceReport.h"
# include "dsp/devicesamplesink.h"
# include "device/devicesinkapi.h"
# include "dsp/upchannelizer.h"
# include "dsp/threadedbasebandsamplesource.h"
# include "daemonsourcethread.h"
# include "daemonsource.h"
# include "remotesourcethread.h"
MESSAGE_CLASS_DEFINITION ( Daemon Source: : MsgSampleRateNotification , Message )
MESSAGE_CLASS_DEFINITION ( DaemonSource : : MsgConfigureDaemon Source, Message )
MESSAGE_CLASS_DEFINITION ( Daemon Source: : MsgQueryStreamData , Message )
MESSAGE_CLASS_DEFINITION ( Daemon Source: : MsgReportStreamData , Message )
MESSAGE_CLASS_DEFINITION ( Remote Source: : MsgSampleRateNotification , Message )
MESSAGE_CLASS_DEFINITION ( RemoteSource : : MsgConfigureRemote Source, Message )
MESSAGE_CLASS_DEFINITION ( Remote Source: : MsgQueryStreamData , Message )
MESSAGE_CLASS_DEFINITION ( Remote Source: : MsgReportStreamData , Message )
const QString Daemon Source: : m_channelIdURI = " sdrangel.channeltx.daemon source " ;
const QString Daemon Source: : m_channelId = " Daemon Source" ;
const QString Remote Source: : m_channelIdURI = " sdrangel.channeltx.remote source " ;
const QString Remote Source: : m_channelId = " Remote Source" ;
DaemonSource : : Daemon Source( DeviceSinkAPI * deviceAPI ) :
RemoteSource : : Remote Source( DeviceSinkAPI * deviceAPI ) :
ChannelSourceAPI ( m_channelIdURI ) ,
m_deviceAPI ( deviceAPI ) ,
m_sourceThread ( 0 ) ,
@ -67,7 +68,7 @@ DaemonSource::DaemonSource(DeviceSinkAPI *deviceAPI) :
@@ -67,7 +68,7 @@ DaemonSource::DaemonSource(DeviceSinkAPI *deviceAPI) :
connect ( m_networkManager , SIGNAL ( finished ( QNetworkReply * ) ) , this , SLOT ( networkManagerFinished ( QNetworkReply * ) ) ) ;
}
Daemon Source: : ~ Daemon Source( )
Remote Source: : ~ Remote Source( )
{
disconnect ( m_networkManager , SIGNAL ( finished ( QNetworkReply * ) ) , this , SLOT ( networkManagerFinished ( QNetworkReply * ) ) ) ;
delete m_networkManager ;
@ -77,33 +78,33 @@ DaemonSource::~DaemonSource()
@@ -77,33 +78,33 @@ DaemonSource::~DaemonSource()
delete m_channelizer ;
}
void Daemon Source: : pull ( Sample & sample )
void Remote Source: : pull ( Sample & sample )
{
m_dataReadQueue . readSample ( sample , true ) ; // true is scale for Tx
}
void Daemon Source: : pullAudio ( int nbSamples )
void Remote Source: : pullAudio ( int nbSamples )
{
( void ) nbSamples ;
}
void Daemon Source: : start ( )
void Remote Source: : start ( )
{
qDebug ( " Daemon Source::start" ) ;
qDebug ( " Remote Source::start" ) ;
if ( m_running ) {
stop ( ) ;
}
m_sourceThread = new Daemon SourceThread( & m_dataQueue ) ;
m_sourceThread = new Remote SourceThread( & m_dataQueue ) ;
m_sourceThread - > startStop ( true ) ;
m_sourceThread - > dataBind ( m_settings . m_dataAddress , m_settings . m_dataPort ) ;
m_running = true ;
}
void Daemon Source: : stop ( )
void Remote Source: : stop ( )
{
qDebug ( " Daemon Source::stop" ) ;
qDebug ( " Remote Source::stop" ) ;
if ( m_sourceThread ! = 0 )
{
@ -115,22 +116,22 @@ void DaemonSource::stop()
@@ -115,22 +116,22 @@ void DaemonSource::stop()
m_running = false ;
}
void Daemon Source: : setDataLink ( const QString & dataAddress , uint16_t dataPort )
void Remote Source: : setDataLink ( const QString & dataAddress , uint16_t dataPort )
{
Daemon SourceSettings settings = m_settings ;
Remote SourceSettings settings = m_settings ;
settings . m_dataAddress = dataAddress ;
settings . m_dataPort = dataPort ;
MsgConfigureDaemon Source * msg = MsgConfigureDaemon Source : : create ( settings , false ) ;
MsgConfigureRemote Source * msg = MsgConfigureRemote Source : : create ( settings , false ) ;
m_inputMessageQueue . push ( msg ) ;
}
bool Daemon Source: : handleMessage ( const Message & cmd )
bool Remote Source: : handleMessage ( const Message & cmd )
{
if ( UpChannelizer : : MsgChannelizerNotification : : match ( cmd ) )
{
UpChannelizer : : MsgChannelizerNotification & notif = ( UpChannelizer : : MsgChannelizerNotification & ) cmd ;
qDebug ( ) < < " Daemon Source::handleMessage: MsgChannelizerNotification:"
qDebug ( ) < < " Remote Source::handleMessage: MsgChannelizerNotification:"
< < " basebandSampleRate: " < < notif . getBasebandSampleRate ( )
< < " outputSampleRate: " < < notif . getSampleRate ( )
< < " inputFrequencyOffset: " < < notif . getFrequencyOffset ( ) ;
@ -143,10 +144,10 @@ bool DaemonSource::handleMessage(const Message& cmd)
@@ -143,10 +144,10 @@ bool DaemonSource::handleMessage(const Message& cmd)
return true ;
}
else if ( MsgConfigureDaemon Source : : match ( cmd ) )
else if ( MsgConfigureRemote Source : : match ( cmd ) )
{
MsgConfigureDaemon Source & cfg = ( MsgConfigureDaemon Source & ) cmd ;
qDebug ( ) < < " MsgConfigureDaemonSource::handleMessage: MsgConfigureDaemon Source " ;
MsgConfigureRemote Source & cfg = ( MsgConfigureRemote Source & ) cmd ;
qDebug ( ) < < " MsgConfigureRemoteSource::handleMessage: MsgConfigureRemote Source " ;
applySettings ( cfg . getSettings ( ) , cfg . getForce ( ) ) ;
return true ;
@ -178,32 +179,32 @@ bool DaemonSource::handleMessage(const Message& cmd)
@@ -178,32 +179,32 @@ bool DaemonSource::handleMessage(const Message& cmd)
return false ;
}
QByteArray Daemon Source: : serialize ( ) const
QByteArray Remote Source: : serialize ( ) const
{
return m_settings . serialize ( ) ;
}
bool Daemon Source: : deserialize ( const QByteArray & data )
bool Remote Source: : deserialize ( const QByteArray & data )
{
( void ) data ;
if ( m_settings . deserialize ( data ) )
{
MsgConfigureDaemon Source * msg = MsgConfigureDaemon Source : : create ( m_settings , true ) ;
MsgConfigureRemote Source * msg = MsgConfigureRemote Source : : create ( m_settings , true ) ;
m_inputMessageQueue . push ( msg ) ;
return true ;
}
else
{
m_settings . resetToDefaults ( ) ;
MsgConfigureDaemon Source * msg = MsgConfigureDaemon Source : : create ( m_settings , true ) ;
MsgConfigureRemote Source * msg = MsgConfigureRemote Source : : create ( m_settings , true ) ;
m_inputMessageQueue . push ( msg ) ;
return false ;
}
}
void Daemon Source: : applySettings ( const Daemon SourceSettings& settings , bool force )
void Remote Source: : applySettings ( const Remote SourceSettings& settings , bool force )
{
qDebug ( ) < < " Daemon Source::applySettings:"
qDebug ( ) < < " Remote Source::applySettings:"
< < " m_dataAddress: " < < settings . m_dataAddress
< < " m_dataPort: " < < settings . m_dataPort
< < " force: " < < force ;
@ -242,12 +243,12 @@ void DaemonSource::applySettings(const DaemonSourceSettings& settings, bool forc
@@ -242,12 +243,12 @@ void DaemonSource::applySettings(const DaemonSourceSettings& settings, bool forc
m_settings = settings ;
}
void Daemon Source: : handleDataBlock ( SDRDaemonDataBlock * dataBlock )
void Remote Source: : handleDataBlock ( SDRDaemonDataBlock * dataBlock )
{
( void ) dataBlock ;
if ( dataBlock - > m_rxControlBlock . m_blockCount < SDRDaemonNbOrginalBlocks )
{
qWarning ( " Daemon Source::handleDataBlock: incomplete data block: not processing" ) ;
qWarning ( " Remote Source::handleDataBlock: incomplete data block: not processing" ) ;
}
else
{
@ -274,7 +275,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
@@ -274,7 +275,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
// Need to use the CM256 recovery
if ( m_cm256p & & ( dataBlock - > m_rxControlBlock . m_originalCount < SDRDaemonNbOrginalBlocks ) )
{
qDebug ( " Daemon Source::handleDataBlock: %d recovery blocks" , dataBlock - > m_rxControlBlock . m_recoveryCount ) ;
qDebug ( " Remote Source::handleDataBlock: %d recovery blocks" , dataBlock - > m_rxControlBlock . m_recoveryCount ) ;
CM256 : : cm256_encoder_params paramsCM256 ;
paramsCM256 . BlockBytes = sizeof ( SDRDaemonProtectedBlock ) ; // never changes
paramsCM256 . OriginalCount = SDRDaemonNbOrginalBlocks ; // never changes
@ -294,7 +295,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
@@ -294,7 +295,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
if ( m_cm256 . cm256_decode ( paramsCM256 , m_cm256DescriptorBlocks ) ) // CM256 decode
{
qWarning ( ) < < " Daemon Source::handleDataBlock: decode CM256 error:"
qWarning ( ) < < " Remote Source::handleDataBlock: decode CM256 error:"
< < " m_originalCount: " < < dataBlock - > m_rxControlBlock . m_originalCount
< < " m_recoveryCount: " < < dataBlock - > m_rxControlBlock . m_recoveryCount ;
}
@ -325,7 +326,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
@@ -325,7 +326,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
{
if ( ! ( m_currentMeta = = * metaData ) )
{
printMeta ( " Daemon Source::handleDataBlock" , metaData ) ;
printMeta ( " Remote Source::handleDataBlock" , metaData ) ;
if ( m_currentMeta . m_sampleRate ! = metaData - > m_sampleRate )
{
@ -338,7 +339,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
@@ -338,7 +339,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
}
else
{
qWarning ( ) < < " Daemon Source::handleDataBlock: recovered meta: invalid CRC32" ;
qWarning ( ) < < " Remote Source::handleDataBlock: recovered meta: invalid CRC32" ;
}
}
@ -346,7 +347,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
@@ -346,7 +347,7 @@ void DaemonSource::handleDataBlock(SDRDaemonDataBlock* dataBlock)
}
}
void Daemon Source: : handleData ( )
void Remote Source: : handleData ( )
{
SDRDaemonDataBlock * dataBlock ;
@ -355,7 +356,7 @@ void DaemonSource::handleData()
@@ -355,7 +356,7 @@ void DaemonSource::handleData()
}
}
void Daemon Source: : printMeta ( const QString & header , SDRDaemonMetaDataFEC * metaData )
void Remote Source: : printMeta ( const QString & header , SDRDaemonMetaDataFEC * metaData )
{
qDebug ( ) . noquote ( ) < < header < < " : "
< < " | " < < metaData - > m_centerFrequency
@ -369,41 +370,41 @@ void DaemonSource::printMeta(const QString& header, SDRDaemonMetaDataFEC *metaDa
@@ -369,41 +370,41 @@ void DaemonSource::printMeta(const QString& header, SDRDaemonMetaDataFEC *metaDa
< < " | " ;
}
uint32_t Daemon Source: : calculateDataReadQueueSize ( int sampleRate )
uint32_t Remote Source: : calculateDataReadQueueSize ( int sampleRate )
{
// scale for 20 blocks at 48 kS/s. Take next even number.
uint32_t maxSize = sampleRate / 2400 ;
maxSize = ( maxSize % 2 = = 0 ) ? maxSize : maxSize + 1 ;
qDebug ( " Daemon Source::calculateDataReadQueueSize: set max queue size to %u blocks" , maxSize ) ;
qDebug ( " Remote Source::calculateDataReadQueueSize: set max queue size to %u blocks" , maxSize ) ;
return maxSize ;
}
int Daemon Source: : webapiSettingsGet (
int Remote Source: : webapiSettingsGet (
SWGSDRangel : : SWGChannelSettings & response ,
QString & errorMessage )
{
( void ) errorMessage ;
response . setDaemon SourceSettings ( new SWGSDRangel : : SWGDaemon SourceSettings ( ) ) ;
response . getDaemon SourceSettings ( ) - > init ( ) ;
response . setRemote SourceSettings ( new SWGSDRangel : : SWGRemote SourceSettings ( ) ) ;
response . getRemote SourceSettings ( ) - > init ( ) ;
webapiFormatChannelSettings ( response , m_settings ) ;
return 200 ;
}
int Daemon Source: : webapiSettingsPutPatch (
int Remote Source: : webapiSettingsPutPatch (
bool force ,
const QStringList & channelSettingsKeys ,
SWGSDRangel : : SWGChannelSettings & response ,
QString & errorMessage )
{
( void ) errorMessage ;
Daemon SourceSettings settings = m_settings ;
Remote SourceSettings settings = m_settings ;
if ( channelSettingsKeys . contains ( " dataAddress " ) ) {
settings . m_dataAddress = * response . getDaemon SourceSettings ( ) - > getDataAddress ( ) ;
settings . m_dataAddress = * response . getRemote SourceSettings ( ) - > getDataAddress ( ) ;
}
if ( channelSettingsKeys . contains ( " dataPort " ) )
{
int dataPort = response . getDaemon SourceSettings ( ) - > getDataPort ( ) ;
int dataPort = response . getRemote SourceSettings ( ) - > getDataPort ( ) ;
if ( ( dataPort < 1024 ) | | ( dataPort > 65535 ) ) {
settings . m_dataPort = 9090 ;
@ -412,34 +413,34 @@ int DaemonSource::webapiSettingsPutPatch(
@@ -412,34 +413,34 @@ int DaemonSource::webapiSettingsPutPatch(
}
}
if ( channelSettingsKeys . contains ( " rgbColor " ) ) {
settings . m_rgbColor = response . getDaemon SourceSettings ( ) - > getRgbColor ( ) ;
settings . m_rgbColor = response . getRemote SourceSettings ( ) - > getRgbColor ( ) ;
}
if ( channelSettingsKeys . contains ( " title " ) ) {
settings . m_title = * response . getDaemon SourceSettings ( ) - > getTitle ( ) ;
settings . m_title = * response . getRemote SourceSettings ( ) - > getTitle ( ) ;
}
if ( channelSettingsKeys . contains ( " useReverseAPI " ) ) {
settings . m_useReverseAPI = response . getDaemon SourceSettings ( ) - > getUseReverseApi ( ) ! = 0 ;
settings . m_useReverseAPI = response . getRemote SourceSettings ( ) - > getUseReverseApi ( ) ! = 0 ;
}
if ( channelSettingsKeys . contains ( " reverseAPIAddress " ) ) {
settings . m_reverseAPIAddress = * response . getDaemon SourceSettings ( ) - > getReverseApiAddress ( ) ! = 0 ;
settings . m_reverseAPIAddress = * response . getRemote SourceSettings ( ) - > getReverseApiAddress ( ) ! = 0 ;
}
if ( channelSettingsKeys . contains ( " reverseAPIPort " ) ) {
settings . m_reverseAPIPort = response . getDaemon SourceSettings ( ) - > getReverseApiPort ( ) ;
settings . m_reverseAPIPort = response . getRemote SourceSettings ( ) - > getReverseApiPort ( ) ;
}
if ( channelSettingsKeys . contains ( " reverseAPIDeviceIndex " ) ) {
settings . m_reverseAPIDeviceIndex = response . getDaemon SourceSettings ( ) - > getReverseApiDeviceIndex ( ) ;
settings . m_reverseAPIDeviceIndex = response . getRemote SourceSettings ( ) - > getReverseApiDeviceIndex ( ) ;
}
if ( channelSettingsKeys . contains ( " reverseAPIChannelIndex " ) ) {
settings . m_reverseAPIChannelIndex = response . getDaemon SourceSettings ( ) - > getReverseApiChannelIndex ( ) ;
settings . m_reverseAPIChannelIndex = response . getRemote SourceSettings ( ) - > getReverseApiChannelIndex ( ) ;
}
MsgConfigureDaemon Source * msg = MsgConfigureDaemon Source : : create ( settings , force ) ;
MsgConfigureRemote Source * msg = MsgConfigureRemote Source : : create ( settings , force ) ;
m_inputMessageQueue . push ( msg ) ;
qDebug ( " Daemon Source::webapiSettingsPutPatch: forward to GUI: %p" , m_guiMessageQueue ) ;
qDebug ( " Remote Source::webapiSettingsPutPatch: forward to GUI: %p" , m_guiMessageQueue ) ;
if ( m_guiMessageQueue ) // forward to GUI if any
{
MsgConfigureDaemon Source * msgToGUI = MsgConfigureDaemon Source : : create ( settings , force ) ;
MsgConfigureRemote Source * msgToGUI = MsgConfigureRemote Source : : create ( settings , force ) ;
m_guiMessageQueue - > push ( msgToGUI ) ;
}
@ -448,88 +449,88 @@ int DaemonSource::webapiSettingsPutPatch(
@@ -448,88 +449,88 @@ int DaemonSource::webapiSettingsPutPatch(
return 200 ;
}
int Daemon Source: : webapiReportGet (
int Remote Source: : webapiReportGet (
SWGSDRangel : : SWGChannelReport & response ,
QString & errorMessage )
{
( void ) errorMessage ;
response . setDaemon SourceReport ( new SWGSDRangel : : SWGDaemon SourceReport ( ) ) ;
response . getDaemon SourceReport ( ) - > init ( ) ;
response . setRemote SourceReport ( new SWGSDRangel : : SWGRemote SourceReport ( ) ) ;
response . getRemote SourceReport ( ) - > init ( ) ;
webapiFormatChannelReport ( response ) ;
return 200 ;
}
void Daemon Source: : webapiFormatChannelSettings ( SWGSDRangel : : SWGChannelSettings & response , const Daemon SourceSettings& settings )
void Remote Source: : webapiFormatChannelSettings ( SWGSDRangel : : SWGChannelSettings & response , const Remote SourceSettings& settings )
{
if ( response . getDaemon SourceSettings ( ) - > getDataAddress ( ) ) {
* response . getDaemon SourceSettings ( ) - > getDataAddress ( ) = settings . m_dataAddress ;
if ( response . getRemote SourceSettings ( ) - > getDataAddress ( ) ) {
* response . getRemote SourceSettings ( ) - > getDataAddress ( ) = settings . m_dataAddress ;
} else {
response . getDaemon SourceSettings ( ) - > setDataAddress ( new QString ( settings . m_dataAddress ) ) ;
response . getRemote SourceSettings ( ) - > setDataAddress ( new QString ( settings . m_dataAddress ) ) ;
}
response . getDaemon SourceSettings ( ) - > setDataPort ( settings . m_dataPort ) ;
response . getDaemon SourceSettings ( ) - > setRgbColor ( settings . m_rgbColor ) ;
response . getRemote SourceSettings ( ) - > setDataPort ( settings . m_dataPort ) ;
response . getRemote SourceSettings ( ) - > setRgbColor ( settings . m_rgbColor ) ;
if ( response . getDaemon SourceSettings ( ) - > getTitle ( ) ) {
* response . getDaemon SourceSettings ( ) - > getTitle ( ) = settings . m_title ;
if ( response . getRemote SourceSettings ( ) - > getTitle ( ) ) {
* response . getRemote SourceSettings ( ) - > getTitle ( ) = settings . m_title ;
} else {
response . getDaemon SourceSettings ( ) - > setTitle ( new QString ( settings . m_title ) ) ;
response . getRemote SourceSettings ( ) - > setTitle ( new QString ( settings . m_title ) ) ;
}
response . getDaemon SourceSettings ( ) - > setUseReverseApi ( settings . m_useReverseAPI ? 1 : 0 ) ;
response . getRemote SourceSettings ( ) - > setUseReverseApi ( settings . m_useReverseAPI ? 1 : 0 ) ;
if ( response . getDaemon SourceSettings ( ) - > getReverseApiAddress ( ) ) {
* response . getDaemon SourceSettings ( ) - > getReverseApiAddress ( ) = settings . m_reverseAPIAddress ;
if ( response . getRemote SourceSettings ( ) - > getReverseApiAddress ( ) ) {
* response . getRemote SourceSettings ( ) - > getReverseApiAddress ( ) = settings . m_reverseAPIAddress ;
} else {
response . getDaemon SourceSettings ( ) - > setReverseApiAddress ( new QString ( settings . m_reverseAPIAddress ) ) ;
response . getRemote SourceSettings ( ) - > setReverseApiAddress ( new QString ( settings . m_reverseAPIAddress ) ) ;
}
response . getDaemon SourceSettings ( ) - > setReverseApiPort ( settings . m_reverseAPIPort ) ;
response . getDaemon SourceSettings ( ) - > setReverseApiDeviceIndex ( settings . m_reverseAPIDeviceIndex ) ;
response . getDaemon SourceSettings ( ) - > setReverseApiChannelIndex ( settings . m_reverseAPIChannelIndex ) ;
response . getRemote SourceSettings ( ) - > setReverseApiPort ( settings . m_reverseAPIPort ) ;
response . getRemote SourceSettings ( ) - > setReverseApiDeviceIndex ( settings . m_reverseAPIDeviceIndex ) ;
response . getRemote SourceSettings ( ) - > setReverseApiChannelIndex ( settings . m_reverseAPIChannelIndex ) ;
}
void Daemon Source: : webapiFormatChannelReport ( SWGSDRangel : : SWGChannelReport & response )
void Remote Source: : webapiFormatChannelReport ( SWGSDRangel : : SWGChannelReport & response )
{
struct timeval tv ;
gettimeofday ( & tv , 0 ) ;
response . getDaemon SourceReport ( ) - > setTvSec ( tv . tv_sec ) ;
response . getDaemon SourceReport ( ) - > setTvUSec ( tv . tv_usec ) ;
response . getDaemon SourceReport ( ) - > setQueueSize ( m_dataReadQueue . size ( ) ) ;
response . getDaemon SourceReport ( ) - > setQueueLength ( m_dataReadQueue . length ( ) ) ;
response . getDaemon SourceReport ( ) - > setSamplesCount ( m_dataReadQueue . readSampleCount ( ) ) ;
response . getDaemon SourceReport ( ) - > setCorrectableErrorsCount ( m_nbCorrectableErrors ) ;
response . getDaemon SourceReport ( ) - > setUncorrectableErrorsCount ( m_nbUncorrectableErrors ) ;
response . getDaemon SourceReport ( ) - > setNbOriginalBlocks ( m_currentMeta . m_nbOriginalBlocks ) ;
response . getDaemon SourceReport ( ) - > setNbFecBlocks ( m_currentMeta . m_nbFECBlocks ) ;
response . getDaemon SourceReport ( ) - > setCenterFreq ( m_currentMeta . m_centerFrequency ) ;
response . getDaemon SourceReport ( ) - > setSampleRate ( m_currentMeta . m_sampleRate ) ;
response . getDaemon SourceReport ( ) - > setDeviceCenterFreq ( m_deviceAPI - > getSampleSink ( ) - > getCenterFrequency ( ) / 1000 ) ;
response . getDaemon SourceReport ( ) - > setDeviceSampleRate ( m_deviceAPI - > getSampleSink ( ) - > getSampleRate ( ) ) ;
response . getRemote SourceReport ( ) - > setTvSec ( tv . tv_sec ) ;
response . getRemote SourceReport ( ) - > setTvUSec ( tv . tv_usec ) ;
response . getRemote SourceReport ( ) - > setQueueSize ( m_dataReadQueue . size ( ) ) ;
response . getRemote SourceReport ( ) - > setQueueLength ( m_dataReadQueue . length ( ) ) ;
response . getRemote SourceReport ( ) - > setSamplesCount ( m_dataReadQueue . readSampleCount ( ) ) ;
response . getRemote SourceReport ( ) - > setCorrectableErrorsCount ( m_nbCorrectableErrors ) ;
response . getRemote SourceReport ( ) - > setUncorrectableErrorsCount ( m_nbUncorrectableErrors ) ;
response . getRemote SourceReport ( ) - > setNbOriginalBlocks ( m_currentMeta . m_nbOriginalBlocks ) ;
response . getRemote SourceReport ( ) - > setNbFecBlocks ( m_currentMeta . m_nbFECBlocks ) ;
response . getRemote SourceReport ( ) - > setCenterFreq ( m_currentMeta . m_centerFrequency ) ;
response . getRemote SourceReport ( ) - > setSampleRate ( m_currentMeta . m_sampleRate ) ;
response . getRemote SourceReport ( ) - > setDeviceCenterFreq ( m_deviceAPI - > getSampleSink ( ) - > getCenterFrequency ( ) / 1000 ) ;
response . getRemote SourceReport ( ) - > setDeviceSampleRate ( m_deviceAPI - > getSampleSink ( ) - > getSampleRate ( ) ) ;
}
void Daemon Source: : webapiReverseSendSettings ( QList < QString > & channelSettingsKeys , const Daemon SourceSettings& settings , bool force )
void Remote Source: : webapiReverseSendSettings ( QList < QString > & channelSettingsKeys , const Remote SourceSettings& settings , bool force )
{
SWGSDRangel : : SWGChannelSettings * swgChannelSettings = new SWGSDRangel : : SWGChannelSettings ( ) ;
swgChannelSettings - > setTx ( 1 ) ;
swgChannelSettings - > setChannelType ( new QString ( " Daemon Source" ) ) ;
swgChannelSettings - > setDaemon SourceSettings ( new SWGSDRangel : : SWGDaemon SourceSettings ( ) ) ;
SWGSDRangel : : SWGDaemonSourceSettings * swgDaemon SourceSettings = swgChannelSettings - > getDaemon SourceSettings ( ) ;
swgChannelSettings - > setChannelType ( new QString ( " Remote Source" ) ) ;
swgChannelSettings - > setRemote SourceSettings ( new SWGSDRangel : : SWGRemote SourceSettings ( ) ) ;
SWGSDRangel : : SWGRemoteSourceSettings * swgRemote SourceSettings = swgChannelSettings - > getRemote SourceSettings ( ) ;
// transfer data that has been modified. When force is on transfer all data except reverse API data
if ( channelSettingsKeys . contains ( " dataAddress " ) | | force ) {
swgDaemon SourceSettings - > setDataAddress ( new QString ( settings . m_dataAddress ) ) ;
swgRemote SourceSettings - > setDataAddress ( new QString ( settings . m_dataAddress ) ) ;
}
if ( channelSettingsKeys . contains ( " dataPort " ) | | force ) {
swgDaemon SourceSettings - > setDataPort ( settings . m_dataPort ) ;
swgRemote SourceSettings - > setDataPort ( settings . m_dataPort ) ;
}
if ( channelSettingsKeys . contains ( " rgbColor " ) | | force ) {
swgDaemon SourceSettings - > setRgbColor ( settings . m_rgbColor ) ;
swgRemote SourceSettings - > setRgbColor ( settings . m_rgbColor ) ;
}
if ( channelSettingsKeys . contains ( " title " ) | | force ) {
swgDaemon SourceSettings - > setTitle ( new QString ( settings . m_title ) ) ;
swgRemote SourceSettings - > setTitle ( new QString ( settings . m_title ) ) ;
}
QString channelSettingsURL = QString ( " http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings " )
@ -551,13 +552,13 @@ void DaemonSource::webapiReverseSendSettings(QList<QString>& channelSettingsKeys
@@ -551,13 +552,13 @@ void DaemonSource::webapiReverseSendSettings(QList<QString>& channelSettingsKeys
delete swgChannelSettings ;
}
void Daemon Source: : networkManagerFinished ( QNetworkReply * reply )
void Remote Source: : networkManagerFinished ( QNetworkReply * reply )
{
QNetworkReply : : NetworkError replyError = reply - > error ( ) ;
if ( replyError )
{
qWarning ( ) < < " Daemon Source::networkManagerFinished:"
qWarning ( ) < < " Remote Source::networkManagerFinished:"
< < " error( " < < ( int ) replyError
< < " ): " < < replyError
< < " : " < < reply - > errorString ( ) ;
@ -566,5 +567,5 @@ void DaemonSource::networkManagerFinished(QNetworkReply *reply)
@@ -566,5 +567,5 @@ void DaemonSource::networkManagerFinished(QNetworkReply *reply)
QString answer = reply - > readAll ( ) ;
answer . chop ( 1 ) ; // remove last \n
qDebug ( " Daemon Source::networkManagerFinished: reply:\n %s " , answer . toStdString ( ) . c_str ( ) ) ;
qDebug ( " Remote Source::networkManagerFinished: reply:\n %s " , answer . toStdString ( ) . c_str ( ) ) ;
}