Commit c71d0ff571148c66f0e56e66ab68482206226489

Authored by Imanol-Mikel Barba Sabariego
1 parent 8450820a

--no commit message

Project/applications/smartcities/include/globals.h
1 #ifndef GLOBALS_H 1 #ifndef GLOBALS_H
2 #define GLOBALS_H 2 #define GLOBALS_H
3 3
4 -#define SERVER_IP "10.0.60.241" 4 +#define SERVER_IP "147.83.39.240"
5 #define SERVER_HOSTNAME SERVER_IP 5 #define SERVER_HOSTNAME SERVER_IP
6 #define MODULE_ID_LENGTH 6 6 #define MODULE_ID_LENGTH 6
7 #define BUFFER_LENGTH 30 7 #define BUFFER_LENGTH 30
8 #define MAX_RAM 30000 8 #define MAX_RAM 30000
9 #define MODULE_ID "123456" 9 #define MODULE_ID "123456"
10 10
11 -#endif  
12 \ No newline at end of file 11 \ No newline at end of file
  12 +#endif
Project/applications/smartcities/json.c
@@ -128,13 +128,11 @@ uint8_t send_json(char* statement, uint32_t length, char* provider_ID, char* sen @@ -128,13 +128,11 @@ uint8_t send_json(char* statement, uint32_t length, char* provider_ID, char* sen
128 URL = (char*) chHeapAlloc(NULL,1+strlen(SERVER_HOSTNAME)); 128 URL = (char*) chHeapAlloc(NULL,1+strlen(SERVER_HOSTNAME));
129 strcpy(URL,SERVER_HOSTNAME); 129 strcpy(URL,SERVER_HOSTNAME);
130 //VANILLA SERVER (SENTILO) 130 //VANILLA SERVER (SENTILO)
131 - PATH = (char*) chHeapAlloc(NULL,19);  
132 - strcpy(PATH,"/catalog/register");  
133 - //FUCKING LEWIS...  
134 - //TODO  
135 /*PATH = (char*) chHeapAlloc(NULL,19); 131 /*PATH = (char*) chHeapAlloc(NULL,19);
136 - strcpy(PATH,"/catalog/register");  
137 - */ 132 + strcpy(PATH,"/catalog/register");*/
  133 + //FUCKING LEWIS...
  134 + PATH = (char*) chHeapAlloc(NULL,50);
  135 + strcpy(PATH,"/modularsense/wordpress/opendata/catalog/register");
138 } 136 }
139 else //Post data 137 else //Post data
140 { 138 {
@@ -142,19 +140,18 @@ uint8_t send_json(char* statement, uint32_t length, char* provider_ID, char* sen @@ -142,19 +140,18 @@ uint8_t send_json(char* statement, uint32_t length, char* provider_ID, char* sen
142 strcpy(URL,SERVER_HOSTNAME); 140 strcpy(URL,SERVER_HOSTNAME);
143 URL[strlen(SERVER_HOSTNAME)] = '\0'; 141 URL[strlen(SERVER_HOSTNAME)] = '\0';
144 //VANILLA SERVER (SENTILO) 142 //VANILLA SERVER (SENTILO)
145 - PATH = (char*) chHeapAlloc(NULL,22+strlen(provider_ID)+strlen(sensor_ID)); 143 + /*PATH = (char*) chHeapAlloc(NULL,22+strlen(provider_ID)+strlen(sensor_ID));
146 strcpy(PATH,"/data/modularupload/"); 144 strcpy(PATH,"/data/modularupload/");
147 strcpy(PATH+20,provider_ID); 145 strcpy(PATH+20,provider_ID);
148 - strcpy(PATH+20+strlen(provider_ID),sensor_ID); 146 + strcpy(PATH+20+strlen(provider_ID),sensor_ID);*/
149 //PATH[21+strlen(provider_ID)+strlen(sensor_ID)] = '\0'; 147 //PATH[21+strlen(provider_ID)+strlen(sensor_ID)] = '\0';
150 148
151 //FUCKING LEWIS... 149 //FUCKING LEWIS...
152 - //TODO  
153 - /*PATH = (char*) chHeapAlloc(NULL,22+strlen(provider_ID)+strlen(sensor_ID));  
154 - strcpy(PATH,"/data/modularupload/");  
155 - strcpy(PATH+20,provider_ID);  
156 - strcpy(PATH+20+strlen(provider_ID),sensor_ID);  
157 - PATH[21+strlen(provider_ID)+strlen(sensor_ID)] = '\0';*/ 150 + PATH = (char*) chHeapAlloc(NULL,54+strlen(provider_ID)+strlen(sensor_ID));
  151 + strcpy(PATH,"/modularsense/wordpress/opendata/data/modularupload/");
  152 + strcpy(PATH+52,provider_ID);
  153 + strcpy(PATH+52+strlen(provider_ID),sensor_ID);
  154 + //PATH[53+strlen(provider_ID)+strlen(sensor_ID)] = '\0';
158 } 155 }
159 struct httpHeaders server = { put,PATH,strlen(PATH),URL,strlen(URL)}; 156 struct httpHeaders server = { put,PATH,strlen(PATH),URL,strlen(URL)};
160 response_code = httpRequest(server, statement, length); 157 response_code = httpRequest(server, statement, length);