Commit 0522f994cd37f453ea98fdd1b91dbc1dba2b4b1a

Authored by Maria Jorba Brosa
1 parent 4983f340

--no commit message

Project/applications/smartcities/include/globals.h
... ... @@ -4,5 +4,6 @@
4 4 #define SERVER_IP "10.0.60.241"
5 5 #define SERVER_HOSTNAME SERVER_IP
6 6 #define MODULE_ID_LENGTH 6
  7 +#define BUFFER_LENGTH 30
7 8  
8 9 #endif
9 10 \ No newline at end of file
... ...
Project/applications/smartcities/main.c
... ... @@ -4,6 +4,7 @@
4 4 #include "globals.h"
5 5 #include "httpClient.h"
6 6 #include "callbacks.h"
  7 +#include "Buffer.h"
7 8  
8 9 #define WIFI_MODE WIFI_MODE_CLIENT
9 10 #define NETWORK_SSID "linksys"
... ... @@ -19,6 +20,9 @@ void initLibwismart(void)
19 20  
20 21 int main(void)
21 22 {
  23 + uint32_t* ind=0;
  24 + char **buffer;
  25 + buffer = malloc (sizeof (char *) * BUFFER_LENGTH);
22 26 struct wpa_param wpa;
23 27 wpa.eap_method = WISMART_EAP_METHOD_TTLS;
24 28 wpa.u.ttls.identity=WPA_USER;
... ... @@ -48,6 +52,26 @@ int main(void)
48 52  
49 53 for(;;)
50 54 {
  55 + // i2c get info= data
  56 + put_message(data, buffer ,&ind);
  57 + int res=check_memory();
  58 + if(res==SOFT_REACHED){
  59 +
  60 + int ok=send(buffer, ind, char *provider_ID, char *sensor_ID);
  61 + if(ok==JSON_COMM_ERROR)
  62 + {
  63 + printf("wismart is not connected\r\n");
  64 + }
  65 + else if( ok==JSON_OTHER_ERROR){
  66 + printf("some error ocurred\r\n");
  67 + }
  68 + else if(ok ==JSON_POST_OK){
  69 + printf(" send OK \r\n");
  70 + }
  71 + }
  72 + else if(res==HARD_REACHED){
  73 + //destroy
  74 + }
51 75 chThdSleepMilliseconds(500);
52 76 }
53 77 }
... ...