From dd411749d787febb6121cf8e6a719be93eea3322 Mon Sep 17 00:00:00 2001 From: "TWSFI\\fdoni" Date: Fri, 31 Jul 2020 11:49:57 +0200 Subject: [PATCH] add api for change slider backgroup image --- NexSlider.cpp | 28 ++++++++++++++++++++++++++++ NexSlider.h | 16 ++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/NexSlider.cpp b/NexSlider.cpp index fede8d8a..8d6d0a82 100755 --- a/NexSlider.cpp +++ b/NexSlider.cpp @@ -205,6 +205,34 @@ bool NexSlider::setMinval(uint32_t number) cmd += buf; sendCommand(cmd.c_str()); + cmd = ""; + cmd += "ref "; + getObjGlobalPageName(cmd); + sendCommand(cmd.c_str()); + return recvRetCommandFinished(); +} + +uint32_t NexSlider::Get_background_image_pic(uint32_t *number) +{ + String cmd; + cmd += "get "; + getObjGlobalPageName(cmd); + cmd += ".pic"; + sendCommand(cmd.c_str()); + return recvRetNumber(number); +} + +bool NexSlider::Set_background_image_pic(uint32_t number) +{ + char buf[10] = {0}; + String cmd; + + utoa(number, buf, 10); + getObjGlobalPageName(cmd); + cmd += ".pic="; + cmd += buf; + sendCommand(cmd.c_str()); + cmd = ""; cmd += "ref "; getObjGlobalPageName(cmd); diff --git a/NexSlider.h b/NexSlider.h index 05a6aec6..879b0684 100755 --- a/NexSlider.h +++ b/NexSlider.h @@ -151,6 +151,22 @@ class NexSlider: public NexTouch * @return true if success, false for failure */ bool setMinval(uint32_t number); + + /** + * Get pic attribute of component + * + * @param number - buffer storing data return + * @return the length of the data + */ + uint32_t Get_background_image_pic(uint32_t *number); + + /** + * Set pic attribute of component + * + * @param number - To set up the data + * @return true if success, false for failure + */ + bool Set_background_image_pic(uint32_t number); }; /** * @}