From c6962c5700f99441538dafa346626bb7e6d12488 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 30 Mar 2022 13:22:19 +0200 Subject: sock api fixed; net reply messages fixed --- fw/fe310/test/Makefile | 14 ++++--- fw/fe310/test/app/Makefile | 15 +++++++ fw/fe310/test/app/app_root.c | 88 ++++++++++++++++++++++++++++++++++++++++++ fw/fe310/test/app/app_root.h | 12 ++++++ fw/fe310/test/app/app_status.c | 76 ++++++++++++++++++++++++++++++++++++ fw/fe310/test/app/app_status.h | 5 +++ fw/fe310/test/cam.c | 5 +-- fw/fe310/test/cell_dev.c | 9 ++++- fw/fe310/test/cell_pdp.c | 11 +++--- fw/fe310/test/fs.c | 2 +- fw/fe310/test/main.c | 27 +++++++------ fw/fe310/test/modem.c | 10 ++--- fw/fe310/test/phone.c | 21 +++++----- fw/fe310/test/status.c | 81 -------------------------------------- fw/fe310/test/status.h | 2 - fw/fe310/test/test.c | 7 +--- fw/fe310/test/wifi.c | 42 ++++---------------- 17 files changed, 261 insertions(+), 166 deletions(-) create mode 100644 fw/fe310/test/app/Makefile create mode 100644 fw/fe310/test/app/app_root.c create mode 100644 fw/fe310/test/app/app_root.h create mode 100644 fw/fe310/test/app/app_status.c create mode 100644 fw/fe310/test/app/app_status.h delete mode 100644 fw/fe310/test/status.c delete mode 100644 fw/fe310/test/status.h (limited to 'fw/fe310/test') diff --git a/fw/fe310/test/Makefile b/fw/fe310/test/Makefile index 3b32c73..5e708ed 100644 --- a/fw/fe310/test/Makefile +++ b/fw/fe310/test/Makefile @@ -1,20 +1,24 @@ include ../common.mk -CFLAGS += -I$(bsp_dir)/include -I$(bsp_dir)/drivers -I$(ext_dir)/crypto -LDFLAGS = $(CFLAGS) -L.. -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc -leos -Wl,--end-group -T../bsp/default.lds +CFLAGS += -I$(bsp_dir)/include -I$(bsp_dir)/drivers -I$(ext_dir)/crypto -I$(ext_dir)/fsfat -I$(ecp_dir)/src -I$(ecp_dir)/src/platform/fe310 -I.. +LDFLAGS = app/*.o $(CFLAGS) -L.. -L$(ecp_dir)/build-fe310 -Wl,--gc-sections -nostartfiles -nostdlib -Wl,--start-group -lc -lm -lgcc -leos -lecp -lecpcr -lecptr -lecptm -lecpdir -lecpvconn -Wl,--end-group -T../bsp/default.lds -DEPS = main.o status.o cell_dev.o cell_pdp.o phone.o modem.o wifi.o cam.o audio.o test.o -# DEPS = main.o status.o cell_dev.o cell_pdp.o phone.o modem.o wifi.o cam.o fs.o test.o +DEPS = main.o mem.o cell_dev.o cell_pdp.o phone.o modem.o wifi.o cam.o fs.o ecp.o ecp_init.o audio.o test.o TARGET = phone + all: $(TARGET) +app_: + (cd app && $(MAKE)) || exit; + %.o: %.c $(CC) $(CFLAGS) -c $< -$(TARGET): $(DEPS) +$(TARGET): app_ $(DEPS) $(CC) $(DEPS) $(LDFLAGS) -o $@ clean: + (cd app && $(MAKE) clean) || exit; rm -f *.o *.a $(TARGET) upload: $(TARGET) diff --git a/fw/fe310/test/app/Makefile b/fw/fe310/test/app/Makefile new file mode 100644 index 0000000..fe0ba21 --- /dev/null +++ b/fw/fe310/test/app/Makefile @@ -0,0 +1,15 @@ +include ../../common.mk + +obj = app_root.o app_status.o + + +%.o: %.c %.h + $(CC) $(CFLAGS) -c $< + +%.o: %.S + $(CC) $(CFLAGS) -c $< + +all: $(obj) + +clean: + rm -f *.o diff --git a/fw/fe310/test/app/app_root.c b/fw/fe310/test/app/app_root.c new file mode 100644 index 0000000..7dda3c7 --- /dev/null +++ b/fw/fe310/test/app/app_root.c @@ -0,0 +1,88 @@ +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include "app_status.h" +#include "app_root.h" + +#define KBD_X 0 +#define KBD_Y 575 +#define KBD_W 480 +#define KBD_H 225 + +static EVEKbd kbd; +static EVEFont font; +static EVEWindowRoot win_root; +static EVEWindowKbd win_kbd; +static EVEWindow win_status; +static EVEWindow win_main; +static EVEView view_status; +static EVEViewStack view_stack; + +EVEWindowRoot *app_root(void) { + return &win_root; +} + +void app_root_refresh(void) { + eve_spi_start(); + eve_window_root_draw(app_root()); + eve_spi_stop(); +} + +void app_root_init(eve_view_constructor_t home_page, int b) { + EVERect g; + + eve_spi_start(); + + if (b >= 0) eve_brightness(b); + + eve_font_init(&font, APP_FONT_HANDLE); + + g.x = 0; + g.y = 0; + g.w = APP_SCREEN_W; + g.h = APP_SCREEN_H; + eve_window_init_root(&win_root, &g, "root", &font); + + g.x = KBD_X; + g.y = KBD_Y; + g.w = KBD_W; + g.h = KBD_H; + eve_kbd_init(&kbd, &g, win_root.mem_next, &win_root.mem_next); + eve_window_init_kbd(&win_kbd, &g, &win_root, "kbd", &kbd); + + g.x = 0; + g.y = 0; + g.w = APP_SCREEN_W; + g.h = APP_STATUS_H; + eve_window_init(&win_status, &g, (EVEWindow *)&win_root, "status"); + eve_view_init(&view_status, &win_status, app_status_draw, app_status_touch, NULL, NULL); + + g.x = 0; + g.y = APP_STATUS_H; + g.w = APP_SCREEN_W; + g.h = APP_SCREEN_H - APP_STATUS_H; + eve_window_init(&win_main, &g, (EVEWindow *)&win_root, "main"); + + eve_view_stack_init(&view_stack); + eve_view_create(&win_main, &view_stack, home_page); + + eve_window_append(&win_status); + eve_window_append(&win_main); + + eve_window_root_draw(&win_root); + + eve_spi_stop(); + + eos_net_acquire_for_evt(EOS_EVT_UI | EVE_ETYPE_INTR, 1); +} diff --git a/fw/fe310/test/app/app_root.h b/fw/fe310/test/app/app_root.h new file mode 100644 index 0000000..b085344 --- /dev/null +++ b/fw/fe310/test/app/app_root.h @@ -0,0 +1,12 @@ +#include + +#define APP_SCREEN_W 480 +#define APP_SCREEN_H 800 +#define APP_STATUS_H 60 + +#define APP_FONT_HANDLE 31 + +EVEWindowRoot *app_root(void); +void app_root_refresh(void); + +void app_root_init(eve_view_constructor_t home_page, int b); diff --git a/fw/fe310/test/app/app_status.c b/fw/fe310/test/app/app_status.c new file mode 100644 index 0000000..cc25599 --- /dev/null +++ b/fw/fe310/test/app/app_status.c @@ -0,0 +1,76 @@ +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#include "app_root.h" +#include "app_status.h" + +#include "../phone.h" + +static char status_msg[128]; + +int app_status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) { + unsigned char state = 0; + int8_t touch_idx; + + // state = app_phone_state_get(); + touch_idx = eve_touch_get_idx(touch); + if (touch_idx != 0) return 0; + + 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(); + + buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_ANSWER; + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, 1, 0); + status_msg[0] = '\0'; + } + if ((state != VOICE_STATE_IDLE) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_RIGHT)) { + unsigned char *buf = eos_net_alloc(); + + buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_HANGUP; + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, 1, 0); + status_msg[0] = '\0'; + } + return 1; + } + return 0; +} + +uint8_t app_status_draw(EVEView *view, uint8_t tag0) { + uint8_t tag_opt = EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_XY; + + tag0 = eve_view_clear(view, tag0, tag_opt); + + if (tag0 != EVE_NOTAG) { + eve_touch_set_opt(tag0, eve_touch_get_opt(tag0) | tag_opt); + eve_cmd_dl(TAG(tag0)); + tag0++; + } + + eve_cmd(CMD_TEXT, "hhhhs", 0, 0, 31, 0, status_msg); + + return tag0; +} + +void app_status_msg_set(char *msg, int refresh) { + strcpy(status_msg, msg); + + if (refresh) app_root_refresh(); +} diff --git a/fw/fe310/test/app/app_status.h b/fw/fe310/test/app/app_status.h new file mode 100644 index 0000000..262d29c --- /dev/null +++ b/fw/fe310/test/app/app_status.h @@ -0,0 +1,5 @@ +#include + +int app_status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0); +uint8_t app_status_draw(EVEView *view, uint8_t tag0); +void app_status_msg_set(char *msg, int refresh); diff --git a/fw/fe310/test/cam.c b/fw/fe310/test/cam.c index 9338ae9..766884b 100644 --- a/fw/fe310/test/cam.c +++ b/fw/fe310/test/cam.c @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -19,9 +20,7 @@ #include -#include - -#include +#include "app/app_root.h" #include "cam.h" diff --git a/fw/fe310/test/cell_dev.c b/fw/fe310/test/cell_dev.c index 40f2736..492ba22 100644 --- a/fw/fe310/test/cell_dev.c +++ b/fw/fe310/test/cell_dev.c @@ -7,7 +7,14 @@ #include #include -#include "status.h" +#include +#include +#include +#include + +#include "app/app_root.h" +#include "app/app_status.h" + #include "cell_dev.h" static void cell_dev_handler(unsigned char type, unsigned char *buffer, uint16_t len) { diff --git a/fw/fe310/test/cell_pdp.c b/fw/fe310/test/cell_pdp.c index 9fc4a21..724cca7 100644 --- a/fw/fe310/test/cell_pdp.c +++ b/fw/fe310/test/cell_pdp.c @@ -17,9 +17,9 @@ #include -#include +#include "app/app_root.h" +#include "app/app_status.h" -#include "status.h" #include "cell_pdp.h" static void cell_pdp_connect(char *apn, char *user, char *pass) { @@ -34,17 +34,16 @@ static void cell_pdp_connect(char *apn, char *user, char *pass) { p += strlen(user) + 1; strcpy(p, pass); p += strlen(pass) + 1; - eos_net_send(EOS_NET_MTYPE_CELL, buffer, p - buffer, 1); + eos_net_send(EOS_NET_MTYPE_CELL, buffer, p - buffer); - buffer = eos_net_alloc(); buffer[0] = EOS_CELL_MTYPE_PDP | EOS_CELL_MTYPE_PDP_CONNECT; - eos_net_send(EOS_NET_MTYPE_CELL, buffer, 1, 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buffer, 1, 0); } static void cell_pdp_disconnect(void) { unsigned char *buffer = eos_net_alloc(); buffer[0] = EOS_CELL_MTYPE_PDP | EOS_CELL_MTYPE_PDP_DISCONNECT; - eos_net_send(EOS_NET_MTYPE_CELL, buffer, 1, 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buffer, 1, 0); } static void cell_pdp_handler(unsigned char type, unsigned char *buffer, uint16_t size) { diff --git a/fw/fe310/test/fs.c b/fw/fe310/test/fs.c index e8b3587..222833b 100644 --- a/fw/fe310/test/fs.c +++ b/fw/fe310/test/fs.c @@ -16,7 +16,7 @@ #include #include -#include +#include #include "fs.h" diff --git a/fw/fe310/test/main.c b/fw/fe310/test/main.c index 13c113e..d1409f7 100644 --- a/fw/fe310/test/main.c +++ b/fw/fe310/test/main.c @@ -17,23 +17,24 @@ #include -#include - #include -#include "status.h" +#include "app/app_root.h" + #include "cell_dev.h" #include "cell_pdp.h" #include "phone.h" #include "modem.h" #include "wifi.h" #include "cam.h" -// #include "fs.h" +#include "fs.h" #include "audio.h" +#include "ecp.h" #include "test.h" void app_home_page(EVEWindow *window, EVEViewStack *stack) { EVEWidgetSpec spec[] = { + /* { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, @@ -64,7 +65,6 @@ void app_home_page(EVEWindow *window, EVEViewStack *stack) { .widget.spec.page.title = "Camera", .widget.spec.page.constructor = app_cam }, - /* { .widget.type = EVE_WIDGET_TYPE_PAGE, .widget.g.w = APP_SCREEN_W, @@ -80,21 +80,24 @@ void app_home_page(EVEWindow *window, EVEViewStack *stack) { }, }; - EVEForm *form = eve_form_create(window, stack, spec, 6, NULL, NULL, NULL); + EVEForm *form = eve_form_create(window, stack, spec, 1, NULL, NULL, NULL); } +void print_mem(void); + int main() { eos_init(); printf("FREQ:%lu\n", PRCI_get_cpu_freq()); printf("\nREADY.\n"); app_root_init(app_home_page, 0x20); - app_status_init(); - app_phone_init(); - app_wifi_init(); - app_cell_dev_init(); - app_cell_pdp_init(); + // app_phone_init(); + // app_wifi_init(); + // app_cell_dev_init(); + // app_cell_pdp_init(); // app_fs_init(); - audio_start(); + // audio_start(); + app_ecp_init(); + eos_evtq_loop(); } diff --git a/fw/fe310/test/modem.c b/fw/fe310/test/modem.c index b9fd1b1..89ff32a 100644 --- a/fw/fe310/test/modem.c +++ b/fw/fe310/test/modem.c @@ -19,7 +19,7 @@ #include -#include +#include "app/app_root.h" #include "modem.h" @@ -50,7 +50,7 @@ static void key_down(void *p, int c) { buf[1] = c; } - eos_net_send(EOS_NET_MTYPE_CELL, buf, i, 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, i, 0); eve_text_scroll0(text); } @@ -71,7 +71,7 @@ static void handle_uart(unsigned char type) { i++; if (i == EOS_NET_MTU) break; } - eos_net_send(EOS_NET_MTYPE_CELL, buf, i, 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, i, 0); eos_uart_rxwm_set(0); } @@ -139,7 +139,7 @@ void app_modem(EVEWindow *window, EVEViewStack *stack) { buf = eos_net_alloc(); buf[0] = EOS_CELL_MTYPE_DEV | EOS_CELL_MTYPE_UART_TAKE; - eos_net_send(EOS_NET_MTYPE_CELL, buf, 1, 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, 1, 0); eos_uart_rxwm_set(0); } @@ -152,7 +152,7 @@ void app_modem_close(EVEView *view) { EVEViewStack *stack = param->stack; buf[0] = EOS_CELL_MTYPE_DEV | EOS_CELL_MTYPE_RESET; - eos_net_send(EOS_NET_MTYPE_CELL, buf, 1, 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, 1, 0); eos_uart_rxwm_clear(); eos_uart_set_handler(EOS_UART_ETYPE_RX, NULL); eos_cell_set_handler(EOS_CELL_MTYPE_DEV, param->cell_dev_handler); diff --git a/fw/fe310/test/phone.c b/fw/fe310/test/phone.c index 78531b5..0027d77 100644 --- a/fw/fe310/test/phone.c +++ b/fw/fe310/test/phone.c @@ -18,9 +18,9 @@ #include -#include +#include "app/app_root.h" +#include "app/app_status.h" -#include "status.h" #include "phone.h" #define ABUF_SIZE 128 @@ -41,8 +41,8 @@ static void handle_mic(unsigned char type) { unsigned char *buf = eos_net_alloc(); buf[0] = EOS_CELL_MTYPE_VOICE_PCM; - size = eos_i2s_mic_read(buf+1, MIC_WM); - eos_net_send(EOS_NET_MTYPE_CELL, buf, size+1, 0); + size = eos_i2s_mic_read(buf + 1, MIC_WM); + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, size + 1, 0); } static void cell_voice_handler(unsigned char type, unsigned char *buffer, uint16_t len) { @@ -62,7 +62,11 @@ static void cell_voice_handler(unsigned char type, unsigned char *buffer, uint16 case EOS_CELL_MTYPE_VOICE_BEGIN: printf("VOICE BEGIN\n"); voice_state = VOICE_STATE_CIP; - eos_i2s_start(8000, EOS_I2S_FMT_PCM16); + eos_i2s_mic_init(mic_arr, ABUF_SIZE); + eos_i2s_mic_set_wm(MIC_WM); + eos_i2s_mic_set_handler(handle_mic); + eos_i2s_spk_init(spk_arr, ABUF_SIZE); + eos_i2s_start(8000); break; case EOS_CELL_MTYPE_VOICE_END: @@ -100,7 +104,7 @@ void app_phone_action(EVEForm *form) { buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_DIAL; strcpy(buf + 1, w->str); - eos_net_send(EOS_NET_MTYPE_CELL, buf, 1 + strlen(w->str), 0); + eos_net_send_async(EOS_NET_MTYPE_CELL, buf, 1 + strlen(w->str), 0); voice_state = VOICE_STATE_DIAL; sprintf(msg, "DIAL:%s", w->str); @@ -109,11 +113,6 @@ void app_phone_action(EVEForm *form) { void app_phone_init(void) { eos_cell_set_handler(EOS_CELL_MTYPE_VOICE, cell_voice_handler); - - eos_i2s_mic_init(mic_arr, ABUF_SIZE); - eos_i2s_mic_set_wm(MIC_WM); - eos_i2s_mic_set_handler(handle_mic); - eos_i2s_spk_init(spk_arr, ABUF_SIZE); eos_net_acquire_for_evt(EOS_EVT_I2S | EOS_I2S_ETYPE_MIC, 1); } diff --git a/fw/fe310/test/status.c b/fw/fe310/test/status.c deleted file mode 100644 index 42d193a..0000000 --- a/fw/fe310/test/status.c +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include "phone.h" -#include "status.h" - -static char status_msg[128]; - -static int status_touch(EVEView *view, EVETouch *touch, uint16_t evt, uint8_t tag0) { - unsigned char state = app_phone_state_get(); - int8_t touch_idx = eve_touch_get_idx(touch); - - if (touch_idx != 0) return 0; - - 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(); - - buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_ANSWER; - eos_net_send(EOS_NET_MTYPE_CELL, buf, 1, 0); - status_msg[0] = '\0'; - } - if ((state != VOICE_STATE_IDLE) && (touch->eevt & EVE_TOUCH_EETYPE_TRACK_RIGHT)) { - unsigned char *buf = eos_net_alloc(); - - buf[0] = EOS_CELL_MTYPE_VOICE | EOS_CELL_MTYPE_VOICE_HANGUP; - eos_net_send(EOS_NET_MTYPE_CELL, buf, 1, 0); - status_msg[0] = '\0'; - } - return 1; - } - return 0; -} - -static uint8_t status_draw(EVEView *view, uint8_t tag0) { - uint8_t tag_opt = EVE_TOUCH_OPT_TRACK | EVE_TOUCH_OPT_TRACK_XY; - - tag0 = eve_view_clear(view, tag0, tag_opt); - - if (tag0 != EVE_NOTAG) { - eve_touch_set_opt(tag0, eve_touch_get_opt(tag0) | tag_opt); - eve_cmd_dl(TAG(tag0)); - tag0++; - } - - eve_cmd(CMD_TEXT, "hhhhs", 0, 0, 31, 0, status_msg); - - return tag0; -} - -void app_status_msg_set(char *msg, int refresh) { - strcpy(status_msg, msg); - - if (refresh) app_root_refresh(); -} - -void app_status_init(void) { - EVEWindowRoot *root = app_root(); - EVEWindow *status = eve_window_search(&root->w, "status"); - status->view->touch = status_touch; - status->view->draw = status_draw; -} diff --git a/fw/fe310/test/status.h b/fw/fe310/test/status.h deleted file mode 100644 index c891b7d..0000000 --- a/fw/fe310/test/status.h +++ /dev/null @@ -1,2 +0,0 @@ -void app_status_msg_set(char *msg, int refresh); -void app_status_init(void); diff --git a/fw/fe310/test/test.c b/fw/fe310/test/test.c index 9cf7605..fddbbc1 100644 --- a/fw/fe310/test/test.c +++ b/fw/fe310/test/test.c @@ -4,6 +4,7 @@ #include #include + #include #include #include @@ -16,14 +17,10 @@ #include -#include - -#include +#include "app/app_root.h" #include "test.h" -#include - static int reg_read(uint8_t reg, uint8_t *data) { return eos_i2c_read8(BQ25895_ADDR, reg, data, 1); } diff --git a/fw/fe310/test/wifi.c b/fw/fe310/test/wifi.c index 814d808..e7522e3 100644 --- a/fw/fe310/test/wifi.c +++ b/fw/fe310/test/wifi.c @@ -17,41 +17,12 @@ #include -#include +#include "app/app_root.h" +#include "app/app_status.h" -#include "status.h" #include "wifi.h" -static void wifi_scan(void) { - unsigned char *buffer = eos_net_alloc(); - buffer[0] = EOS_WIFI_MTYPE_SCAN; - eos_net_send(EOS_NET_MTYPE_WIFI, buffer, 1, 0); -} - -static void wifi_connect(const char *ssid, const char *pass) { - unsigned char *buffer, *p; - - buffer = eos_net_alloc(); - buffer[0] = EOS_WIFI_MTYPE_CONFIG; - p = buffer + 1; - strcpy(p, ssid); - p += strlen(ssid) + 1; - strcpy(p, pass); - p += strlen(pass) + 1; - eos_net_send(EOS_NET_MTYPE_WIFI, buffer, p - buffer, 1); - - buffer = eos_net_alloc(); - buffer[0] = EOS_WIFI_MTYPE_CONNECT; - eos_net_send(EOS_NET_MTYPE_WIFI, buffer, 1, 0); -} - -static void wifi_disconnect(void) { - unsigned char *buffer = eos_net_alloc(); - buffer[0] = EOS_WIFI_MTYPE_DISCONNECT; - eos_net_send(EOS_NET_MTYPE_WIFI, buffer, 1, 0); -} - -void wifi_scan_handler(unsigned char type, unsigned char *buffer, uint16_t size) { +static void wifi_scan_handler(unsigned char type, unsigned char *buffer, uint16_t size) { EVEWindowRoot *root = app_root(); EVEWindow *window = eve_window_search(&root->w, "main"); EVEForm *form = (EVEForm *)window->view; @@ -97,7 +68,7 @@ void app_wifi(EVEWindow *window, EVEViewStack *stack) { }; EVEForm *form = eve_form_create(window, stack, spec, 3, NULL, app_wifi_action, app_wifi_close); - wifi_scan(); + eos_wifi_scan(NULL); } void app_wifi_action(EVEForm *form) { @@ -105,7 +76,10 @@ void app_wifi_action(EVEForm *form) { EVEStrWidget *str = (EVEStrWidget *)eve_page_widget(&form->p, 2); char *ssid = eve_selectw_option_get_select(sel); - if (ssid) wifi_connect(ssid, str->str); + if (ssid) { + eos_wifi_auth(ssid, str->str, NULL); + eos_wifi_connect(NULL); + } } void app_wifi_close(EVEForm *form) { -- cgit v1.2.3