BigW Consortium Gitlab

Commit 8578c2f1 by Gabor

WiFi app added

parent 6b2ff575
......@@ -133,6 +133,11 @@ void lv_app_init(void)
dsc = ll_ins_head(&app_dsc_ll);
*dsc = lv_app_files_init();
#endif
#if USE_LV_APP_WIFI != 0
dsc = ll_ins_head(&app_dsc_ll);
*dsc = lv_app_wifi_init();
#endif
}
/**
......
......@@ -240,6 +240,7 @@ lv_app_style_t * lv_app_style_get(void);
#include "lvgl/lv_appx/lv_app_sysmon.h"
#include "lvgl/lv_appx/lv_app_terminal.h"
#include "lvgl/lv_appx/lv_app_files.h"
#include "lvgl/lv_appx/lv_app_wifi.h"
#endif /*LV_APP_ENABLE != 0*/
......
......@@ -149,14 +149,13 @@ lv_obj_t * lv_app_kb_open(lv_obj_t * ta, lv_app_kb_mode_t mode, void (*close)(lv
if(lv_obj_get_height(kb_ta) > cont_h - LV_DPI / 10) {
lv_obj_set_height(kb_ta, cont_h - LV_DPI / 10);
}
#if LV_APP_ANIM_LEVEL != 0
lv_page_focus(lv_win_get_content(kb_win), kb_ta, true);
#else
lv_page_focus(lv_win_get_page(kb_win), kb_ta, 0);
#endif
}
lv_ta_set_cursor_pos(kb_ta, LV_TA_CUR_LAST);
if(kb_mode & LV_APP_KB_MODE_CURSOR_MANAGE) {
lv_ta_set_cursor_show(kb_ta, true);
}
return kb_btnm;
......@@ -182,7 +181,11 @@ void lv_app_kb_close(bool ok)
lv_obj_set_size(kb_win, LV_HOR_RES, LV_VER_RES);
kb_win = NULL;
}
if(kb_mode & LV_APP_KB_MODE_CURSOR_MANAGE) {
lv_ta_set_cursor_show(kb_ta, false);
}
lv_obj_del(kb_btnm);
kb_btnm = NULL;
......
......@@ -24,6 +24,7 @@ typedef enum
LV_APP_KB_MODE_TXT = 0x01,
LV_APP_KB_MODE_NUM = 0x02,
LV_APP_KB_MODE_WIN_RESIZE = 0x04,
LV_APP_KB_MODE_CURSOR_MANAGE = 0x08,
}lv_app_kb_mode_t;
/**********************
......
......@@ -32,6 +32,7 @@
* DEFINES
*********************/
#define OBJ_PAD (LV_DPI / 12)
#define AUTO_CONNECT_TCP_DELAY 5000 /*Wait before TCS server connect when the WiFi connect is ready*/
/**********************
* TYPEDEFS
......@@ -187,7 +188,7 @@ static void my_com_rec(lv_app_inst_t * app_send, lv_app_inst_t * app_rec,
/*Insert the name of the sender application if it is not the last*/
if(app_data->last_sender != app_send) {
add_data(app_rec, "@", 1);
add_data(app_rec, "\n@", 2);
add_data(app_rec, app_send->name, strlen(app_send->name));
add_data(app_rec, "\n", 1);
}
......@@ -424,6 +425,8 @@ static void win_ta_kb_ok_action(lv_obj_t * ta)
lv_app_com_send(app, app_data->com_type, ta_txt, ta_txt_len);
lv_ta_set_text(ta, "");
app_data->last_sender = NULL; /*Now the least data in the terminal is from this app*/
}
/**
......
/**
* @file lv_app_example.h
*
*/
#ifndef LV_APP_WIFI_H
#define LV_APP_WIFI_H
/*********************
* INCLUDES
*********************/
#include "lvgl/lv_app/lv_app.h"
#if LV_APP_ENABLE != 0 && USE_LV_APP_WIFI != 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct
{
}lv_app_wifi_conf_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
const lv_app_dsc_t * lv_app_wifi_init(void);
/**********************
* MACROS
**********************/
#endif /*LV_APP_ENABLE != 0 && USE_LV_APP_EXAMPLE != 0*/
#endif /* LV_APP_EXAMPLE_H */
......@@ -134,6 +134,7 @@ void lv_style_init (void)
lv_style_btn_rel.hpad = LV_DPI / 4;
lv_style_btn_rel.vpad = LV_DPI / 6;
lv_style_btn_rel.opad = LV_DPI / 10;
lv_style_btn_rel.txt_align = LV_TXT_ALIGN_MID;
/*Button pressed style*/
memcpy(&lv_style_btn_pr, &lv_style_btn_rel, sizeof(lv_style_t));
......
......@@ -140,9 +140,9 @@ bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param)
*====================*/
/**
* Set the options in a drop down list
* Set the options in a drop down list from an array
* @param ddlist pointer to drop down list object
* @param options an array of strings wit the text of the options.
* @param options an array of strings with the text of the options.
* The lest element has to be "" (empty string)
* E.g. const char * opts[] = {"apple", "banana", "orange", ""};
*/
......@@ -162,6 +162,18 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options)
}
/**
* Set the options in a drop down list from a string
* @param ddlist pointer to drop down list object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
*/
void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
lv_label_set_text(ext->opt_label, options);
lv_ddlist_refr_size(ddlist, 0);
}
/**
* Set the selected option
* @param ddlist pointer to drop down list object
* @param sel_opt id of the selected option (0 ... number of option - 1);
......@@ -251,6 +263,31 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist)
}
/**
* Get the current selected option as a string
* @param ddlist pointer to ddlist object
* @param buf pointer to an array to store the string
*/
void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf)
{
lv_ddlist_ext_t * ext = lv_obj_get_ext(ddlist);
uint16_t i;
uint16_t line = 0;
const char * opt_txt = lv_label_get_text(ext->opt_label);
uint16_t txt_len = strlen(opt_txt);
for(i = 0; i < txt_len && line != ext->sel_opt; i++) {
if(opt_txt[i] == '\n') line ++;
}
uint16_t c;
for(c = 0; opt_txt[i] != '\n' && i < txt_len; c++, i++) buf[c] = opt_txt[i];
buf[c] = '\0';
}
/**
* Get the auto size attribute.
* @param ddlist pointer to a drop down list object
* @return true: the auto_size is enabled, false: disabled
......
......@@ -77,6 +77,7 @@ bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
*/
void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options);
void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options);
/**
* Set the selected option
* @param ddlist pointer to drop down list object
......@@ -121,6 +122,7 @@ const char * lv_ddlist_get_options(lv_obj_t * ddlist);
*/
uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf);
/**
* Get the auto size attribute.
* @param ddlist pointer to a drop down list object
......
......@@ -105,6 +105,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, lv_obj_t * copy)
lv_obj_set_design_f(ext->page.scrl, lv_ta_scrling_design);
lv_ta_ext_t * copy_ext = lv_obj_get_ext(copy);
ext->label = lv_label_create(new_ta, copy_ext->label);
ext->cursor_show = copy_ext->cursor_show;
lv_page_glue_obj(ext->label, true);
/*Refresh the style with new signal function*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment