From 3b72f69a6a476794955a604675893d9e0fc1f19d Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 08:53:46 +0200 Subject: [PATCH 1/8] Use Property::appendAttributeReal Property::setAttributeReal instead of macros --- src/property/types/CloudBool.h | 4 ++-- src/property/types/CloudColor.h | 12 +++++----- src/property/types/CloudFloat.h | 4 ++-- src/property/types/CloudInt.h | 4 ++-- src/property/types/CloudLocation.h | 8 +++---- src/property/types/CloudSchedule.h | 16 ++++++------- src/property/types/CloudString.h | 4 ++-- src/property/types/CloudUnsignedInt.h | 4 ++-- src/property/types/CloudWrapperBool.h | 4 ++-- src/property/types/CloudWrapperFloat.h | 4 ++-- src/property/types/CloudWrapperInt.h | 4 ++-- src/property/types/CloudWrapperString.h | 4 ++-- src/property/types/CloudWrapperUnsignedInt.h | 4 ++-- .../types/automation/CloudColoredLight.h | 16 ++++++------- .../types/automation/CloudDimmedLight.h | 8 +++---- .../types/automation/CloudTelevision.h | 24 +++++++++---------- 16 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/property/types/CloudBool.h b/src/property/types/CloudBool.h index e0b9f1f30..495729d14 100644 --- a/src/property/types/CloudBool.h +++ b/src/property/types/CloudBool.h @@ -53,10 +53,10 @@ class CloudBool : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_value); + return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } //modifiers CloudBool& operator=(bool v) { diff --git a/src/property/types/CloudColor.h b/src/property/types/CloudColor.h index 294a2bb8d..0e2acaa0d 100644 --- a/src/property/types/CloudColor.h +++ b/src/property/types/CloudColor.h @@ -189,15 +189,15 @@ class CloudColor : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - CHECK_CBOR_MULTI(appendAttribute(_value.hue)); - CHECK_CBOR_MULTI(appendAttribute(_value.sat)); - CHECK_CBOR_MULTI(appendAttribute(_value.bri)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value.hue); - setAttribute(_cloud_value.sat); - setAttribute(_cloud_value.bri); + setAttributeReal(_cloud_value.hue, "hue"); + setAttributeReal(_cloud_value.sat, "sat"); + setAttributeReal(_cloud_value.bri, "bri"); } }; diff --git a/src/property/types/CloudFloat.h b/src/property/types/CloudFloat.h index b68fe70fe..69e601d6a 100644 --- a/src/property/types/CloudFloat.h +++ b/src/property/types/CloudFloat.h @@ -55,10 +55,10 @@ class CloudFloat : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_value); + return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } //modifiers CloudFloat& operator=(float v) { diff --git a/src/property/types/CloudInt.h b/src/property/types/CloudInt.h index 0ce65777a..1d3a15039 100644 --- a/src/property/types/CloudInt.h +++ b/src/property/types/CloudInt.h @@ -53,10 +53,10 @@ class CloudInt : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_value); + return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } //modifiers CloudInt& operator=(int v) { diff --git a/src/property/types/CloudLocation.h b/src/property/types/CloudLocation.h index 25636cd97..16607be6b 100644 --- a/src/property/types/CloudLocation.h +++ b/src/property/types/CloudLocation.h @@ -90,13 +90,13 @@ class CloudLocation : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - CHECK_CBOR_MULTI(appendAttribute(_value.lat)); - CHECK_CBOR_MULTI(appendAttribute(_value.lon)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.lat, "lat", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.lon, "lon", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value.lat); - setAttribute(_cloud_value.lon); + setAttributeReal(_cloud_value.lat, "lat"); + setAttributeReal(_cloud_value.lon, "lon"); } }; diff --git a/src/property/types/CloudSchedule.h b/src/property/types/CloudSchedule.h index 47827c59c..f7018a94d 100644 --- a/src/property/types/CloudSchedule.h +++ b/src/property/types/CloudSchedule.h @@ -418,17 +418,17 @@ class CloudSchedule : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - CHECK_CBOR_MULTI(appendAttribute(_value.frm)); - CHECK_CBOR_MULTI(appendAttribute(_value.to)); - CHECK_CBOR_MULTI(appendAttribute(_value.len)); - CHECK_CBOR_MULTI(appendAttribute(_value.msk)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.frm, "frm", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.to, "to", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.len, "len", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.msk, "msk", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value.frm); - setAttribute(_cloud_value.to); - setAttribute(_cloud_value.len); - setAttribute(_cloud_value.msk); + setAttributeReal(_cloud_value.frm, "frm"); + setAttributeReal(_cloud_value.to, "to"); + setAttributeReal(_cloud_value.len, "len"); + setAttributeReal(_cloud_value.msk, "msk"); } }; diff --git a/src/property/types/CloudString.h b/src/property/types/CloudString.h index f07f59ccf..18d3c6d76 100644 --- a/src/property/types/CloudString.h +++ b/src/property/types/CloudString.h @@ -59,10 +59,10 @@ class CloudString : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_value); + return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } //modifiers CloudString& operator=(String v) { diff --git a/src/property/types/CloudUnsignedInt.h b/src/property/types/CloudUnsignedInt.h index 37ec2d1cb..3aa08418c 100644 --- a/src/property/types/CloudUnsignedInt.h +++ b/src/property/types/CloudUnsignedInt.h @@ -53,10 +53,10 @@ class CloudUnsignedInt : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_value); + return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } //modifiers CloudUnsignedInt& operator=(unsigned int v) { diff --git a/src/property/types/CloudWrapperBool.h b/src/property/types/CloudWrapperBool.h index 701e7c87d..5990ac8e8 100644 --- a/src/property/types/CloudWrapperBool.h +++ b/src/property/types/CloudWrapperBool.h @@ -46,10 +46,10 @@ class CloudWrapperBool : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_primitive_value); + return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperFloat.h b/src/property/types/CloudWrapperFloat.h index db0f640cf..d477c4ed5 100644 --- a/src/property/types/CloudWrapperFloat.h +++ b/src/property/types/CloudWrapperFloat.h @@ -48,10 +48,10 @@ class CloudWrapperFloat : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_primitive_value); + return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperInt.h b/src/property/types/CloudWrapperInt.h index 261c72d46..a1984767d 100644 --- a/src/property/types/CloudWrapperInt.h +++ b/src/property/types/CloudWrapperInt.h @@ -46,10 +46,10 @@ class CloudWrapperInt : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_primitive_value); + return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperString.h b/src/property/types/CloudWrapperString.h index 3e1c0a3e3..eefd3ed0f 100644 --- a/src/property/types/CloudWrapperString.h +++ b/src/property/types/CloudWrapperString.h @@ -50,10 +50,10 @@ class CloudWrapperString : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_primitive_value); + return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperUnsignedInt.h b/src/property/types/CloudWrapperUnsignedInt.h index d722f585f..d14f0d18c 100644 --- a/src/property/types/CloudWrapperUnsignedInt.h +++ b/src/property/types/CloudWrapperUnsignedInt.h @@ -46,10 +46,10 @@ class CloudWrapperUnsignedInt : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud() { - return appendAttribute(_primitive_value); + return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value); + setAttributeReal(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/automation/CloudColoredLight.h b/src/property/types/automation/CloudColoredLight.h index f38b8354a..9a61f13f3 100644 --- a/src/property/types/automation/CloudColoredLight.h +++ b/src/property/types/automation/CloudColoredLight.h @@ -119,17 +119,17 @@ class CloudColoredLight : public CloudColor { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - CHECK_CBOR_MULTI(appendAttribute(_value.swi)); - CHECK_CBOR_MULTI(appendAttribute(_value.hue)); - CHECK_CBOR_MULTI(appendAttribute(_value.sat)); - CHECK_CBOR_MULTI(appendAttribute(_value.bri)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value.swi); - setAttribute(_cloud_value.hue); - setAttribute(_cloud_value.sat); - setAttribute(_cloud_value.bri); + setAttributeReal(_cloud_value.swi, "swi"); + setAttributeReal(_cloud_value.hue, "hue"); + setAttributeReal(_cloud_value.sat, "sat"); + setAttributeReal(_cloud_value.bri, "bri"); } }; diff --git a/src/property/types/automation/CloudDimmedLight.h b/src/property/types/automation/CloudDimmedLight.h index e14da0f75..650646f4e 100644 --- a/src/property/types/automation/CloudDimmedLight.h +++ b/src/property/types/automation/CloudDimmedLight.h @@ -99,14 +99,14 @@ class CloudDimmedLight : public Property { } virtual CborError appendAttributesToCloud() { - CHECK_CBOR_MULTI(appendAttribute(_value.swi)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); // To allow visualization through color widget // Start float hue = 0; float sat = 0; CHECK_CBOR_MULTI(appendAttributeReal(hue, getAttributeName(".hue", '.'), encoder)); CHECK_CBOR_MULTI(appendAttributeReal(sat, getAttributeName(".sat", '.'), encoder)); - CHECK_CBOR_MULTI(appendAttribute(_value.bri)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); // should be only: // appendAttribute(_value.bri); // end @@ -114,8 +114,8 @@ class CloudDimmedLight : public Property { } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value.swi); - setAttribute(_cloud_value.bri); + setAttributeReal(_cloud_value.swi, "swi"); + setAttributeReal(_cloud_value.bri, "bri"); } }; diff --git a/src/property/types/automation/CloudTelevision.h b/src/property/types/automation/CloudTelevision.h index 921f1ea56..914a4b07c 100644 --- a/src/property/types/automation/CloudTelevision.h +++ b/src/property/types/automation/CloudTelevision.h @@ -214,21 +214,21 @@ class CloudTelevision : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud() { - CHECK_CBOR_MULTI(appendAttribute(_value.swi)); - CHECK_CBOR_MULTI(appendAttribute(_value.vol)); - CHECK_CBOR_MULTI(appendAttribute(_value.mut)); - CHECK_CBOR_MULTI(appendAttribute((int)_value.pbc)); - CHECK_CBOR_MULTI(appendAttribute((int)_value.inp)); - CHECK_CBOR_MULTI(appendAttribute(_value.cha)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.vol, "vol", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.mut, "mut", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal((int)_value.pbc, "pbc", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal((int)_value.inp, "inp", encoder)); + CHECK_CBOR_MULTI(appendAttributeReal(_value.cha, "cha", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { - setAttribute(_cloud_value.swi); - setAttribute(_cloud_value.vol); - setAttribute(_cloud_value.mut); - setAttribute((int&)_cloud_value.pbc); - setAttribute((int&)_cloud_value.inp); - setAttribute(_cloud_value.cha); + setAttributeReal(_cloud_value.swi, "swi"); + setAttributeReal(_cloud_value.vol, "vol"); + setAttributeReal(_cloud_value.mut, "mut"); + setAttributeReal((int&)_cloud_value.pbc, "pbc"); + setAttributeReal((int&)_cloud_value.inp, "inp"); + setAttributeReal(_cloud_value.cha, "cha"); } }; From 753245a5bd25df7439e4ea9e935a40a70609c210 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 08:56:04 +0200 Subject: [PATCH 2/8] Remove setAttribute and appendAttribute --- src/property/Property.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/property/Property.h b/src/property/Property.h index 6571bf625..6d14ec0e6 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -48,8 +48,6 @@ ******************************************************************************/ #define appendAttributesToCloud() appendAttributesToCloudReal(CborEncoder *encoder) -#define appendAttribute(x) appendAttributeReal(x, getAttributeName(#x, '.'), encoder) -#define setAttribute(x) setAttributeReal(x, getAttributeName(#x, '.')) /****************************************************************************** CONST From 5dd3ee280cc7238ab0c96cc3d5bb4d50874835c7 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 09:13:06 +0200 Subject: [PATCH 3/8] Use Property::appendAttributesToCloudReal(...) instead of appendAttributesToCloud() macro --- src/property/types/CloudBool.h | 2 +- src/property/types/CloudColor.h | 2 +- src/property/types/CloudFloat.h | 2 +- src/property/types/CloudInt.h | 2 +- src/property/types/CloudLocation.h | 2 +- src/property/types/CloudSchedule.h | 2 +- src/property/types/CloudString.h | 2 +- src/property/types/CloudUnsignedInt.h | 2 +- src/property/types/CloudWrapperBool.h | 2 +- src/property/types/CloudWrapperFloat.h | 2 +- src/property/types/CloudWrapperInt.h | 2 +- src/property/types/CloudWrapperString.h | 2 +- src/property/types/CloudWrapperUnsignedInt.h | 2 +- src/property/types/automation/CloudColoredLight.h | 2 +- src/property/types/automation/CloudDimmedLight.h | 2 +- src/property/types/automation/CloudTelevision.h | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/property/types/CloudBool.h b/src/property/types/CloudBool.h index 495729d14..6c50b80a0 100644 --- a/src/property/types/CloudBool.h +++ b/src/property/types/CloudBool.h @@ -52,7 +52,7 @@ class CloudBool : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudColor.h b/src/property/types/CloudColor.h index 0e2acaa0d..a7ee0311d 100644 --- a/src/property/types/CloudColor.h +++ b/src/property/types/CloudColor.h @@ -188,7 +188,7 @@ class CloudColor : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); diff --git a/src/property/types/CloudFloat.h b/src/property/types/CloudFloat.h index 69e601d6a..86bb0ead8 100644 --- a/src/property/types/CloudFloat.h +++ b/src/property/types/CloudFloat.h @@ -54,7 +54,7 @@ class CloudFloat : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudInt.h b/src/property/types/CloudInt.h index 1d3a15039..722dd2ab9 100644 --- a/src/property/types/CloudInt.h +++ b/src/property/types/CloudInt.h @@ -52,7 +52,7 @@ class CloudInt : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudLocation.h b/src/property/types/CloudLocation.h index 16607be6b..f660da682 100644 --- a/src/property/types/CloudLocation.h +++ b/src/property/types/CloudLocation.h @@ -89,7 +89,7 @@ class CloudLocation : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.lat, "lat", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.lon, "lon", encoder)); return CborNoError; diff --git a/src/property/types/CloudSchedule.h b/src/property/types/CloudSchedule.h index f7018a94d..e74d3a179 100644 --- a/src/property/types/CloudSchedule.h +++ b/src/property/types/CloudSchedule.h @@ -417,7 +417,7 @@ class CloudSchedule : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.frm, "frm", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.to, "to", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.len, "len", encoder)); diff --git a/src/property/types/CloudString.h b/src/property/types/CloudString.h index 18d3c6d76..46c64642d 100644 --- a/src/property/types/CloudString.h +++ b/src/property/types/CloudString.h @@ -58,7 +58,7 @@ class CloudString : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudUnsignedInt.h b/src/property/types/CloudUnsignedInt.h index 3aa08418c..0245d0a58 100644 --- a/src/property/types/CloudUnsignedInt.h +++ b/src/property/types/CloudUnsignedInt.h @@ -52,7 +52,7 @@ class CloudUnsignedInt : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperBool.h b/src/property/types/CloudWrapperBool.h index 5990ac8e8..0ad79fe1e 100644 --- a/src/property/types/CloudWrapperBool.h +++ b/src/property/types/CloudWrapperBool.h @@ -45,7 +45,7 @@ class CloudWrapperBool : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperFloat.h b/src/property/types/CloudWrapperFloat.h index d477c4ed5..5496c4de0 100644 --- a/src/property/types/CloudWrapperFloat.h +++ b/src/property/types/CloudWrapperFloat.h @@ -47,7 +47,7 @@ class CloudWrapperFloat : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperInt.h b/src/property/types/CloudWrapperInt.h index a1984767d..f2ddaa219 100644 --- a/src/property/types/CloudWrapperInt.h +++ b/src/property/types/CloudWrapperInt.h @@ -45,7 +45,7 @@ class CloudWrapperInt : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperString.h b/src/property/types/CloudWrapperString.h index eefd3ed0f..f52b59859 100644 --- a/src/property/types/CloudWrapperString.h +++ b/src/property/types/CloudWrapperString.h @@ -49,7 +49,7 @@ class CloudWrapperString : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperUnsignedInt.h b/src/property/types/CloudWrapperUnsignedInt.h index d14f0d18c..3834d3eb3 100644 --- a/src/property/types/CloudWrapperUnsignedInt.h +++ b/src/property/types/CloudWrapperUnsignedInt.h @@ -45,7 +45,7 @@ class CloudWrapperUnsignedInt : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/automation/CloudColoredLight.h b/src/property/types/automation/CloudColoredLight.h index 9a61f13f3..44ac2bdd1 100644 --- a/src/property/types/automation/CloudColoredLight.h +++ b/src/property/types/automation/CloudColoredLight.h @@ -118,7 +118,7 @@ class CloudColoredLight : public CloudColor { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); diff --git a/src/property/types/automation/CloudDimmedLight.h b/src/property/types/automation/CloudDimmedLight.h index 650646f4e..cfb11f12a 100644 --- a/src/property/types/automation/CloudDimmedLight.h +++ b/src/property/types/automation/CloudDimmedLight.h @@ -98,7 +98,7 @@ class CloudDimmedLight : public Property { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); // To allow visualization through color widget // Start diff --git a/src/property/types/automation/CloudTelevision.h b/src/property/types/automation/CloudTelevision.h index 914a4b07c..c71d127b8 100644 --- a/src/property/types/automation/CloudTelevision.h +++ b/src/property/types/automation/CloudTelevision.h @@ -213,7 +213,7 @@ class CloudTelevision : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloud() { + virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.vol, "vol", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.mut, "mut", encoder)); From 6b44c92fa8f71df6fd65021799dbdb3cfdfb1bc9 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 09:15:19 +0200 Subject: [PATCH 4/8] Remove appendAttributesToCloud() macro --- src/property/Property.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/property/Property.h b/src/property/Property.h index 6d14ec0e6..16ce5a764 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -43,12 +43,6 @@ #include "../cbor/lib/tinycbor/cbor-lib.h" -/****************************************************************************** - DEFINE - ******************************************************************************/ - -#define appendAttributesToCloud() appendAttributesToCloudReal(CborEncoder *encoder) - /****************************************************************************** CONST ******************************************************************************/ From b5f3a19b5b3d76f51c96de474c1900dd75996df4 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 09:18:36 +0200 Subject: [PATCH 5/8] Remove Property::getAttributeName(...) --- src/property/Property.cpp | 7 ------- src/property/Property.h | 1 - src/property/types/automation/CloudDimmedLight.h | 4 ++-- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/property/Property.cpp b/src/property/Property.cpp index c6c3db9e4..6c65ab869 100644 --- a/src/property/Property.cpp +++ b/src/property/Property.cpp @@ -354,13 +354,6 @@ void Property::setAttributeReal(String attributeName, std::function Date: Fri, 21 Oct 2022 09:20:53 +0200 Subject: [PATCH 6/8] Rename appendAttributesToCloudReal to appendAttributesToCloud --- src/property/Property.cpp | 2 +- src/property/Property.h | 2 +- src/property/types/CloudBool.h | 2 +- src/property/types/CloudColor.h | 2 +- src/property/types/CloudFloat.h | 2 +- src/property/types/CloudInt.h | 2 +- src/property/types/CloudLocation.h | 2 +- src/property/types/CloudSchedule.h | 2 +- src/property/types/CloudString.h | 2 +- src/property/types/CloudUnsignedInt.h | 2 +- src/property/types/CloudWrapperBool.h | 2 +- src/property/types/CloudWrapperFloat.h | 2 +- src/property/types/CloudWrapperInt.h | 2 +- src/property/types/CloudWrapperString.h | 2 +- src/property/types/CloudWrapperUnsignedInt.h | 2 +- src/property/types/automation/CloudColoredLight.h | 2 +- src/property/types/automation/CloudDimmedLight.h | 2 +- src/property/types/automation/CloudTelevision.h | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/property/Property.cpp b/src/property/Property.cpp index 6c65ab869..98472b372 100644 --- a/src/property/Property.cpp +++ b/src/property/Property.cpp @@ -170,7 +170,7 @@ void Property::execCallbackOnSync() { CborError Property::append(CborEncoder *encoder, bool lightPayload) { _lightPayload = lightPayload; _attributeIdentifier = 0; - CHECK_CBOR(appendAttributesToCloudReal(encoder)); + CHECK_CBOR(appendAttributesToCloud(encoder)); fromLocalToCloud(); _has_been_updated_once = true; _has_been_modified_in_callback = false; diff --git a/src/property/Property.h b/src/property/Property.h index 685d9d840..950b5bb55 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -208,7 +208,7 @@ class Property virtual bool isDifferentFromCloud() = 0; virtual void fromCloudToLocal() = 0; virtual void fromLocalToCloud() = 0; - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) = 0; + virtual CborError appendAttributesToCloud(CborEncoder *encoder) = 0; virtual void setAttributesFromCloud() = 0; virtual bool isPrimitive() { return false; diff --git a/src/property/types/CloudBool.h b/src/property/types/CloudBool.h index 6c50b80a0..654683b8f 100644 --- a/src/property/types/CloudBool.h +++ b/src/property/types/CloudBool.h @@ -52,7 +52,7 @@ class CloudBool : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudColor.h b/src/property/types/CloudColor.h index a7ee0311d..d09022453 100644 --- a/src/property/types/CloudColor.h +++ b/src/property/types/CloudColor.h @@ -188,7 +188,7 @@ class CloudColor : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); diff --git a/src/property/types/CloudFloat.h b/src/property/types/CloudFloat.h index 86bb0ead8..01e006b63 100644 --- a/src/property/types/CloudFloat.h +++ b/src/property/types/CloudFloat.h @@ -54,7 +54,7 @@ class CloudFloat : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudInt.h b/src/property/types/CloudInt.h index 722dd2ab9..7f1cd8006 100644 --- a/src/property/types/CloudInt.h +++ b/src/property/types/CloudInt.h @@ -52,7 +52,7 @@ class CloudInt : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudLocation.h b/src/property/types/CloudLocation.h index f660da682..50caa9275 100644 --- a/src/property/types/CloudLocation.h +++ b/src/property/types/CloudLocation.h @@ -89,7 +89,7 @@ class CloudLocation : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.lat, "lat", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.lon, "lon", encoder)); return CborNoError; diff --git a/src/property/types/CloudSchedule.h b/src/property/types/CloudSchedule.h index e74d3a179..95e26b584 100644 --- a/src/property/types/CloudSchedule.h +++ b/src/property/types/CloudSchedule.h @@ -417,7 +417,7 @@ class CloudSchedule : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.frm, "frm", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.to, "to", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.len, "len", encoder)); diff --git a/src/property/types/CloudString.h b/src/property/types/CloudString.h index 46c64642d..70cefb3d2 100644 --- a/src/property/types/CloudString.h +++ b/src/property/types/CloudString.h @@ -58,7 +58,7 @@ class CloudString : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudUnsignedInt.h b/src/property/types/CloudUnsignedInt.h index 0245d0a58..b7c20078a 100644 --- a/src/property/types/CloudUnsignedInt.h +++ b/src/property/types/CloudUnsignedInt.h @@ -52,7 +52,7 @@ class CloudUnsignedInt : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperBool.h b/src/property/types/CloudWrapperBool.h index 0ad79fe1e..f60f374e8 100644 --- a/src/property/types/CloudWrapperBool.h +++ b/src/property/types/CloudWrapperBool.h @@ -45,7 +45,7 @@ class CloudWrapperBool : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperFloat.h b/src/property/types/CloudWrapperFloat.h index 5496c4de0..a888fdb1e 100644 --- a/src/property/types/CloudWrapperFloat.h +++ b/src/property/types/CloudWrapperFloat.h @@ -47,7 +47,7 @@ class CloudWrapperFloat : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperInt.h b/src/property/types/CloudWrapperInt.h index f2ddaa219..e151cfa16 100644 --- a/src/property/types/CloudWrapperInt.h +++ b/src/property/types/CloudWrapperInt.h @@ -45,7 +45,7 @@ class CloudWrapperInt : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperString.h b/src/property/types/CloudWrapperString.h index f52b59859..b7b125236 100644 --- a/src/property/types/CloudWrapperString.h +++ b/src/property/types/CloudWrapperString.h @@ -49,7 +49,7 @@ class CloudWrapperString : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudWrapperUnsignedInt.h b/src/property/types/CloudWrapperUnsignedInt.h index 3834d3eb3..50d7f6b1f 100644 --- a/src/property/types/CloudWrapperUnsignedInt.h +++ b/src/property/types/CloudWrapperUnsignedInt.h @@ -45,7 +45,7 @@ class CloudWrapperUnsignedInt : public CloudWrapperBase { virtual void fromLocalToCloud() { _cloud_value = _primitive_value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { return appendAttributeReal(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { diff --git a/src/property/types/automation/CloudColoredLight.h b/src/property/types/automation/CloudColoredLight.h index 44ac2bdd1..8f24f1e94 100644 --- a/src/property/types/automation/CloudColoredLight.h +++ b/src/property/types/automation/CloudColoredLight.h @@ -118,7 +118,7 @@ class CloudColoredLight : public CloudColor { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); diff --git a/src/property/types/automation/CloudDimmedLight.h b/src/property/types/automation/CloudDimmedLight.h index b0f88793e..6cfec0596 100644 --- a/src/property/types/automation/CloudDimmedLight.h +++ b/src/property/types/automation/CloudDimmedLight.h @@ -98,7 +98,7 @@ class CloudDimmedLight : public Property { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); // To allow visualization through color widget // Start diff --git a/src/property/types/automation/CloudTelevision.h b/src/property/types/automation/CloudTelevision.h index c71d127b8..c1eec054d 100644 --- a/src/property/types/automation/CloudTelevision.h +++ b/src/property/types/automation/CloudTelevision.h @@ -213,7 +213,7 @@ class CloudTelevision : public Property { virtual void fromLocalToCloud() { _cloud_value = _value; } - virtual CborError appendAttributesToCloudReal(CborEncoder *encoder) { + virtual CborError appendAttributesToCloud(CborEncoder *encoder) { CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.vol, "vol", encoder)); CHECK_CBOR_MULTI(appendAttributeReal(_value.mut, "mut", encoder)); From de7e25c939b4f1a3bb2608e570116e95c9ec3ee5 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 09:22:39 +0200 Subject: [PATCH 7/8] Rename appendAttributeReal to appendAttribute --- src/property/Property.cpp | 10 +++++----- src/property/Property.h | 10 +++++----- src/property/types/CloudBool.h | 2 +- src/property/types/CloudColor.h | 6 +++--- src/property/types/CloudFloat.h | 2 +- src/property/types/CloudInt.h | 2 +- src/property/types/CloudLocation.h | 4 ++-- src/property/types/CloudSchedule.h | 8 ++++---- src/property/types/CloudString.h | 2 +- src/property/types/CloudUnsignedInt.h | 2 +- src/property/types/CloudWrapperBool.h | 2 +- src/property/types/CloudWrapperFloat.h | 2 +- src/property/types/CloudWrapperInt.h | 2 +- src/property/types/CloudWrapperString.h | 2 +- src/property/types/CloudWrapperUnsignedInt.h | 2 +- src/property/types/automation/CloudColoredLight.h | 8 ++++---- src/property/types/automation/CloudDimmedLight.h | 8 ++++---- src/property/types/automation/CloudTelevision.h | 12 ++++++------ 18 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/property/Property.cpp b/src/property/Property.cpp index 98472b372..f395ea2b3 100644 --- a/src/property/Property.cpp +++ b/src/property/Property.cpp @@ -181,7 +181,7 @@ CborError Property::append(CborEncoder *encoder, bool lightPayload) { return CborNoError; } -CborError Property::appendAttributeReal(bool value, String attributeName, CborEncoder *encoder) { +CborError Property::appendAttribute(bool value, String attributeName, CborEncoder *encoder) { return appendAttributeName(attributeName, [value](CborEncoder & mapEncoder) { CHECK_CBOR(cbor_encode_int(&mapEncoder, static_cast(CborIntegerMapKey::BooleanValue))); @@ -190,7 +190,7 @@ CborError Property::appendAttributeReal(bool value, String attributeName, CborEn }, encoder); } -CborError Property::appendAttributeReal(int value, String attributeName, CborEncoder *encoder) { +CborError Property::appendAttribute(int value, String attributeName, CborEncoder *encoder) { return appendAttributeName(attributeName, [value](CborEncoder & mapEncoder) { CHECK_CBOR(cbor_encode_int(&mapEncoder, static_cast(CborIntegerMapKey::Value))); @@ -199,7 +199,7 @@ CborError Property::appendAttributeReal(int value, String attributeName, CborEnc }, encoder); } -CborError Property::appendAttributeReal(unsigned int value, String attributeName, CborEncoder *encoder) { +CborError Property::appendAttribute(unsigned int value, String attributeName, CborEncoder *encoder) { return appendAttributeName(attributeName, [value](CborEncoder & mapEncoder) { CHECK_CBOR(cbor_encode_int(&mapEncoder, static_cast(CborIntegerMapKey::Value))); @@ -208,7 +208,7 @@ CborError Property::appendAttributeReal(unsigned int value, String attributeName }, encoder); } -CborError Property::appendAttributeReal(float value, String attributeName, CborEncoder *encoder) { +CborError Property::appendAttribute(float value, String attributeName, CborEncoder *encoder) { return appendAttributeName(attributeName, [value](CborEncoder & mapEncoder) { CHECK_CBOR(cbor_encode_int(&mapEncoder, static_cast(CborIntegerMapKey::Value))); @@ -217,7 +217,7 @@ CborError Property::appendAttributeReal(float value, String attributeName, CborE }, encoder); } -CborError Property::appendAttributeReal(String value, String attributeName, CborEncoder *encoder) { +CborError Property::appendAttribute(String value, String attributeName, CborEncoder *encoder) { return appendAttributeName(attributeName, [value](CborEncoder & mapEncoder) { CHECK_CBOR(cbor_encode_int(&mapEncoder, static_cast(CborIntegerMapKey::StringValue))); diff --git a/src/property/Property.h b/src/property/Property.h index 950b5bb55..180bb04e7 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -186,11 +186,11 @@ class Property void updateLocalTimestamp(); CborError append(CborEncoder * encoder, bool lightPayload); - CborError appendAttributeReal(bool value, String attributeName = "", CborEncoder *encoder = nullptr); - CborError appendAttributeReal(int value, String attributeName = "", CborEncoder *encoder = nullptr); - CborError appendAttributeReal(unsigned int value, String attributeName = "", CborEncoder *encoder = nullptr); - CborError appendAttributeReal(float value, String attributeName = "", CborEncoder *encoder = nullptr); - CborError appendAttributeReal(String value, String attributeName = "", CborEncoder *encoder = nullptr); + CborError appendAttribute(bool value, String attributeName = "", CborEncoder *encoder = nullptr); + CborError appendAttribute(int value, String attributeName = "", CborEncoder *encoder = nullptr); + CborError appendAttribute(unsigned int value, String attributeName = "", CborEncoder *encoder = nullptr); + CborError appendAttribute(float value, String attributeName = "", CborEncoder *encoder = nullptr); + CborError appendAttribute(String value, String attributeName = "", CborEncoder *encoder = nullptr); #ifndef __AVR__ CborError appendAttributeName(String attributeName, std::functionf, CborEncoder *encoder); void setAttributeReal(String attributeName, std::functionsetValue); diff --git a/src/property/types/CloudBool.h b/src/property/types/CloudBool.h index 654683b8f..1cb4bea6e 100644 --- a/src/property/types/CloudBool.h +++ b/src/property/types/CloudBool.h @@ -53,7 +53,7 @@ class CloudBool : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_value, "", encoder); + return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudColor.h b/src/property/types/CloudColor.h index d09022453..27d581c40 100644 --- a/src/property/types/CloudColor.h +++ b/src/property/types/CloudColor.h @@ -189,9 +189,9 @@ class CloudColor : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.hue, "hue", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.sat, "sat", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.bri, "bri", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudFloat.h b/src/property/types/CloudFloat.h index 01e006b63..02032d3cb 100644 --- a/src/property/types/CloudFloat.h +++ b/src/property/types/CloudFloat.h @@ -55,7 +55,7 @@ class CloudFloat : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_value, "", encoder); + return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudInt.h b/src/property/types/CloudInt.h index 7f1cd8006..81dbf6c24 100644 --- a/src/property/types/CloudInt.h +++ b/src/property/types/CloudInt.h @@ -53,7 +53,7 @@ class CloudInt : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_value, "", encoder); + return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudLocation.h b/src/property/types/CloudLocation.h index 50caa9275..e5fae7e67 100644 --- a/src/property/types/CloudLocation.h +++ b/src/property/types/CloudLocation.h @@ -90,8 +90,8 @@ class CloudLocation : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - CHECK_CBOR_MULTI(appendAttributeReal(_value.lat, "lat", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.lon, "lon", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.lat, "lat", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.lon, "lon", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudSchedule.h b/src/property/types/CloudSchedule.h index 95e26b584..d5b9261ca 100644 --- a/src/property/types/CloudSchedule.h +++ b/src/property/types/CloudSchedule.h @@ -418,10 +418,10 @@ class CloudSchedule : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - CHECK_CBOR_MULTI(appendAttributeReal(_value.frm, "frm", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.to, "to", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.len, "len", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.msk, "msk", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.frm, "frm", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.to, "to", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.len, "len", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.msk, "msk", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { diff --git a/src/property/types/CloudString.h b/src/property/types/CloudString.h index 70cefb3d2..2fae996e5 100644 --- a/src/property/types/CloudString.h +++ b/src/property/types/CloudString.h @@ -59,7 +59,7 @@ class CloudString : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_value, "", encoder); + return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudUnsignedInt.h b/src/property/types/CloudUnsignedInt.h index b7c20078a..9dfc0970f 100644 --- a/src/property/types/CloudUnsignedInt.h +++ b/src/property/types/CloudUnsignedInt.h @@ -53,7 +53,7 @@ class CloudUnsignedInt : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_value, "", encoder); + return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudWrapperBool.h b/src/property/types/CloudWrapperBool.h index f60f374e8..72a37a121 100644 --- a/src/property/types/CloudWrapperBool.h +++ b/src/property/types/CloudWrapperBool.h @@ -46,7 +46,7 @@ class CloudWrapperBool : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_primitive_value, "", encoder); + return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudWrapperFloat.h b/src/property/types/CloudWrapperFloat.h index a888fdb1e..5d0276747 100644 --- a/src/property/types/CloudWrapperFloat.h +++ b/src/property/types/CloudWrapperFloat.h @@ -48,7 +48,7 @@ class CloudWrapperFloat : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_primitive_value, "", encoder); + return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudWrapperInt.h b/src/property/types/CloudWrapperInt.h index e151cfa16..997a4c842 100644 --- a/src/property/types/CloudWrapperInt.h +++ b/src/property/types/CloudWrapperInt.h @@ -46,7 +46,7 @@ class CloudWrapperInt : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_primitive_value, "", encoder); + return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudWrapperString.h b/src/property/types/CloudWrapperString.h index b7b125236..59b7d3926 100644 --- a/src/property/types/CloudWrapperString.h +++ b/src/property/types/CloudWrapperString.h @@ -50,7 +50,7 @@ class CloudWrapperString : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_primitive_value, "", encoder); + return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/CloudWrapperUnsignedInt.h b/src/property/types/CloudWrapperUnsignedInt.h index 50d7f6b1f..62a0cdf20 100644 --- a/src/property/types/CloudWrapperUnsignedInt.h +++ b/src/property/types/CloudWrapperUnsignedInt.h @@ -46,7 +46,7 @@ class CloudWrapperUnsignedInt : public CloudWrapperBase { _cloud_value = _primitive_value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - return appendAttributeReal(_primitive_value, "", encoder); + return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { setAttributeReal(_cloud_value, ""); diff --git a/src/property/types/automation/CloudColoredLight.h b/src/property/types/automation/CloudColoredLight.h index 8f24f1e94..03c237ae7 100644 --- a/src/property/types/automation/CloudColoredLight.h +++ b/src/property/types/automation/CloudColoredLight.h @@ -119,10 +119,10 @@ class CloudColoredLight : public CloudColor { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.hue, "hue", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.sat, "sat", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.swi, "swi", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.hue, "hue", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.sat, "sat", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.bri, "bri", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { diff --git a/src/property/types/automation/CloudDimmedLight.h b/src/property/types/automation/CloudDimmedLight.h index 6cfec0596..e8d863ab0 100644 --- a/src/property/types/automation/CloudDimmedLight.h +++ b/src/property/types/automation/CloudDimmedLight.h @@ -99,14 +99,14 @@ class CloudDimmedLight : public Property { } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.swi, "swi", encoder)); // To allow visualization through color widget // Start float hue = 0; float sat = 0; - CHECK_CBOR_MULTI(appendAttributeReal(hue, "hue", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(sat, "sat", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.bri, "bri", encoder)); + CHECK_CBOR_MULTI(appendAttribute(hue, "hue", encoder)); + CHECK_CBOR_MULTI(appendAttribute(sat, "sat", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.bri, "bri", encoder)); // should be only: // appendAttribute(_value.bri); // end diff --git a/src/property/types/automation/CloudTelevision.h b/src/property/types/automation/CloudTelevision.h index c1eec054d..720e00730 100644 --- a/src/property/types/automation/CloudTelevision.h +++ b/src/property/types/automation/CloudTelevision.h @@ -214,12 +214,12 @@ class CloudTelevision : public Property { _cloud_value = _value; } virtual CborError appendAttributesToCloud(CborEncoder *encoder) { - CHECK_CBOR_MULTI(appendAttributeReal(_value.swi, "swi", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.vol, "vol", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.mut, "mut", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal((int)_value.pbc, "pbc", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal((int)_value.inp, "inp", encoder)); - CHECK_CBOR_MULTI(appendAttributeReal(_value.cha, "cha", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.swi, "swi", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.vol, "vol", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.mut, "mut", encoder)); + CHECK_CBOR_MULTI(appendAttribute((int)_value.pbc, "pbc", encoder)); + CHECK_CBOR_MULTI(appendAttribute((int)_value.inp, "inp", encoder)); + CHECK_CBOR_MULTI(appendAttribute(_value.cha, "cha", encoder)); return CborNoError; } virtual void setAttributesFromCloud() { From 7d5221c051c572a58e4aa532af9a852cd5d42a39 Mon Sep 17 00:00:00 2001 From: pennam Date: Fri, 21 Oct 2022 09:23:53 +0200 Subject: [PATCH 8/8] Rename setAttributeReal to setAttribute --- src/property/Property.cpp | 24 +++++++++---------- src/property/Property.h | 14 +++++------ src/property/types/CloudBool.h | 2 +- src/property/types/CloudColor.h | 6 ++--- src/property/types/CloudFloat.h | 2 +- src/property/types/CloudInt.h | 2 +- src/property/types/CloudLocation.h | 4 ++-- src/property/types/CloudSchedule.h | 8 +++---- src/property/types/CloudString.h | 2 +- src/property/types/CloudUnsignedInt.h | 2 +- src/property/types/CloudWrapperBool.h | 2 +- src/property/types/CloudWrapperFloat.h | 2 +- src/property/types/CloudWrapperInt.h | 2 +- src/property/types/CloudWrapperString.h | 2 +- src/property/types/CloudWrapperUnsignedInt.h | 2 +- .../types/automation/CloudColoredLight.h | 8 +++---- .../types/automation/CloudDimmedLight.h | 4 ++-- .../types/automation/CloudTelevision.h | 12 +++++----- 18 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/property/Property.cpp b/src/property/Property.cpp index f395ea2b3..326e25584 100644 --- a/src/property/Property.cpp +++ b/src/property/Property.cpp @@ -278,8 +278,8 @@ void Property::setAttributesFromCloud(std::list * map_data_list) { setAttributesFromCloud(); } -void Property::setAttributeReal(bool& value, String attributeName) { - setAttributeReal(attributeName, [&value](CborMapData & md) { +void Property::setAttribute(bool& value, String attributeName) { + setAttribute(attributeName, [&value](CborMapData & md) { // Manage the case to have boolean values received as integers 0/1 if (md.bool_val.isSet()) { value = md.bool_val.get(); @@ -295,34 +295,34 @@ void Property::setAttributeReal(bool& value, String attributeName) { }); } -void Property::setAttributeReal(int& value, String attributeName) { - setAttributeReal(attributeName, [&value](CborMapData & md) { +void Property::setAttribute(int& value, String attributeName) { + setAttribute(attributeName, [&value](CborMapData & md) { value = md.val.get(); }); } -void Property::setAttributeReal(unsigned int& value, String attributeName) { - setAttributeReal(attributeName, [&value](CborMapData & md) { +void Property::setAttribute(unsigned int& value, String attributeName) { + setAttribute(attributeName, [&value](CborMapData & md) { value = md.val.get(); }); } -void Property::setAttributeReal(float& value, String attributeName) { - setAttributeReal(attributeName, [&value](CborMapData & md) { +void Property::setAttribute(float& value, String attributeName) { + setAttribute(attributeName, [&value](CborMapData & md) { value = md.val.get(); }); } -void Property::setAttributeReal(String& value, String attributeName) { - setAttributeReal(attributeName, [&value](CborMapData & md) { +void Property::setAttribute(String& value, String attributeName) { + setAttribute(attributeName, [&value](CborMapData & md) { value = md.str_val.get(); }); } #ifdef __AVR__ -void Property::setAttributeReal(String attributeName, nonstd::functionsetValue) +void Property::setAttribute(String attributeName, nonstd::functionsetValue) #else -void Property::setAttributeReal(String attributeName, std::functionsetValue) +void Property::setAttribute(String attributeName, std::functionsetValue) #endif { if (attributeName != "") { diff --git a/src/property/Property.h b/src/property/Property.h index 180bb04e7..b0e6ada06 100644 --- a/src/property/Property.h +++ b/src/property/Property.h @@ -193,17 +193,17 @@ class Property CborError appendAttribute(String value, String attributeName = "", CborEncoder *encoder = nullptr); #ifndef __AVR__ CborError appendAttributeName(String attributeName, std::functionf, CborEncoder *encoder); - void setAttributeReal(String attributeName, std::functionsetValue); + void setAttribute(String attributeName, std::functionsetValue); #else CborError appendAttributeName(String attributeName, nonstd::functionf, CborEncoder *encoder); - void setAttributeReal(String attributeName, nonstd::functionsetValue); + void setAttribute(String attributeName, nonstd::functionsetValue); #endif void setAttributesFromCloud(std::list * map_data_list); - void setAttributeReal(bool& value, String attributeName = ""); - void setAttributeReal(int& value, String attributeName = ""); - void setAttributeReal(unsigned int& value, String attributeName = ""); - void setAttributeReal(float& value, String attributeName = ""); - void setAttributeReal(String& value, String attributeName = ""); + void setAttribute(bool& value, String attributeName = ""); + void setAttribute(int& value, String attributeName = ""); + void setAttribute(unsigned int& value, String attributeName = ""); + void setAttribute(float& value, String attributeName = ""); + void setAttribute(String& value, String attributeName = ""); virtual bool isDifferentFromCloud() = 0; virtual void fromCloudToLocal() = 0; diff --git a/src/property/types/CloudBool.h b/src/property/types/CloudBool.h index 1cb4bea6e..3434656fc 100644 --- a/src/property/types/CloudBool.h +++ b/src/property/types/CloudBool.h @@ -56,7 +56,7 @@ class CloudBool : public Property { return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } //modifiers CloudBool& operator=(bool v) { diff --git a/src/property/types/CloudColor.h b/src/property/types/CloudColor.h index 27d581c40..54cb4f30f 100644 --- a/src/property/types/CloudColor.h +++ b/src/property/types/CloudColor.h @@ -195,9 +195,9 @@ class CloudColor : public Property { return CborNoError; } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value.hue, "hue"); - setAttributeReal(_cloud_value.sat, "sat"); - setAttributeReal(_cloud_value.bri, "bri"); + setAttribute(_cloud_value.hue, "hue"); + setAttribute(_cloud_value.sat, "sat"); + setAttribute(_cloud_value.bri, "bri"); } }; diff --git a/src/property/types/CloudFloat.h b/src/property/types/CloudFloat.h index 02032d3cb..514df7866 100644 --- a/src/property/types/CloudFloat.h +++ b/src/property/types/CloudFloat.h @@ -58,7 +58,7 @@ class CloudFloat : public Property { return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } //modifiers CloudFloat& operator=(float v) { diff --git a/src/property/types/CloudInt.h b/src/property/types/CloudInt.h index 81dbf6c24..37e4d3cae 100644 --- a/src/property/types/CloudInt.h +++ b/src/property/types/CloudInt.h @@ -56,7 +56,7 @@ class CloudInt : public Property { return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } //modifiers CloudInt& operator=(int v) { diff --git a/src/property/types/CloudLocation.h b/src/property/types/CloudLocation.h index e5fae7e67..cd4f0dc67 100644 --- a/src/property/types/CloudLocation.h +++ b/src/property/types/CloudLocation.h @@ -95,8 +95,8 @@ class CloudLocation : public Property { return CborNoError; } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value.lat, "lat"); - setAttributeReal(_cloud_value.lon, "lon"); + setAttribute(_cloud_value.lat, "lat"); + setAttribute(_cloud_value.lon, "lon"); } }; diff --git a/src/property/types/CloudSchedule.h b/src/property/types/CloudSchedule.h index d5b9261ca..ecf6345ec 100644 --- a/src/property/types/CloudSchedule.h +++ b/src/property/types/CloudSchedule.h @@ -425,10 +425,10 @@ class CloudSchedule : public Property { return CborNoError; } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value.frm, "frm"); - setAttributeReal(_cloud_value.to, "to"); - setAttributeReal(_cloud_value.len, "len"); - setAttributeReal(_cloud_value.msk, "msk"); + setAttribute(_cloud_value.frm, "frm"); + setAttribute(_cloud_value.to, "to"); + setAttribute(_cloud_value.len, "len"); + setAttribute(_cloud_value.msk, "msk"); } }; diff --git a/src/property/types/CloudString.h b/src/property/types/CloudString.h index 2fae996e5..f884720c0 100644 --- a/src/property/types/CloudString.h +++ b/src/property/types/CloudString.h @@ -62,7 +62,7 @@ class CloudString : public Property { return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } //modifiers CloudString& operator=(String v) { diff --git a/src/property/types/CloudUnsignedInt.h b/src/property/types/CloudUnsignedInt.h index 9dfc0970f..40bed697a 100644 --- a/src/property/types/CloudUnsignedInt.h +++ b/src/property/types/CloudUnsignedInt.h @@ -56,7 +56,7 @@ class CloudUnsignedInt : public Property { return appendAttribute(_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } //modifiers CloudUnsignedInt& operator=(unsigned int v) { diff --git a/src/property/types/CloudWrapperBool.h b/src/property/types/CloudWrapperBool.h index 72a37a121..8fffd4209 100644 --- a/src/property/types/CloudWrapperBool.h +++ b/src/property/types/CloudWrapperBool.h @@ -49,7 +49,7 @@ class CloudWrapperBool : public CloudWrapperBase { return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperFloat.h b/src/property/types/CloudWrapperFloat.h index 5d0276747..7ce857c85 100644 --- a/src/property/types/CloudWrapperFloat.h +++ b/src/property/types/CloudWrapperFloat.h @@ -51,7 +51,7 @@ class CloudWrapperFloat : public CloudWrapperBase { return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperInt.h b/src/property/types/CloudWrapperInt.h index 997a4c842..73623abfc 100644 --- a/src/property/types/CloudWrapperInt.h +++ b/src/property/types/CloudWrapperInt.h @@ -49,7 +49,7 @@ class CloudWrapperInt : public CloudWrapperBase { return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperString.h b/src/property/types/CloudWrapperString.h index 59b7d3926..7c75db0db 100644 --- a/src/property/types/CloudWrapperString.h +++ b/src/property/types/CloudWrapperString.h @@ -53,7 +53,7 @@ class CloudWrapperString : public CloudWrapperBase { return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/CloudWrapperUnsignedInt.h b/src/property/types/CloudWrapperUnsignedInt.h index 62a0cdf20..34ed01ef3 100644 --- a/src/property/types/CloudWrapperUnsignedInt.h +++ b/src/property/types/CloudWrapperUnsignedInt.h @@ -49,7 +49,7 @@ class CloudWrapperUnsignedInt : public CloudWrapperBase { return appendAttribute(_primitive_value, "", encoder); } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value, ""); + setAttribute(_cloud_value, ""); } virtual bool isPrimitive() { return true; diff --git a/src/property/types/automation/CloudColoredLight.h b/src/property/types/automation/CloudColoredLight.h index 03c237ae7..031590a39 100644 --- a/src/property/types/automation/CloudColoredLight.h +++ b/src/property/types/automation/CloudColoredLight.h @@ -126,10 +126,10 @@ class CloudColoredLight : public CloudColor { return CborNoError; } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value.swi, "swi"); - setAttributeReal(_cloud_value.hue, "hue"); - setAttributeReal(_cloud_value.sat, "sat"); - setAttributeReal(_cloud_value.bri, "bri"); + setAttribute(_cloud_value.swi, "swi"); + setAttribute(_cloud_value.hue, "hue"); + setAttribute(_cloud_value.sat, "sat"); + setAttribute(_cloud_value.bri, "bri"); } }; diff --git a/src/property/types/automation/CloudDimmedLight.h b/src/property/types/automation/CloudDimmedLight.h index e8d863ab0..8e0c0b39f 100644 --- a/src/property/types/automation/CloudDimmedLight.h +++ b/src/property/types/automation/CloudDimmedLight.h @@ -114,8 +114,8 @@ class CloudDimmedLight : public Property { } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value.swi, "swi"); - setAttributeReal(_cloud_value.bri, "bri"); + setAttribute(_cloud_value.swi, "swi"); + setAttribute(_cloud_value.bri, "bri"); } }; diff --git a/src/property/types/automation/CloudTelevision.h b/src/property/types/automation/CloudTelevision.h index 720e00730..75967dd4f 100644 --- a/src/property/types/automation/CloudTelevision.h +++ b/src/property/types/automation/CloudTelevision.h @@ -223,12 +223,12 @@ class CloudTelevision : public Property { return CborNoError; } virtual void setAttributesFromCloud() { - setAttributeReal(_cloud_value.swi, "swi"); - setAttributeReal(_cloud_value.vol, "vol"); - setAttributeReal(_cloud_value.mut, "mut"); - setAttributeReal((int&)_cloud_value.pbc, "pbc"); - setAttributeReal((int&)_cloud_value.inp, "inp"); - setAttributeReal(_cloud_value.cha, "cha"); + setAttribute(_cloud_value.swi, "swi"); + setAttribute(_cloud_value.vol, "vol"); + setAttribute(_cloud_value.mut, "mut"); + setAttribute((int&)_cloud_value.pbc, "pbc"); + setAttribute((int&)_cloud_value.inp, "inp"); + setAttribute(_cloud_value.cha, "cha"); } };