Skip to content

Commit fccc594

Browse files
committed
Improve stringification
1 parent 5e92f67 commit fccc594

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ArduinoCloudThing.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,15 @@ inline void ArduinoCloudProperty<char*>::appendValue(CborObject &cbor) {
195195
cbor.set("s", property);
196196
};
197197

198-
#ifndef addProperty
199-
#define addProperty(prop) addPropertyReal(prop, #prop)
200-
#endif
198+
#define NAME_OF( v ) #v
201199

202200
class ArduinoCloudThing {
203201
public:
204202
ArduinoCloudThing();
205203
void begin();
204+
template <typename T> ArduinoCloudPropertyGeneric& addProperty(T property) {
205+
return addPropertyReal(property, NAME_OF(property));
206+
};
206207
ArduinoCloudPropertyGeneric& addPropertyReal(int& property, String name);
207208
ArduinoCloudPropertyGeneric& addPropertyReal(bool& property, String name);
208209
ArduinoCloudPropertyGeneric& addPropertyReal(float& property, String name);

0 commit comments

Comments
 (0)