From d85dea2d7efa9410be101fc955ba48627138951e Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Mon, 31 Mar 2014 15:33:05 +0000 Subject: [PATCH] --- Project/applications/smartcities/main.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/Project/applications/smartcities/main.c b/Project/applications/smartcities/main.c index 0c14ab8..8e00aae 100644 --- a/Project/applications/smartcities/main.c +++ b/Project/applications/smartcities/main.c @@ -3,6 +3,7 @@ #include "lwip/inet.h" #include "globals.h" #include "httpClient.h" +#include "callbacks.h" #define WIFI_MODE WIFI_MODE_CLIENT #define NETWORK_SSID "linksys" @@ -16,28 +17,6 @@ void initLibwismart(void) libwismart_Init(hwif); } -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"); -} - int main(void) { struct wpa_param wpa; @@ -58,19 +37,15 @@ int main(void) libwismart_WiFiInit(); //falta definir les variables de la xarxa - libwismart_WiFiConnectEnterprise(NETWORK_SSID, &wpa, wifi_connect_result_cb); - - //tcpClient_init(); - - //tcpClient_establishConnectionL(SERVER_IP, SERVER_PORT); + libwismart_WiFiConnectEnterprise(NETWORK_SSID, &wpa, wifii_connect_result_cb); //int httpRequest(struct httpHeaders head, char* content, int content_size) - chThdSleepMilliseconds(5000); + //chThdSleepMilliseconds(5000); - httpRequest(head200, NULL, 0); + //httpRequest(head200, NULL, 0); /*httpRequest(head301, NULL, 0); httpRequest(head404, NULL, 0);*/ - + for(;;) { chThdSleepMilliseconds(500); -- libgit2 0.22.2