From 410c7b6655582b2c7d1e98758004ac4082614d5e Mon Sep 17 00:00:00 2001 From: Imanol-Mikel Barba Sabariego Date: Wed, 26 Mar 2014 21:46:52 +0000 Subject: [PATCH] Añadidos comentarios sobre el código --- Project/applications/smartcities/httpClient.c | 7 +++++++ Project/applications/smartcities/main.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Project/applications/smartcities/httpClient.c b/Project/applications/smartcities/httpClient.c index 92c64f4..79cbccf 100644 --- a/Project/applications/smartcities/httpClient.c +++ b/Project/applications/smartcities/httpClient.c @@ -40,6 +40,13 @@ int httpRequest(struct httpHeaders head, char* content, int content_size) // Build request head printf("httpRequest: Building request head\r\n"); int request_size = head_size + content_size + 2*(sizeof ENDL) + sizeof '\0'; + /* WARNING + * + * 1. Te has olvidado el free de liberar memoria. Es SÚPER IMPORTANTE no dejar memoria sin liberar por que genera memory leaks y no vamos sobraos de ram + * 2. Recuerda cambiarlo luego a chHeapAlloc y chHeapFree, yo suelo hacerme unos .c's aparte en mi carpeta para no mezclar código de prueba con código de la repo, pero mientras luego lo cambies cap problema + * + * --Imanol + */ request = (char *) malloc(request_size); strcpy(request, reqMethod2text(head.method)); strcat(request, " "); diff --git a/Project/applications/smartcities/main.c b/Project/applications/smartcities/main.c index 1d6265b..53c6800 100644 --- a/Project/applications/smartcities/main.c +++ b/Project/applications/smartcities/main.c @@ -24,10 +24,12 @@ void dhcp_connect_result_cb(int result) 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){ + else if(result==LIBWISMART_DHCP_TIMEOUT) + { printf("DHCP timeout\r\n"); } - else{ + else + { printf("DHCP error\r\n"); } @@ -57,13 +59,17 @@ int main(void) libwismart_RegisterDhcpCB(dhcp_connect_result_cb); libwismart_WiFiInit(); + + /* erase me + * + * ¿Qué significa este comentario? + * + * --Imanol + */ + //falta definir les variables de la xarxa libwismart_WiFiConnectEnterprise(NETWORK_SSID, &wpa, wifi_connect_result_cb); - //tcpClient_init(); - - //tcpClient_establishConnectionL(SERVER_IP, SERVER_PORT); - //int httpRequest(struct httpHeaders head, char* content, int content_size) httpRequest(head200, NULL, 0); httpRequest(head301, NULL, 0); -- libgit2 0.22.2