summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/wifi.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-02-24 19:50:20 +0100
committerUros Majstorovic <majstor@majstor.org>2021-02-24 19:50:20 +0100
commit3050565531af2b3a09f2213893f10c64cf9fe43f (patch)
tree689d10ca064dba4480a85b6ec14a4eb8305d5c89 /fw/fe310/eos/wifi.c
parentd0a0fee0571be63f023f8f6a49a0b76b89871e56 (diff)
added test app with voice, wifi/cellular data connectivity examples
Diffstat (limited to 'fw/fe310/eos/wifi.c')
-rw-r--r--fw/fe310/eos/wifi.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fw/fe310/eos/wifi.c b/fw/fe310/eos/wifi.c
index 6d39332..c3449e8 100644
--- a/fw/fe310/eos/wifi.c
+++ b/fw/fe310/eos/wifi.c
@@ -10,7 +10,7 @@
static eos_evt_handler_t evt_handler[EOS_WIFI_MAX_MTYPE];
-static void wifi_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) {
+static void wifi_handle_msg(unsigned char type, unsigned char *buffer, uint16_t len) {
unsigned char mtype;
if ((buffer == NULL) || (len < 1)) {
@@ -32,13 +32,24 @@ void eos_wifi_init(void) {
for (i=0; i<EOS_WIFI_MAX_MTYPE; i++) {
evt_handler[i] = NULL;
}
- eos_net_set_handler(EOS_NET_MTYPE_WIFI, wifi_handle_evt);
+ eos_net_set_handler(EOS_NET_MTYPE_WIFI, wifi_handle_msg);
}
void eos_wifi_set_handler(unsigned char mtype, eos_evt_handler_t handler) {
if (mtype < EOS_WIFI_MAX_MTYPE) evt_handler[mtype] = handler;
}
+eos_evt_handler_t eos_wifi_get_handler(unsigned char mtype) {
+ if (mtype < EOS_WIFI_MAX_MTYPE) return evt_handler[mtype];
+ return NULL;
+}
+
+void eos_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);
+}
+
void eos_wifi_connect(const char *ssid, const char *pass) {
int ssid_len = strlen(ssid);
int pass_len = strlen(pass);