1
1
#include <ArduinoIoTCloud.h>
2
2
#include <Arduino_ConnectionHandler.h>
3
+
3
4
#include "arduino_secrets.h"
4
5
5
6
#if !(defined(BOARD_HAS_WIFI ) || defined(BOARD_HAS_GSM ) || defined(BOARD_HAS_LORA ) || \
@@ -24,13 +25,13 @@ void initProperties() {
24
25
ArduinoCloud .setSecretDeviceKey (SECRET_DEVICE_KEY );
25
26
#endif
26
27
#if defined(BOARD_HAS_WIFI ) || defined(BOARD_HAS_GSM ) || defined(BOARD_HAS_NB ) || defined(BOARD_HAS_ETHERNET ) || defined(BOARD_HAS_CATM1_NBIOT )
27
- ArduinoCloud .addProperty (switchButton , WRITE , ON_CHANGE , onSwitchButtonChange );
28
- ArduinoCloud .addProperty (location , READ , ON_CHANGE );
29
- ArduinoCloud .addProperty (color , READWRITE , ON_CHANGE , onColorChange );
28
+ ArduinoCloud .addProperty (switchButton , Permission :: Write ). onUpdate ( onSwitchButtonChange );
29
+ ArduinoCloud .addProperty (location , Permission :: Read ). publishOnChange ( 0.0f );
30
+ ArduinoCloud .addProperty (color , Permission :: ReadWrite ). onUpdate ( onColorChange );
30
31
#elif defined(BOARD_HAS_LORA )
31
- ArduinoCloud .addProperty (switchButton , 1 , WRITE , ON_CHANGE , onSwitchButtonChange );
32
- ArduinoCloud .addProperty (location , 2 , READ , ON_CHANGE );
33
- ArduinoCloud .addProperty (color , 3 , READWRITE , ON_CHANGE , onColorChange );
32
+ ArduinoCloud .addProperty (switchButton , 1 , Permission :: Write ). onUpdate ( onSwitchButtonChange );
33
+ ArduinoCloud .addProperty (location , 2 , Permission :: Read ). publishOnChange ( 0.0f );
34
+ ArduinoCloud .addProperty (color , 3 , Permission :: ReadWrite ). onUpdate ( onColorChange );
34
35
#endif
35
36
}
36
37
0 commit comments