mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-04-11 03:02:20 +02:00
GCS-Allow for more than 1 limit per index
This commit is contained in:
parent
cb26100d65
commit
352f18bec0
@ -112,76 +112,94 @@ void UAVObjectField::limitsInitialize(const QString &limits)
|
|||||||
QStringList stringPerElement=limits.split(",");
|
QStringList stringPerElement=limits.split(",");
|
||||||
quint32 index=0;
|
quint32 index=0;
|
||||||
foreach (QString str, stringPerElement) {
|
foreach (QString str, stringPerElement) {
|
||||||
QString _str=str.trimmed();
|
QStringList ruleList=str.split(";");
|
||||||
if(_str.isEmpty())
|
QList<LimitStruct> limitList;
|
||||||
continue;
|
foreach(QString rule,ruleList)
|
||||||
QStringList valuesPerElement=_str.split(":");
|
|
||||||
LimitStruct lstruc;
|
|
||||||
bool b1=valuesPerElement.at(0).startsWith("%");
|
|
||||||
bool b2=(int)(index)<(int)numElements;
|
|
||||||
bool b3=valuesPerElement.at(0).size()==3;
|
|
||||||
bool auxb;
|
|
||||||
valuesPerElement.at(0).mid(1,4).toInt(&auxb,16);
|
|
||||||
bool b4=((valuesPerElement.at(0).size())==7 && auxb);
|
|
||||||
if(b1 && b2 && (b3 || b4))
|
|
||||||
{
|
{
|
||||||
if(b4)
|
QString _str=rule.trimmed();
|
||||||
lstruc.board=valuesPerElement.at(0).mid(1,4).toInt(&auxb,16);
|
if(_str.isEmpty())
|
||||||
else
|
continue;
|
||||||
lstruc.board=0;
|
QStringList valuesPerElement=_str.split(":");
|
||||||
if(valuesPerElement.at(0).right(2)=="EQ")
|
LimitStruct lstruc;
|
||||||
lstruc.type=EQUAL;
|
bool b1=valuesPerElement.at(0).startsWith("%");
|
||||||
else if(valuesPerElement.at(0).right(2)=="NE")
|
bool b2=(int)(index)<(int)numElements;
|
||||||
lstruc.type=NOT_EQUAL;
|
bool b3=valuesPerElement.at(0).size()==3;
|
||||||
else if(valuesPerElement.at(0).right(2)=="BE")
|
bool auxb;
|
||||||
lstruc.type=BETWEEN;
|
valuesPerElement.at(0).mid(1,4).toInt(&auxb,16);
|
||||||
else if(valuesPerElement.at(0).right(2)=="BI")
|
bool b4=((valuesPerElement.at(0).size())==7 && auxb);
|
||||||
lstruc.type=BIGGER;
|
if(b1 && b2 && (b3 || b4))
|
||||||
else if(valuesPerElement.at(0).right(2)=="SM")
|
|
||||||
lstruc.type=SMALLER;
|
|
||||||
else
|
|
||||||
qDebug()<<"limits parsing failed (invalid property) on UAVObjectField"<<name;
|
|
||||||
valuesPerElement.removeAt(0);
|
|
||||||
foreach(QString _value,valuesPerElement)
|
|
||||||
{
|
{
|
||||||
QString value=_value.trimmed();
|
if(b4)
|
||||||
switch (type)
|
lstruc.board=valuesPerElement.at(0).mid(1,4).toInt(&auxb,16);
|
||||||
|
else
|
||||||
|
lstruc.board=0;
|
||||||
|
if(valuesPerElement.at(0).right(2)=="EQ")
|
||||||
|
lstruc.type=EQUAL;
|
||||||
|
else if(valuesPerElement.at(0).right(2)=="NE")
|
||||||
|
lstruc.type=NOT_EQUAL;
|
||||||
|
else if(valuesPerElement.at(0).right(2)=="BE")
|
||||||
|
lstruc.type=BETWEEN;
|
||||||
|
else if(valuesPerElement.at(0).right(2)=="BI")
|
||||||
|
lstruc.type=BIGGER;
|
||||||
|
else if(valuesPerElement.at(0).right(2)=="SM")
|
||||||
|
lstruc.type=SMALLER;
|
||||||
|
else
|
||||||
|
qDebug()<<"limits parsing failed (invalid property) on UAVObjectField"<<name;
|
||||||
|
valuesPerElement.removeAt(0);
|
||||||
|
foreach(QString _value,valuesPerElement)
|
||||||
{
|
{
|
||||||
case UINT8:
|
QString value=_value.trimmed();
|
||||||
case UINT16:
|
switch (type)
|
||||||
case UINT32:
|
{
|
||||||
case BITFIELD:
|
case UINT8:
|
||||||
lstruc.values.append((quint32)value.toULong());
|
case UINT16:
|
||||||
break;
|
case UINT32:
|
||||||
case INT8:
|
case BITFIELD:
|
||||||
case INT16:
|
lstruc.values.append((quint32)value.toULong());
|
||||||
case INT32:
|
break;
|
||||||
lstruc.values.append((qint32)value.toLong());
|
case INT8:
|
||||||
break;
|
case INT16:
|
||||||
case FLOAT32:
|
case INT32:
|
||||||
lstruc.values.append((float)value.toFloat());
|
lstruc.values.append((qint32)value.toLong());
|
||||||
break;
|
break;
|
||||||
case ENUM:
|
case FLOAT32:
|
||||||
lstruc.values.append((QString)value);
|
lstruc.values.append((float)value.toFloat());
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case ENUM:
|
||||||
lstruc.values.append((QString)value);
|
lstruc.values.append((QString)value);
|
||||||
break;
|
break;
|
||||||
default:
|
case STRING:
|
||||||
lstruc.values.append(QVariant());
|
lstruc.values.append((QString)value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
lstruc.values.append(QVariant());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
limitList.append(lstruc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!valuesPerElement.at(0).isEmpty() && !b1)
|
||||||
|
qDebug()<<"limits parsing failed (property doesn't start with %) on UAVObjectField"<<name;
|
||||||
|
else if(!b2)
|
||||||
|
qDebug()<<"limits parsing failed (index>numelements) on UAVObjectField"<<name<<"index"<<index<<"numElements"<<numElements;
|
||||||
|
else if(!b3 || !b4 )
|
||||||
|
qDebug()<<"limits parsing failed limit not starting with %XX or %YYYYXX where XX is the limit type and YYYY is the board type on UAVObjectField"<<name;
|
||||||
}
|
}
|
||||||
elementLimits.insert(index,lstruc);
|
|
||||||
++index;
|
|
||||||
}
|
}
|
||||||
else
|
elementLimits.insert(index,limitList);
|
||||||
|
++index;
|
||||||
|
|
||||||
|
}
|
||||||
|
foreach(QList<LimitStruct> limitList,elementLimits)
|
||||||
|
{
|
||||||
|
foreach(LimitStruct limit,limitList)
|
||||||
{
|
{
|
||||||
if(!valuesPerElement.at(0).isEmpty() && !b1)
|
qDebug()<<"Limit type"<<limit.type<<"for board"<<limit.board<<"for field"<<getName();
|
||||||
qDebug()<<"limits parsing failed (property doesn't start with %) on UAVObjectField"<<name;
|
foreach(QVariant var,limit.values)
|
||||||
else if(!b2)
|
{
|
||||||
qDebug()<<"limits parsing failed (index>numelements) on UAVObjectField"<<name<<"index"<<index<<"numElements"<<numElements;
|
qDebug()<<"value"<<var;
|
||||||
else if(!b3 || !b4 )
|
}
|
||||||
qDebug()<<"limits parsing failed limit not starting with %XX or %YYYYXX where XX is the limit type and YYYY is the board type on UAVObjectField"<<name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -189,210 +207,213 @@ bool UAVObjectField::isWithinLimits(QVariant var,quint32 index, int board)
|
|||||||
{
|
{
|
||||||
if(!elementLimits.keys().contains(index))
|
if(!elementLimits.keys().contains(index))
|
||||||
return true;
|
return true;
|
||||||
LimitStruct struc=elementLimits.value(index);
|
|
||||||
if((struc.board!=board) && board!=0 && struc.board!=0)
|
foreach(LimitStruct struc,elementLimits.value(index))
|
||||||
return true;
|
|
||||||
switch(struc.type)
|
|
||||||
{
|
{
|
||||||
case EQUAL:
|
if((struc.board!=board) && board!=0 && struc.board!=0)
|
||||||
switch (type)
|
continue;
|
||||||
|
switch(struc.type)
|
||||||
{
|
{
|
||||||
case INT8:
|
case EQUAL:
|
||||||
case INT16:
|
switch (type)
|
||||||
case INT32:
|
{
|
||||||
foreach (QVariant vars, struc.values) {
|
case INT8:
|
||||||
if(var.toInt()==vars.toInt())
|
case INT16:
|
||||||
return true;
|
case INT32:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toInt()==vars.toInt())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case UINT8:
|
||||||
|
case UINT16:
|
||||||
|
case UINT32:
|
||||||
|
case BITFIELD:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toUInt()==vars.toUInt())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case ENUM:
|
||||||
|
case STRING:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toString()==vars.toString())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case FLOAT32:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toFloat()==vars.toFloat())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
break;
|
break;
|
||||||
case UINT8:
|
case NOT_EQUAL:
|
||||||
case UINT16:
|
switch (type)
|
||||||
case UINT32:
|
{
|
||||||
case BITFIELD:
|
case INT8:
|
||||||
foreach (QVariant vars, struc.values) {
|
case INT16:
|
||||||
if(var.toUInt()==vars.toUInt())
|
case INT32:
|
||||||
return true;
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toInt()==vars.toInt())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case UINT8:
|
||||||
|
case UINT16:
|
||||||
|
case UINT32:
|
||||||
|
case BITFIELD:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toUInt()==vars.toUInt())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case ENUM:
|
||||||
|
case STRING:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toString()==vars.toString())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case FLOAT32:
|
||||||
|
foreach (QVariant vars, struc.values) {
|
||||||
|
if(var.toFloat()==vars.toFloat())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
break;
|
break;
|
||||||
case ENUM:
|
case BETWEEN:
|
||||||
case STRING:
|
if(struc.values.length()<2)
|
||||||
foreach (QVariant vars, struc.values) {
|
{
|
||||||
if(var.toString()==vars.toString())
|
qDebug()<<__FUNCTION__<<"between limit with less than 1 pair, aborting; field:"<<name;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
if(struc.values.length()>2)
|
||||||
break;
|
qDebug()<<__FUNCTION__<<"between limit with more than 1 pair, using first; field"<<name;
|
||||||
case FLOAT32:
|
switch (type)
|
||||||
foreach (QVariant vars, struc.values) {
|
{
|
||||||
if(var.toFloat()==vars.toFloat())
|
case INT8:
|
||||||
return true;
|
case INT16:
|
||||||
|
case INT32:
|
||||||
|
if(!(var.toInt()>=struc.values.at(0).toInt() && var.toInt()<=struc.values.at(1).toInt()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case UINT8:
|
||||||
|
case UINT16:
|
||||||
|
case UINT32:
|
||||||
|
case BITFIELD:
|
||||||
|
if(!(var.toUInt()>=struc.values.at(0).toUInt() && var.toUInt()<=struc.values.at(1).toUInt()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case ENUM:
|
||||||
|
if(!(options.indexOf(var.toString())>=options.indexOf(struc.values.at(0).toString()) && options.indexOf(var.toString())<=options.indexOf(struc.values.at(1).toString())))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case FLOAT32:
|
||||||
|
if(!(var.toFloat()>=struc.values.at(0).toFloat() && var.toFloat()<=struc.values.at(1).toFloat()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
break;
|
break;
|
||||||
default:
|
case BIGGER:
|
||||||
return true;
|
if(struc.values.length()<1)
|
||||||
}
|
{
|
||||||
break;
|
qDebug()<<__FUNCTION__<<"BIGGER limit with less than 1 value, aborting; field:"<<name;
|
||||||
case NOT_EQUAL:
|
return true;
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case INT8:
|
|
||||||
case INT16:
|
|
||||||
case INT32:
|
|
||||||
foreach (QVariant vars, struc.values) {
|
|
||||||
if(var.toInt()==vars.toInt())
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
if(struc.values.length()>1)
|
||||||
break;
|
qDebug()<<__FUNCTION__<<"BIGGER limit with more than 1 value, using first; field"<<name;
|
||||||
case UINT8:
|
switch (type)
|
||||||
case UINT16:
|
{
|
||||||
case UINT32:
|
case INT8:
|
||||||
case BITFIELD:
|
case INT16:
|
||||||
foreach (QVariant vars, struc.values) {
|
case INT32:
|
||||||
if(var.toUInt()==vars.toUInt())
|
if(!(var.toInt()>=struc.values.at(0).toInt()))
|
||||||
return false;
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case UINT8:
|
||||||
|
case UINT16:
|
||||||
|
case UINT32:
|
||||||
|
case BITFIELD:
|
||||||
|
if(!(var.toUInt()>=struc.values.at(0).toUInt()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case ENUM:
|
||||||
|
if(!(options.indexOf(var.toString())>=options.indexOf(struc.values.at(0).toString())))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case FLOAT32:
|
||||||
|
if(!(var.toFloat()>=struc.values.at(0).toFloat()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
break;
|
break;
|
||||||
case ENUM:
|
case SMALLER:
|
||||||
case STRING:
|
switch (type)
|
||||||
foreach (QVariant vars, struc.values) {
|
{
|
||||||
if(var.toString()==vars.toString())
|
case INT8:
|
||||||
return false;
|
case INT16:
|
||||||
|
case INT32:
|
||||||
|
if(!(var.toInt()<=struc.values.at(0).toInt()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case UINT8:
|
||||||
|
case UINT16:
|
||||||
|
case UINT32:
|
||||||
|
case BITFIELD:
|
||||||
|
if(!(var.toUInt()<=struc.values.at(0).toUInt()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case ENUM:
|
||||||
|
if(!(options.indexOf(var.toString())<=options.indexOf(struc.values.at(0).toString())))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case STRING:
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
case FLOAT32:
|
||||||
|
if(!(var.toFloat()<=struc.values.at(0).toFloat()))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case FLOAT32:
|
|
||||||
foreach (QVariant vars, struc.values) {
|
|
||||||
if(var.toFloat()==vars.toFloat())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BETWEEN:
|
|
||||||
if(struc.values.length()<2)
|
|
||||||
{
|
|
||||||
qDebug()<<__FUNCTION__<<"between limit with less than 1 pair, aborting; field:"<<name;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(struc.values.length()>2)
|
|
||||||
qDebug()<<__FUNCTION__<<"between limit with more than 1 pair, using first; field"<<name;
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case INT8:
|
|
||||||
case INT16:
|
|
||||||
case INT32:
|
|
||||||
if(!(var.toInt()>=struc.values.at(0).toInt() && var.toInt()<=struc.values.at(1).toInt()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case UINT8:
|
|
||||||
case UINT16:
|
|
||||||
case UINT32:
|
|
||||||
case BITFIELD:
|
|
||||||
if(!(var.toUInt()>=struc.values.at(0).toUInt() && var.toUInt()<=struc.values.at(1).toUInt()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case ENUM:
|
|
||||||
if(!(options.indexOf(var.toString())>=options.indexOf(struc.values.at(0).toString()) && options.indexOf(var.toString())<=options.indexOf(struc.values.at(1).toString())))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case STRING:
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case FLOAT32:
|
|
||||||
if(!(var.toFloat()>=struc.values.at(0).toFloat() && var.toFloat()<=struc.values.at(1).toFloat()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BIGGER:
|
|
||||||
if(struc.values.length()<1)
|
|
||||||
{
|
|
||||||
qDebug()<<__FUNCTION__<<"BIGGER limit with less than 1 value, aborting; field:"<<name;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(struc.values.length()>1)
|
|
||||||
qDebug()<<__FUNCTION__<<"BIGGER limit with more than 1 value, using first; field"<<name;
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case INT8:
|
|
||||||
case INT16:
|
|
||||||
case INT32:
|
|
||||||
if(!(var.toInt()>=struc.values.at(0).toInt()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case UINT8:
|
|
||||||
case UINT16:
|
|
||||||
case UINT32:
|
|
||||||
case BITFIELD:
|
|
||||||
if(!(var.toUInt()>=struc.values.at(0).toUInt()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case ENUM:
|
|
||||||
if(!(options.indexOf(var.toString())>=options.indexOf(struc.values.at(0).toString())))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case STRING:
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case FLOAT32:
|
|
||||||
if(!(var.toFloat()>=struc.values.at(0).toFloat()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SMALLER:
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case INT8:
|
|
||||||
case INT16:
|
|
||||||
case INT32:
|
|
||||||
if(!(var.toInt()<=struc.values.at(0).toInt()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case UINT8:
|
|
||||||
case UINT16:
|
|
||||||
case UINT32:
|
|
||||||
case BITFIELD:
|
|
||||||
if(!(var.toUInt()<=struc.values.at(0).toUInt()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case ENUM:
|
|
||||||
if(!(options.indexOf(var.toString())<=options.indexOf(struc.values.at(0).toString())))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case STRING:
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
case FLOAT32:
|
|
||||||
if(!(var.toFloat()<=struc.values.at(0).toFloat()))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -402,55 +423,59 @@ QVariant UAVObjectField::getMaxLimit(quint32 index,int board)
|
|||||||
{
|
{
|
||||||
if(!elementLimits.keys().contains(index))
|
if(!elementLimits.keys().contains(index))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
LimitStruct struc=elementLimits.value(index);
|
foreach(LimitStruct struc,elementLimits.value(index))
|
||||||
if((struc.board!=board) && board!=0 && struc.board!=0)
|
|
||||||
return QVariant();
|
|
||||||
switch(struc.type)
|
|
||||||
{
|
{
|
||||||
case EQUAL:
|
if((struc.board!=board) && board!=0 && struc.board!=0)
|
||||||
case NOT_EQUAL:
|
continue;
|
||||||
case BIGGER:
|
switch(struc.type)
|
||||||
return QVariant();
|
{
|
||||||
break;
|
case EQUAL:
|
||||||
break;
|
case NOT_EQUAL:
|
||||||
case BETWEEN:
|
case BIGGER:
|
||||||
return struc.values.at(1);
|
return QVariant();
|
||||||
break;
|
break;
|
||||||
case SMALLER:
|
break;
|
||||||
return struc.values.at(0);
|
case BETWEEN:
|
||||||
break;
|
return struc.values.at(1);
|
||||||
default:
|
break;
|
||||||
return QVariant();
|
case SMALLER:
|
||||||
break;
|
return struc.values.at(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
QVariant UAVObjectField::getMinLimit(quint32 index, int board)
|
QVariant UAVObjectField::getMinLimit(quint32 index, int board)
|
||||||
{
|
{
|
||||||
if(!elementLimits.keys().contains(index))
|
if(!elementLimits.keys().contains(index))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
LimitStruct struc=elementLimits.value(index);
|
foreach(LimitStruct struc,elementLimits.value(index))
|
||||||
if((struc.board!=board) && board!=0 && struc.board!=0)
|
|
||||||
return QVariant();
|
|
||||||
switch(struc.type)
|
|
||||||
{
|
{
|
||||||
case EQUAL:
|
if((struc.board!=board) && board!=0 && struc.board!=0)
|
||||||
case NOT_EQUAL:
|
return QVariant();
|
||||||
case SMALLER:
|
switch(struc.type)
|
||||||
return QVariant();
|
{
|
||||||
break;
|
case EQUAL:
|
||||||
break;
|
case NOT_EQUAL:
|
||||||
case BETWEEN:
|
case SMALLER:
|
||||||
return struc.values.at(0);
|
return QVariant();
|
||||||
break;
|
break;
|
||||||
case BIGGER:
|
break;
|
||||||
return struc.values.at(0);
|
case BETWEEN:
|
||||||
break;
|
return struc.values.at(0);
|
||||||
default:
|
break;
|
||||||
return QVariant();
|
case BIGGER:
|
||||||
break;
|
return struc.values.at(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
void UAVObjectField::initialize(quint8* data, quint32 dataOffset, UAVObject* obj)
|
void UAVObjectField::initialize(quint8* data, quint32 dataOffset, UAVObject* obj)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ protected:
|
|||||||
quint32 offset;
|
quint32 offset;
|
||||||
quint8* data;
|
quint8* data;
|
||||||
UAVObject* obj;
|
UAVObject* obj;
|
||||||
QMap<quint32,LimitStruct> elementLimits;
|
QMap<quint32, QList<LimitStruct> > elementLimits;
|
||||||
void clear();
|
void clear();
|
||||||
void constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options, const QString &limits);
|
void constructorInitialize(const QString& name, const QString& units, FieldType type, const QStringList& elementNames, const QStringList& options, const QString &limits);
|
||||||
void limitsInitialize(const QString &limits);
|
void limitsInitialize(const QString &limits);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user