mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-24 11:46:34 +00:00
QR-Code extended by lv_qrcode_get_text
This commit is contained in:
parent
4d25e77ea6
commit
6a819f58c7
@ -271,6 +271,20 @@ lv_res_t lv_qrcode_set_text_static(lv_obj_t * qrcode, const void * text)
|
||||
return lv_qrcode_update(qrcode, text, strlen(text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the text of a qrcode
|
||||
* @param qrcode pointer to a qrcode object
|
||||
* @return the text of the qrcode
|
||||
*/
|
||||
char * lv_qrcode_get_text(const lv_obj_t * qrcode)
|
||||
{
|
||||
LV_ASSERT_OBJ(qrcode, LV_OBJX_NAME);
|
||||
|
||||
lv_qrcode_ext_t * ext = lv_obj_get_ext_attr(qrcode);
|
||||
|
||||
return ext->text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the data of a QR code object
|
||||
* @param qrcode pointer to aQ code object
|
||||
|
@ -84,6 +84,13 @@ lv_res_t lv_qrcode_set_text(lv_obj_t * qrcode, const void * text);
|
||||
*/
|
||||
lv_res_t lv_qrcode_set_text_static(lv_obj_t * qrcode, const void * text);
|
||||
|
||||
/**
|
||||
* Get the text of a qrcode
|
||||
* @param qrcode pointer to a qrcode object
|
||||
* @return the text of the qrcode
|
||||
*/
|
||||
char * lv_qrcode_get_text(const lv_obj_t * qrcode);
|
||||
|
||||
/**
|
||||
* Set the data of a QR code object
|
||||
* @param qrcode pointer to QR code object
|
||||
|
@ -610,6 +610,17 @@ static inline void my_btn_set_text(lv_obj_t* obj, const char* value)
|
||||
// OK - lvgl does not return a const char *
|
||||
static const char* my_qrcode_get_text(const lv_obj_t* obj)
|
||||
{
|
||||
if(!obj) {
|
||||
LOG_WARNING(TAG_ATTR, F("QR-code not defined"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(obj) {
|
||||
if(obj_check_type(obj, LV_HASP_QRCODE)) return lv_qrcode_get_text(obj);
|
||||
} else {
|
||||
LOG_WARNING(TAG_ATTR, F("my_qrcode_get_text NULL Pointer encountered"));
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user