Commit d85dea2d7efa9410be101fc955ba48627138951e

Authored by Imanol-Mikel Barba Sabariego
1 parent e7bbd554

--no commit message

Project/applications/smartcities/main.c
... ... @@ -3,6 +3,7 @@
3 3 #include "lwip/inet.h"
4 4 #include "globals.h"
5 5 #include "httpClient.h"
  6 +#include "callbacks.h"
6 7  
7 8 #define WIFI_MODE WIFI_MODE_CLIENT
8 9 #define NETWORK_SSID "linksys"
... ... @@ -16,28 +17,6 @@ void initLibwismart(void)
16 17 libwismart_Init(hwif);
17 18 }
18 19  
19   -void dhcp_connect_result_cb(int result)
20   -{
21   - libwismart_ip_addr_t ip;
22   - if(result==LIBWISMART_DHCP_ADDRESS_ASSIGNED)
23   - {
24   - libwismart_GetCurrentIP(&ip,NULL,NULL);
25   - printf("IP: %d.%d.%d.%d \r\n",ip.addr[3],ip.addr[2],ip.addr[1],ip.addr[0]);
26   - }
27   - else if(result==LIBWISMART_DHCP_TIMEOUT){
28   - printf("DHCP timeout\r\n");
29   - }
30   - else{
31   - printf("DHCP error\r\n");
32   - }
33   -
34   -}
35   -
36   -void wifi_connect_result_cb(int result)
37   -{
38   - printf("WiFi Connect indication: %s\r\n", (result == WISMART_WIFI_CONNECTED) ? "Connected": "Failed\r\n");
39   -}
40   -
41 20 int main(void)
42 21 {
43 22 struct wpa_param wpa;
... ... @@ -58,19 +37,15 @@ int main(void)
58 37  
59 38 libwismart_WiFiInit();
60 39 //falta definir les variables de la xarxa
61   - libwismart_WiFiConnectEnterprise(NETWORK_SSID, &wpa, wifi_connect_result_cb);
62   -
63   - //tcpClient_init();
64   -
65   - //tcpClient_establishConnectionL(SERVER_IP, SERVER_PORT);
  40 + libwismart_WiFiConnectEnterprise(NETWORK_SSID, &wpa, wifii_connect_result_cb);
66 41  
67 42 //int httpRequest(struct httpHeaders head, char* content, int content_size)
68   - chThdSleepMilliseconds(5000);
  43 + //chThdSleepMilliseconds(5000);
69 44  
70   - httpRequest(head200, NULL, 0);
  45 + //httpRequest(head200, NULL, 0);
71 46 /*httpRequest(head301, NULL, 0);
72 47 httpRequest(head404, NULL, 0);*/
73   -
  48 +
74 49 for(;;)
75 50 {
76 51 chThdSleepMilliseconds(500);
... ...