1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

several fixes to the notify plugin

This commit is contained in:
zedamota 2012-01-09 16:09:50 +00:00
parent 9f2b71a351
commit 38392ee638
2 changed files with 4 additions and 7 deletions

View File

@ -333,6 +333,8 @@ QStringList valueToSoundList(QString value)
QString stringFromValue(QVariant value, UAVObjectField* field) QString stringFromValue(QVariant value, UAVObjectField* field)
{ {
if(field==NULL)
return "";
Q_ASSERT(field); Q_ASSERT(field);
Q_ASSERT(!value.isNull()); Q_ASSERT(!value.isNull());
QString str; QString str;

View File

@ -256,13 +256,6 @@ void SoundNotifyPlugin::on_arrived_Notification(UAVObject *object)
.arg(ntf->singleValue().toString()) .arg(ntf->singleValue().toString())
.arg(ntf->valueRange2()); .arg(ntf->valueRange2());
QString fieldName = ntf->getObjectField();
UAVObjectField* field = object->getField(fieldName);
qNotifyDebug() << QString("UAV object: %1 | value: %2")
.arg(object->getName())
.arg(field->getValue().toString());
checkNotificationRule(ntf, object); checkNotificationRule(ntf, object);
} }
connect(object, SIGNAL(objectUpdated(UAVObject*)), connect(object, SIGNAL(objectUpdated(UAVObject*)),
@ -402,6 +395,8 @@ bool checkRange(double fieldValue, double min, double max, int direction)
void SoundNotifyPlugin::checkNotificationRule(NotificationItem* notification, UAVObject* object) void SoundNotifyPlugin::checkNotificationRule(NotificationItem* notification, UAVObject* object)
{ {
if(notification->getDataObject()!=object->getName() | object->getField(notification->getObjectField())==NULL)
return;
bool condition=false; bool condition=false;
if (notification->mute()) if (notification->mute())