summaryrefslogtreecommitdiff
path: root/fw/fe310/test
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-03-24 23:13:42 +0100
committerUros Majstorovic <majstor@majstor.org>2021-03-24 23:13:42 +0100
commit95f69d4f83ad8f7fbb56349f29e902928510362b (patch)
tree51f4848b0518d138368af30f8e7abeebb89ebd5f /fw/fe310/test
parent8c61343677d2ed8f929372863016524707b8ab93 (diff)
window hierarchy
Diffstat (limited to 'fw/fe310/test')
-rw-r--r--fw/fe310/test/cell_pdp.c4
-rw-r--r--fw/fe310/test/main.c6
-rw-r--r--fw/fe310/test/modem.c37
-rw-r--r--fw/fe310/test/phone.c4
-rw-r--r--fw/fe310/test/status.c15
-rw-r--r--fw/fe310/test/wifi.c9
6 files changed, 32 insertions, 43 deletions
diff --git a/fw/fe310/test/cell_pdp.c b/fw/fe310/test/cell_pdp.c
index 2225f6a..b7580cc 100644
--- a/fw/fe310/test/cell_pdp.c
+++ b/fw/fe310/test/cell_pdp.c
@@ -16,15 +16,13 @@
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>
-#include <eve/screen/screen.h>
#include <eve/screen/window.h>
-#include <eve/screen/view.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include <eve/widget/widgets.h>
-#include <app/app_screen.h>
+#include <app/app_root.h>
#include <app/app_form.h>
#include "status.h"
diff --git a/fw/fe310/test/main.c b/fw/fe310/test/main.c
index 8ec7790..37d7a45 100644
--- a/fw/fe310/test/main.c
+++ b/fw/fe310/test/main.c
@@ -16,15 +16,13 @@
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>
-#include <eve/screen/screen.h>
#include <eve/screen/window.h>
-#include <eve/screen/view.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include <eve/widget/widgets.h>
-#include <app/app_screen.h>
+#include <app/app_root.h>
#include <app/app_form.h>
#include "status.h"
@@ -71,7 +69,7 @@ int main() {
eos_init();
app_form_init();
- app_screen_init(app_home_page);
+ app_root_init(app_home_page);
app_status_init();
app_phone_init();
app_wifi_init();
diff --git a/fw/fe310/test/modem.c b/fw/fe310/test/modem.c
index eb0368d..8c3a8a6 100644
--- a/fw/fe310/test/modem.c
+++ b/fw/fe310/test/modem.c
@@ -17,15 +17,13 @@
#include <eve/eve_text.h>
#include <eve/eve_font.h>
-#include <eve/screen/screen.h>
#include <eve/screen/window.h>
-#include <eve/screen/view.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include <eve/widget/widgets.h>
-#include <app/app_screen.h>
+#include <app/app_root.h>
#include <app/app_form.h>
#include "modem.h"
@@ -83,8 +81,8 @@ static void handle_uart(unsigned char type) {
}
static void handle_cell_msg(unsigned char type, unsigned char *buffer, uint16_t len) {
- EVEScreen *screen = app_screen();
- EVEWindow *window = eve_window_get(screen, "main");
+ EVEWindow *root = app_root();
+ EVEWindow *window = eve_window_search(root, "main");
VParam *param = window->view->param;
if (type == EOS_CELL_MTYPE_UART_DATA) {
@@ -97,7 +95,7 @@ static void handle_cell_msg(unsigned char type, unsigned char *buffer, uint16_t
}
if (text->dirty) {
text->dirty = 0;
- eve_screen_draw(window->screen);
+ eve_window_root_draw(root);
}
eve_spi_stop();
eos_net_free(buffer, 0);
@@ -106,38 +104,39 @@ static void handle_cell_msg(unsigned char type, unsigned char *buffer, uint16_t
}
}
-static int modem_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) {
+static uint8_t modem_draw(EVEView *view, uint8_t tag0) {
VParam *param = view->param;
EVEText *text = &param->text;
- return eve_text_touch(text, touch, evt, tag0);
+ tag0 = eve_view_clear(view, tag0);
+ return eve_text_draw(text, tag0);
}
-static uint8_t modem_draw(EVEView *view, uint8_t tag) {
+static int modem_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) {
VParam *param = view->param;
EVEText *text = &param->text;
- return eve_text_draw(text, tag);
+ return eve_text_touch(text, touch, evt, tag0);
}
void app_modem(EVEWindow *window, EVEViewStack *stack) {
unsigned char *buf;
- EVEScreen *screen = window->screen;
- EVEKbd *kbd = eve_screen_get_kbd(screen);
+ EVEWindowRoot *root = (EVEWindowRoot *)window->root;
+ EVEKbd *kbd = eve_window_kbd(window);
EVERect g = {0, 60, 480, 512};
EVEView *view;
VParam *param;
view = eve_malloc(sizeof(EVEView));
param = eve_malloc(sizeof(VParam));
- param->mem = screen->mem_next;
+ param->mem = root->mem_next;
param->stack = stack;
param->cell_dev_handler = eos_cell_get_handler(EOS_CELL_MTYPE_DEV);
- eve_text_init(&param->text, &g, 30, 16, 200, screen->mem_next, &screen->mem_next);
- eve_view_init(view, window, modem_touch, modem_draw, param);
+ eve_text_init(&param->text, &g, 30, 16, 200, root->mem_next, &root->mem_next);
+ eve_view_init(view, window, modem_draw, modem_touch, param);
eve_kbd_set_handler(kbd, key_down, view);
- eve_screen_show_kbd(screen);
+ eve_window_kbd_attach(window);
eos_uart_set_handler(EOS_UART_ETYPE_RX, handle_uart);
eos_cell_set_handler(EOS_CELL_MTYPE_DEV, handle_cell_msg);
@@ -153,7 +152,7 @@ void app_modem_close(EVEView *view) {
unsigned char *buf = eos_net_alloc();
VParam *param = view->param;
EVEWindow *window = view->window;
- EVEScreen *screen = window->screen;
+ EVEWindowRoot *root = (EVEWindowRoot *)window->root;
EVEViewStack *stack = param->stack;
buf[0] = EOS_CELL_MTYPE_DEV | EOS_CELL_MTYPE_RESET;
@@ -163,10 +162,10 @@ void app_modem_close(EVEView *view) {
eos_cell_set_handler(EOS_CELL_MTYPE_DEV, param->cell_dev_handler);
eos_net_acquire_for_evt(EOS_EVT_UART | EOS_UART_ETYPE_RX, 0);
- screen->mem_next = param->mem;
+ root->mem_next = param->mem;
eve_free(param);
eve_free(view);
- eve_screen_hide_kbd(screen);
+ eve_window_kbd_detach(window);
eve_view_destroy(window, stack);
}
diff --git a/fw/fe310/test/phone.c b/fw/fe310/test/phone.c
index 442fcae..2d33760 100644
--- a/fw/fe310/test/phone.c
+++ b/fw/fe310/test/phone.c
@@ -16,15 +16,13 @@
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>
-#include <eve/screen/screen.h>
#include <eve/screen/window.h>
-#include <eve/screen/view.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include <eve/widget/widgets.h>
-#include <app/app_screen.h>
+#include <app/app_root.h>
#include <app/app_form.h>
#include "status.h"
diff --git a/fw/fe310/test/status.c b/fw/fe310/test/status.c
index cbce1c7..7d3eb73 100644
--- a/fw/fe310/test/status.c
+++ b/fw/fe310/test/status.c
@@ -16,15 +16,13 @@
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>
-#include <eve/screen/screen.h>
#include <eve/screen/window.h>
-#include <eve/screen/view.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include <eve/widget/widgets.h>
-#include <app/app_screen.h>
+#include <app/app_root.h>
#include <app/app_form.h>
#include "phone.h"
@@ -38,7 +36,7 @@ static int status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t ta
if (touch_idx != 0) return 0;
- evt = eve_touch_evt(touch, evt, tag0, view->window->tag, 2);
+ evt = eve_touch_evt(touch, evt, tag0, view->tag, 2);
if (touch && (evt & EVE_TOUCH_ETYPE_POINT_UP)) {
if ((state == VOICE_STATE_RING) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_LEFT)) {
unsigned char *buf = eos_net_alloc();
@@ -61,7 +59,9 @@ static int status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t ta
static uint8_t status_draw(EVEView *view, uint8_t tag0) {
uint8_t tag_opt = EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_XY;
- if (view->window->tag != EVE_TAG_NOTAG) eve_touch_set_opt(view->window->tag, eve_touch_get_opt(view->window->tag) | tag_opt);
+
+ tag0 = eve_view_clear(view, tag0);
+ if (view->tag != EVE_TAG_NOTAG) eve_touch_set_opt(view->tag, eve_touch_get_opt(view->tag) | tag_opt);
if (tag0 != EVE_TAG_NOTAG) {
eve_touch_set_opt(tag0, eve_touch_get_opt(tag0) | tag_opt);
@@ -77,12 +77,11 @@ static uint8_t status_draw(EVEView *view, uint8_t tag0) {
void app_status_msg_set(char *msg, int refresh) {
strcpy(status_msg, msg);
- if (refresh) app_screen_refresh();
+ if (refresh) app_root_refresh();
}
void app_status_init(void) {
- EVEScreen *screen = app_screen();
- EVEWindow *status = eve_window_get(screen, "status");
+ EVEWindow *status = eve_window_search(app_root(), "status");
status->view->touch = status_touch;
status->view->draw = status_draw;
}
diff --git a/fw/fe310/test/wifi.c b/fw/fe310/test/wifi.c
index cf2f0be..2ce3e87 100644
--- a/fw/fe310/test/wifi.c
+++ b/fw/fe310/test/wifi.c
@@ -16,15 +16,13 @@
#include <eve/eve_kbd.h>
#include <eve/eve_font.h>
-#include <eve/screen/screen.h>
#include <eve/screen/window.h>
-#include <eve/screen/view.h>
#include <eve/screen/page.h>
#include <eve/screen/form.h>
#include <eve/widget/widgets.h>
-#include <app/app_screen.h>
+#include <app/app_root.h>
#include <app/app_form.h>
#include "status.h"
@@ -60,15 +58,14 @@ static void wifi_disconnect(void) {
}
void wifi_scan_handler(unsigned char type, unsigned char *buffer, uint16_t size) {
- EVEScreen *screen = app_screen();
- EVEWindow *window = eve_window_get(screen, "main");
+ EVEWindow *window = eve_window_search(app_root(), "main");
EVEForm *form = (EVEForm *)window->view;
EVESelectWidget *select = (EVESelectWidget *)eve_form_widget(form, 0);
eve_selectw_option_set(select, buffer + 1, size - 1);
eos_net_free(buffer, 0);
- app_screen_refresh();
+ app_root_refresh();
}
static void wifi_connect_handler(unsigned char type, unsigned char *buffer, uint16_t size) {