blynkkk / blynk-library

Blynk library for IoT boards. Works with Arduino, ESP32, ESP8266, Raspberry Pi, Particle, ARM Mbed, etc.
https://blynk.io
MIT License
3.84k stars 1.39k forks source link

SetProperty should supoport multiple params for some properties #153

Closed doom369 closed 8 years ago

doom369 commented 8 years ago

Blynk.setProperty(V0, "labels", "1", "2", "3", "4", "5");

We don't know the number of possible values, so it should be string array + overloaded methods.

doom369 commented 8 years ago

@vshymanskyy any update here?

doom369 commented 8 years ago

@vshymanskyy add at least few overloaded methods for now.

doom369 commented 8 years ago

@vshymanskyy we got update from customer. There will be ~25 folders.

vshymanskyy commented 8 years ago

For 25 folders, it may be better to use same idea as with table widget: clear + add + add + add

doom369 commented 8 years ago

@vshymanskyy it will require custom logic for setProperty for specific widget on server and apps. That is bad way to go.

vshymanskyy commented 8 years ago

Cannot we send Hardware command?

vshymanskyy commented 8 years ago

If it's complicated, i can come up with custom wrapper to build proper command just for this widget (HW or PROPERTY, doesn't matter)

doom369 commented 8 years ago

No. It will cause problems with sync.

vshymanskyy commented 8 years ago

Ok, I agree.

doom369 commented 8 years ago

@vshymanskyy any updates?

vshymanskyy commented 8 years ago

In progress...

On Tue, Sep 6, 2016 at 12:39 PM, Dmitriy Dumanskiy <notifications@github.com

wrote:

@vshymanskyy https://github.com/vshymanskyy any updates?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/blynkkk/blynk-library/issues/153#issuecomment-244900691, or mute the thread https://github.com/notifications/unsubscribe-auth/ABb9lJn5rc0CTJSvqzmTYk3RR3ptsah1ks5qnTS5gaJpZM4JtFvv .

Kindest regards, Volodymyr Shymanskyy

vshymanskyy commented 8 years ago

How about this:

      BlynkParamAllocated list(128); // size in bytes
      list.add("New item 1");
      list.add("New item 2");
      list.add("New item 3");
      Blynk.setProperty(V1, "items", list);
vshymanskyy commented 8 years ago

Added overloads, BlynkParamAllocated, updated example

doom369 commented 8 years ago

Seems fine. What will happen in case I reach 128 bytes or more?

vshymanskyy commented 8 years ago

Nothing. it won't add new elements beyond specified limit