Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Blynk_Example_WIZwiki-W7500
Fork of Blynk by
Diff: Blynk/BlynkHandlers.h
- Revision:
- 9:7369ec77a3ea
- Parent:
- 7:8879692d4e6c
- Child:
- 10:c241e4227173
--- a/Blynk/BlynkHandlers.h Wed Oct 12 10:38:37 2016 +0300 +++ b/Blynk/BlynkHandlers.h Thu Jan 05 14:55:36 2017 +0200 @@ -180,37 +180,30 @@ #define BLYNK_CONNECTED() void BlynkOnConnected() #define BLYNK_DISCONNECTED() void BlynkOnDisconnected() +#define BLYNK_APP_CONNECTED() void BlynkOnAppConnected() + // Advanced functions -class BlynkAttachWidgetHelper { -public: - template<typename T> - explicit BlynkAttachWidgetHelper(T& widget, uint8_t vPin) { - widget.setVPin(vPin); - } -}; - -// Could use __attribute__ ((constructor)), but hope for better portability -#define BLYNK_ATTACH_WIDGET(widget, pin) \ - BlynkAttachWidgetHelper BLYNK_CONCAT2(blnk_widget_helper_, __COUNTER__)((widget), (pin)); \ - BLYNK_WRITE(pin) { (widget).onWrite(request, param); } - -#define BLYNK_VAR_INT(name, pin) int name; \ +#define BLYNK_VAR_INT(name, pin) \ + int name; \ BLYNK_WRITE(pin) { name = param.asInt(); } \ BLYNK_READ(pin) { Blynk.virtualWrite(pin, name); } -#define BLYNK_VAR_LONG(name, pin) long name; \ +#define BLYNK_VAR_LONG(name, pin) \ + long name; \ BLYNK_WRITE(pin) { name = param.asLong(); } \ BLYNK_READ(pin) { Blynk.virtualWrite(pin, name); } #ifndef BLYNK_NO_FLOAT -#define BLYNK_VAR_DOUBLE(name, pin) double name; \ +#define BLYNK_VAR_DOUBLE(name, pin) \ + double name; \ BLYNK_WRITE(pin) { name = param.asDouble(); } \ BLYNK_READ(pin) { Blynk.virtualWrite(pin, name); } #endif #ifdef ARDUINO -#define BLYNK_VAR_STRING(name, pin) String name; \ +#define BLYNK_VAR_STRING(name, pin) \ + String name; \ BLYNK_WRITE(pin) { name = param.asStr(); } \ BLYNK_READ(pin) { Blynk.virtualWrite(pin, name); } #endif @@ -240,6 +233,8 @@ BLYNK_CONNECTED(); BLYNK_DISCONNECTED(); +BLYNK_APP_CONNECTED(); + BLYNK_READ_DEFAULT(); BLYNK_WRITE_DEFAULT();