From 5aef0b621b3e8854479ea5d95970acd4666c5f19 Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Wed, 26 Mar 2014 23:38:24 +0000 Subject: [PATCH] --- Project/applications/smartcities/callbacks.c | 25 +++++++++++++++++++++++++ Project/applications/smartcities/include/callbacks.h | 9 +++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) create mode 100644 Project/applications/smartcities/callbacks.c create mode 100644 Project/applications/smartcities/include/callbacks.h diff --git a/Project/applications/smartcities/callbacks.c b/Project/applications/smartcities/callbacks.c new file mode 100644 index 0000000..c44fee6 --- /dev/null +++ b/Project/applications/smartcities/callbacks.c @@ -0,0 +1,25 @@ +#include "callbacks.h" + +void dhcp_connect_result_cb(int result) +{ + libwismart_ip_addr_t ip; + if(result==LIBWISMART_DHCP_ADDRESS_ASSIGNED) + { + libwismart_GetCurrentIP(&ip,NULL,NULL); + printf("IP: %d.%d.%d.%d \r\n",ip.addr[3],ip.addr[2],ip.addr[1],ip.addr[0]); + } + else if(result==LIBWISMART_DHCP_TIMEOUT) + { + printf("DHCP timeout\r\n"); + } + else + { + printf("DHCP error\r\n"); + } + +} + +void wifi_connect_result_cb(int result) +{ + printf("WiFi Connect indication: %s\r\n", (result == WISMART_WIFI_CONNECTED) ? "Connected": "Failed\r\n"); +} \ No newline at end of file diff --git a/Project/applications/smartcities/include/callbacks.h b/Project/applications/smartcities/include/callbacks.h new file mode 100644 index 0000000..b3d2b21 --- /dev/null +++ b/Project/applications/smartcities/include/callbacks.h @@ -0,0 +1,9 @@ +#ifndef MODULE_H +#define MODULE_H + +#include "libwismart.h" + +void dhcp_connect_result_cb(int result); +void wifi_connect_result_cb(int result); + +#endif \ No newline at end of file -- libgit2 0.22.2