mirror of
https://github.com/thelsing/knx.git
synced 2025-10-12 11:15:54 +02:00
Allow Updating ComObject with Sending On Modification Only
This commit is contained in:
parent
4c16a38803
commit
1eb4a797a5
@ -279,3 +279,18 @@ void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type)
|
|||||||
|
|
||||||
KNX_Encode_Value(value, _data, _dataLength, type);
|
KNX_Encode_Value(value, _data, _dataLength, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupObject::valueSendChangedOnly(const KNXValue& value, const Dpt& type)
|
||||||
|
{
|
||||||
|
// save current value
|
||||||
|
const uint8_t oldLength = _dataLength;
|
||||||
|
uint8_t* old = new uint8_t[_dataLength];
|
||||||
|
memcpy(old, _data, oldLength);
|
||||||
|
|
||||||
|
// update value in com-object, without sending to bus
|
||||||
|
valueNoSend(value, type);
|
||||||
|
|
||||||
|
// only when raw data differs trigger sending
|
||||||
|
if (oldLength!=_dataLength || memcmp(old, _data, oldLength)!=0)
|
||||||
|
objectWritten();
|
||||||
|
}
|
@ -166,6 +166,16 @@ 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.
|
||||||
*/
|
*/
|
||||||
void valueNoSend(const KNXValue& value, const Dpt& type);
|
void valueNoSend(const KNXValue& value, const Dpt& type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the current value of the group object and only when resulting value differes, changes the state of the group object to ::WriteRequest.
|
||||||
|
* @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.
|
||||||
|
*/
|
||||||
|
void valueSendChangedOnly(const KNXValue& value, const Dpt& type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
Loading…
Reference in New Issue
Block a user