Limit sensors available as possible RSSI source

This commit is contained in:
elecpower
2021-03-10 07:45:36 +11:00
parent e94f6c0ccd
commit 5b44f150cf
8 changed files with 109 additions and 8 deletions
+22
View File
@@ -427,6 +427,28 @@ bool SensorData::isSourceAvailable(const ModelData * model, const int index)
return false;
}
#define RSSI_ID 0xF101
// static
bool SensorData::isRssiSensorAvailable(const ModelData * model, const int value)
{
if (value == 0)
return true;
else {
const SensorData &sensor = model->sensorData[abs(value) - 1];
return (sensor.isAvailable() && sensor.id == RSSI_ID);
}
}
// static
QString SensorData::rssiSensorToString(const ModelData * model, const int value)
{
if (value == 0)
return tr("(default)");
else
return sourceToString(model, value);
}
// static
AbstractStaticItemModel * SensorData::typeItemModel()
{