Commit 232c771364521f1ddea8b219595993dbab1a1519
1 parent
62657921
--no commit message
Showing
1 changed file
with
4 additions
and
22 deletions
Project/applications/smartcities/main2.c
@@ -85,7 +85,7 @@ void init_registry(void) | @@ -85,7 +85,7 @@ void init_registry(void) | ||
85 | 85 | ||
86 | } | 86 | } |
87 | 87 | ||
88 | -void send_data() | 88 | +void send_data(char** buffers[j], uint32_t ind[], uint32_t sizes[j], uint8_t sensors[]); |
89 | { | 89 | { |
90 | int j; | 90 | int j; |
91 | for(j=0;j<TOTAL_SENSORS;j++) | 91 | for(j=0;j<TOTAL_SENSORS;j++) |
@@ -190,30 +190,14 @@ int main(void) | @@ -190,30 +190,14 @@ int main(void) | ||
190 | printf("timestamp (absolute):\t%d\r\ntimestamp mod LONG_PERIOD:\t%d\r\ntimestamp mod SHORT_PERIOD:\t%d\r\n",timestamp,timestamp%LONG_PERIOD,timestamp%SHORT_PERIOD); | 190 | printf("timestamp (absolute):\t%d\r\ntimestamp mod LONG_PERIOD:\t%d\r\ntimestamp mod SHORT_PERIOD:\t%d\r\n",timestamp,timestamp%LONG_PERIOD,timestamp%SHORT_PERIOD); |
191 | 191 | ||
192 | /* Add data to the buffer with timestamp*/ | 192 | /* Add data to the buffer with timestamp*/ |
193 | + | ||
194 | + //a_cookedData = format_data(a_rawData, timestamp); | ||
193 | put_buffers(buffers,ind,sizes,valueSensors); | 195 | put_buffers(buffers,ind,sizes,valueSensors); |
194 | printf("mirant memoria\r\n"); | 196 | printf("mirant memoria\r\n"); |
195 | int res=check_memory(); | 197 | int res=check_memory(); |
196 | if(res==SOFT_REACHED){ | 198 | if(res==SOFT_REACHED){ |
197 | printf("--------------soft limit-------------\r\n"); | 199 | printf("--------------soft limit-------------\r\n"); |
198 | - int j; | ||
199 | - for(j=0;j<TOTAL_SENSORS;j++) | ||
200 | - { | ||
201 | - printf(" enviant buffer %d\r\n",j); | ||
202 | - | ||
203 | - // fem servir 085 de prova, però haurem de fer servir sensor_id[j] | ||
204 | - int ok=send(buffers[j],&ind[j],&sizes[j], mod.ID, sensor_id[j]); | ||
205 | - | ||
206 | - if(ok==JSON_COMM_ERROR) | ||
207 | - { | ||
208 | - printf("wismart is not connected\r\n"); | ||
209 | - } | ||
210 | - else if( ok==JSON_OTHER_ERROR){ | ||
211 | - printf("some error ocurred\r\n"); | ||
212 | - } | ||
213 | - else if(ok ==JSON_POST_OK){ | ||
214 | - printf(" send OK \r\n"); | ||
215 | - } | ||
216 | - } | 200 | + send_data(); |
217 | } | 201 | } |
218 | else if(res==HARD_REACHED){ | 202 | else if(res==HARD_REACHED){ |
219 | printf("--------------hard limit-------------\r\n"); | 203 | printf("--------------hard limit-------------\r\n"); |
@@ -247,8 +231,6 @@ int main(void) | @@ -247,8 +231,6 @@ int main(void) | ||
247 | } | 231 | } |
248 | } | 232 | } |
249 | } | 233 | } |
250 | - //a_cookedData = format_data(a_rawData, timestamp); | ||
251 | - | ||
252 | time += getElapsedTime(delay); | 234 | time += getElapsedTime(delay); |
253 | printf("time (absolute):\t%d\r\ntime mod LONG_PERIOD:\t%d\r\ntime mod SHORT_PERIOD:\t%d\r\n",time,time%LONG_PERIOD,time%SHORT_PERIOD); | 235 | printf("time (absolute):\t%d\r\ntime mod LONG_PERIOD:\t%d\r\ntime mod SHORT_PERIOD:\t%d\r\n",time,time%LONG_PERIOD,time%SHORT_PERIOD); |
254 | 236 |