mirror of
https://github.com/thelsing/knx.git
synced 2025-01-30 00:19:01 +01:00
Group-Object Value Update: Return Indication for Success/Fail of Conversion to DPT
Remove _valueNoSend(..) as valueNoSend(..) is now the same
This commit is contained in:
parent
16e644cfa8
commit
1cb2d56de1
@ -224,13 +224,15 @@ GroupObjectUpdatedHandler GroupObject::callback()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GroupObject::value(const KNXValue& value, const Dpt& type)
|
bool GroupObject::value(const KNXValue& value, const Dpt& type)
|
||||||
{
|
{
|
||||||
if (_valueNoSend(value, type))
|
if (valueNoSend(value, type))
|
||||||
{
|
{
|
||||||
// write on successful conversion/setting value only
|
// write on successful conversion/setting value only
|
||||||
objectWritten();
|
objectWritten();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,9 +267,9 @@ bool GroupObject::tryValue(KNXValue& value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GroupObject::value(const KNXValue& value)
|
bool GroupObject::value(const KNXValue& value)
|
||||||
{
|
{
|
||||||
this->value(value, _datapointType);
|
return this->value(value, _datapointType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -277,19 +279,13 @@ KNXValue GroupObject::value()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GroupObject::valueNoSend(const KNXValue& value)
|
bool GroupObject::valueNoSend(const KNXValue& value)
|
||||||
{
|
{
|
||||||
valueNoSend(value, _datapointType);
|
return valueNoSend(value, _datapointType);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type)
|
bool GroupObject::valueNoSend(const KNXValue& value, const Dpt& type)
|
||||||
{
|
|
||||||
// ignore actual updating TODO check replacing valueNoSend with _valueNoSend
|
|
||||||
_valueNoSend(value, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GroupObject::_valueNoSend(const KNXValue& value, const Dpt& type)
|
|
||||||
{
|
{
|
||||||
const bool encodingDone = KNX_Encode_Value(value, _data, _dataLength, type);
|
const bool encodingDone = KNX_Encode_Value(value, _data, _dataLength, type);
|
||||||
|
|
||||||
@ -305,7 +301,7 @@ bool GroupObject::valueNoSendCompare(const KNXValue& value, const Dpt& type)
|
|||||||
if (_commFlagEx.uninitialized)
|
if (_commFlagEx.uninitialized)
|
||||||
{
|
{
|
||||||
// always set first value
|
// always set first value
|
||||||
return _valueNoSend(value, type);
|
return valueNoSend(value, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -171,8 +171,10 @@ class GroupObject
|
|||||||
* @param type the datapoint type used for the conversion.
|
* @param type the datapoint type used for the conversion.
|
||||||
*
|
*
|
||||||
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
||||||
|
*
|
||||||
|
* @returns true if the value was converted successfully to the datapoint type and the group object was updated.
|
||||||
*/
|
*/
|
||||||
void value(const KNXValue& value, const Dpt& type);
|
bool value(const KNXValue& value, const Dpt& type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the value (after conversion to dpt) will differ from current value of the group object and changes the state of the group object to ::WriteRequest if different.
|
* Check if the value (after conversion to dpt) will differ from current value of the group object and changes the state of the group object to ::WriteRequest if different.
|
||||||
@ -182,18 +184,20 @@ class GroupObject
|
|||||||
*
|
*
|
||||||
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
||||||
*
|
*
|
||||||
* @returns true if the value of the group object has changed
|
* @returns true if the value of the group object has changed, false if conversion results in same value as stored in group object or failed.
|
||||||
*/
|
*/
|
||||||
bool valueCompare(const KNXValue& value, const Dpt& type);
|
bool valueCompare(const KNXValue& value, const Dpt& type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the current value of the group object.
|
* set the current value of the group object and show success.
|
||||||
* @param value the value the group object is set to
|
* @param value the value the group object is set to
|
||||||
* @param type the datapoint type used for the conversion.
|
* @param type the datapoint type used for the conversion.
|
||||||
*
|
*
|
||||||
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
||||||
|
*
|
||||||
|
* @returns true if value was converted successfully to the datapoint type and the group object was updated.
|
||||||
*/
|
*/
|
||||||
void valueNoSend(const KNXValue& value, const Dpt& type);
|
bool valueNoSend(const KNXValue& value, const Dpt& type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the value (after conversion to dpt) will differ from current value of the group object and update if necessary.
|
* Check if the value (after conversion to dpt) will differ from current value of the group object and update if necessary.
|
||||||
@ -203,7 +207,7 @@ class GroupObject
|
|||||||
*
|
*
|
||||||
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
||||||
*
|
*
|
||||||
* @returns true if the value of the group object has changed
|
* @returns true if the value of the group object has changed, false if conversion results in same value as stored in group object or failed.
|
||||||
*/
|
*/
|
||||||
bool valueNoSendCompare(const KNXValue& value, const Dpt& type);
|
bool valueNoSendCompare(const KNXValue& value, const Dpt& type);
|
||||||
|
|
||||||
@ -229,15 +233,19 @@ class GroupObject
|
|||||||
* @param value the value the group object is set to
|
* @param value the value the group object is set to
|
||||||
*
|
*
|
||||||
* The parameters must fit the group object and dhe datapoint type must be set with dataPointType(). Otherwise it will stay unchanged.
|
* The parameters must fit the group object and dhe datapoint type must be set with dataPointType(). Otherwise it will stay unchanged.
|
||||||
|
*
|
||||||
|
* @returns true if the value was converted successfully to the datapoint type and the group object was updated.
|
||||||
*/
|
*/
|
||||||
void value(const KNXValue& value);
|
bool value(const KNXValue& value);
|
||||||
/**
|
/**
|
||||||
* set the current value of the group object.
|
* set the current value of the group object.
|
||||||
* @param value the value the group object is set to
|
* @param value the value the group object is set to
|
||||||
*
|
*
|
||||||
* The parameters must fit the group object and dhe datapoint type must be set with dataPointType(). Otherwise it will stay unchanged.
|
* The parameters must fit the group object and the datapoint type must be set with dataPointType(). Otherwise it will stay unchanged.
|
||||||
|
*
|
||||||
|
* @returns true if the value was converted successfully to the datapoint type and the group object was updated.
|
||||||
*/
|
*/
|
||||||
void valueNoSend(const KNXValue& value);
|
bool valueNoSend(const KNXValue& value);
|
||||||
/**
|
/**
|
||||||
* set the current value of the group object.
|
* set the current value of the group object.
|
||||||
* @param value the value the group object is set to
|
* @param value the value the group object is set to
|
||||||
@ -284,15 +292,4 @@ class GroupObject
|
|||||||
GroupObjectUpdatedHandler _updateHandler;
|
GroupObjectUpdatedHandler _updateHandler;
|
||||||
Dpt _datapointType;
|
Dpt _datapointType;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* set the current value of the group object and show success.
|
|
||||||
* @param value the value the group object is set to
|
|
||||||
* @param type the datapoint type used for the conversion.
|
|
||||||
*
|
|
||||||
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
|
||||||
*
|
|
||||||
* @returns true if the value of the group object was updated after successful conversion.
|
|
||||||
*/
|
|
||||||
bool _valueNoSend(const KNXValue& value, const Dpt& type);
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user