Commit f6f543a39acf377db334595a4551d5514d81ee72
1 parent
3f194d1a
--no commit message
Showing
2 changed files
with
61 additions
and
0 deletions
Project/applications/smartcities/include/json.h
0 → 100644
1 | +#ifndef JSON_H | |
2 | +#define JSON_H | |
3 | + | |
4 | +#define JSON_POST_OK 0 | |
5 | +#define JSON_COMM_ERROR 1 | |
6 | +#define JSON_OTHER_ERROR 2 | |
7 | + | |
8 | +char* prepare_json_statement(char* data, uint32_t length); | |
9 | +char* prepare_observation(char* observation, uint32_t length); | |
10 | +uint8_t send_json(char* statement, uint32_t length); | |
11 | +uint32_t find_next_index(char* string, uint32_t length, char delimiter); | |
12 | +char* join_strings(char* str1, char* str2, uint32_t len1, uint32_t len2) | |
13 | + | |
14 | +#endif | |
... | ... |
Project/applications/smartcities/json.c
0 → 100644
1 | +char* prepare_json_statement(char* data, uint32_t length) | |
2 | +{ | |
3 | + | |
4 | +} | |
5 | + | |
6 | +char* prepare_observation(char* observation, uint32_t length) | |
7 | +{ | |
8 | + | |
9 | +} | |
10 | + | |
11 | +uint8_t send_json(char* statement, uint32_t length) | |
12 | +{ | |
13 | + //CHECK CONNECTIVITY | |
14 | + //RETURN JSON_COMM_ERROR | |
15 | + //PREPARE HTTP POST | |
16 | + //SEND POST | |
17 | + //RETURN JSON_OTHER_ERROR | |
18 | + //RETURN JSON_POST_OK | |
19 | +} | |
20 | + | |
21 | +uint32_t find_next_index(char* string, uint32_t length, char delimiter) | |
22 | +{ | |
23 | + unsigned int i; | |
24 | + for(i = 0; i < length; i++) | |
25 | + { | |
26 | + if(char[i] == delimiter) | |
27 | + { | |
28 | + return i; | |
29 | + } | |
30 | + } | |
31 | + return -1; | |
32 | +} | |
33 | + | |
34 | +char* join_strings(char* str1, char* str2, uint32_t len1, uint32_t len2) | |
35 | +{ | |
36 | + char* str = (char*) chHeapAlloc(NULL,len1+len2+1); | |
37 | + /*strcat(str,str1); | |
38 | + strcat(str,str2); | |
39 | + USAR STRNCAT | |
40 | + */ | |
41 | + | |
42 | +} | |
43 | + | |
44 | +/* | |
45 | +chHeapAlloc(NULL,size) | |
46 | +chHeapFree(ptr) | |
47 | +*/ | |
0 | 48 | \ No newline at end of file |
... | ... |