LimeSDR: moved MsgReportDeviceInfo to shared structure

This commit is contained in:
f4exb 2017-07-03 14:12:51 +02:00
parent 8a19a66af0
commit 87ccef02b6
5 changed files with 26 additions and 26 deletions

View File

@ -17,3 +17,4 @@
#include "devicelimesdrshared.h"
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgCrossReportToGUI, Message)
MESSAGE_CLASS_DEFINITION(DeviceLimeSDRShared::MsgReportDeviceInfo, Message)

View File

@ -47,6 +47,26 @@ public:
{ }
};
class MsgReportDeviceInfo : public Message {
MESSAGE_CLASS_DECLARATION
public:
float getTemperature() const { return m_temperature; }
static MsgReportDeviceInfo* create(float temperature)
{
return new MsgReportDeviceInfo(temperature);
}
private:
float m_temperature;
MsgReportDeviceInfo(float temperature) :
Message(),
m_temperature(temperature)
{ }
};
class ThreadInterface
{
public:

View File

@ -35,7 +35,6 @@ MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgGetDeviceInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgSetReferenceConfig, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportLimeSDRToGUI, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportStreamInfo, Message)
MESSAGE_CLASS_DEFINITION(LimeSDRInput::MsgReportDeviceInfo, Message)
LimeSDRInput::LimeSDRInput(DeviceSourceAPI *deviceAPI) :
@ -458,7 +457,7 @@ bool LimeSDRInput::handleMessage(const Message& message)
}
// send to oneself
MsgReportDeviceInfo *report = MsgReportDeviceInfo::create(temp);
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
m_deviceAPI->getDeviceOutputMessageQueue()->push(report);
// send to source buddies
@ -467,7 +466,7 @@ bool LimeSDRInput::handleMessage(const Message& message)
for (; itSource != sourceBuddies.end(); ++itSource)
{
MsgReportDeviceInfo *report = MsgReportDeviceInfo::create(temp);
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSource)->getDeviceOutputMessageQueue()->push(report);
}
@ -477,7 +476,7 @@ bool LimeSDRInput::handleMessage(const Message& message)
for (; itSink != sinkBuddies.end(); ++itSink)
{
MsgReportDeviceInfo *report = MsgReportDeviceInfo::create(temp);
DeviceLimeSDRShared::MsgReportDeviceInfo *report = DeviceLimeSDRShared::MsgReportDeviceInfo::create(temp);
(*itSink)->getDeviceOutputMessageQueue()->push(report);
}
}

View File

@ -208,26 +208,6 @@ public:
{ }
};
class MsgReportDeviceInfo : public Message {
MESSAGE_CLASS_DECLARATION
public:
float getTemperature() const { return m_temperature; }
static MsgReportDeviceInfo* create(float temperature)
{
return new MsgReportDeviceInfo(temperature);
}
private:
float m_temperature;
MsgReportDeviceInfo(float temperature) :
Message(),
m_temperature(temperature)
{ }
};
LimeSDRInput(DeviceSourceAPI *deviceAPI);
virtual ~LimeSDRInput();

View File

@ -236,9 +236,9 @@ void LimeSDRInputGUI::handleMessagesToGUI()
ui->streamStatusLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
}
else if (LimeSDRInput::MsgReportDeviceInfo::match(*message))
else if (DeviceLimeSDRShared::MsgReportDeviceInfo::match(*message))
{
LimeSDRInput::MsgReportDeviceInfo *report = (LimeSDRInput::MsgReportDeviceInfo *) message;
DeviceLimeSDRShared::MsgReportDeviceInfo *report = (DeviceLimeSDRShared::MsgReportDeviceInfo *) message;
ui->temperatureText->setText(tr("%1C").arg(QString::number(report->getTemperature(), 'f', 0)));
}
}