Commit 410c7b6655582b2c7d1e98758004ac4082614d5e
1 parent
9817abe7
Añadidos comentarios sobre el código
Showing
2 changed files
with
19 additions
and
6 deletions
Project/applications/smartcities/httpClient.c
... | ... | @@ -40,6 +40,13 @@ int httpRequest(struct httpHeaders head, char* content, int content_size) |
40 | 40 | // Build request head |
41 | 41 | printf("httpRequest: Building request head\r\n"); |
42 | 42 | int request_size = head_size + content_size + 2*(sizeof ENDL) + sizeof '\0'; |
43 | + /* WARNING | |
44 | + * | |
45 | + * 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 | |
46 | + * 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 | |
47 | + * | |
48 | + * --Imanol | |
49 | + */ | |
43 | 50 | request = (char *) malloc(request_size); |
44 | 51 | strcpy(request, reqMethod2text(head.method)); |
45 | 52 | strcat(request, " "); | ... | ... |
Project/applications/smartcities/main.c
... | ... | @@ -24,10 +24,12 @@ void dhcp_connect_result_cb(int result) |
24 | 24 | libwismart_GetCurrentIP(&ip,NULL,NULL); |
25 | 25 | printf("IP: %d.%d.%d.%d \r\n",ip.addr[3],ip.addr[2],ip.addr[1],ip.addr[0]); |
26 | 26 | } |
27 | - else if(result==LIBWISMART_DHCP_TIMEOUT){ | |
27 | + else if(result==LIBWISMART_DHCP_TIMEOUT) | |
28 | + { | |
28 | 29 | printf("DHCP timeout\r\n"); |
29 | 30 | } |
30 | - else{ | |
31 | + else | |
32 | + { | |
31 | 33 | printf("DHCP error\r\n"); |
32 | 34 | } |
33 | 35 | |
... | ... | @@ -57,13 +59,17 @@ int main(void) |
57 | 59 | libwismart_RegisterDhcpCB(dhcp_connect_result_cb); |
58 | 60 | |
59 | 61 | libwismart_WiFiInit(); |
62 | + | |
63 | + /* erase me | |
64 | + * | |
65 | + * ¿Qué significa este comentario? | |
66 | + * | |
67 | + * --Imanol | |
68 | + */ | |
69 | + | |
60 | 70 | //falta definir les variables de la xarxa |
61 | 71 | libwismart_WiFiConnectEnterprise(NETWORK_SSID, &wpa, wifi_connect_result_cb); |
62 | 72 | |
63 | - //tcpClient_init(); | |
64 | - | |
65 | - //tcpClient_establishConnectionL(SERVER_IP, SERVER_PORT); | |
66 | - | |
67 | 73 | //int httpRequest(struct httpHeaders head, char* content, int content_size) |
68 | 74 | httpRequest(head200, NULL, 0); |
69 | 75 | httpRequest(head301, NULL, 0); | ... | ... |