json.h
984 Bytes
#ifndef JSON_H
#define JSON_H
#include <string.h>
#include <stdint.h>
#include "globals.h"
#include "sensors.h"
#include "module.h"
#include <string.h>
#include <stdio.h>
#include "libwismart.h"
#include "httpClient.h"
#define JSON_POST_OK 0
#define JSON_COMM_ERROR 1
#define JSON_OTHER_ERROR 2
#define JOIN_NO_FREE 0
#define JOIN_FREE_MEM 1
#define DBG_JSON(fmt,...) printf("%c[1;35mjson.c:%c[1;00m "fmt,0x1B,0x1B, ##__VA_ARGS__)
uint8_t register_sensor(sensor sens);
char* prepare_json_observation_statement(char** data, uint32_t nObservations);
char* prepare_json_register_statement(module mod, sensor sens, char *additional_info);
char* prepare_observation(char* observation, uint32_t length);
uint8_t send_json(char* statement, uint32_t length, char* provider_ID, char* sensor_ID);
uint32_t find_next_index(char* string, uint32_t length, char delimiter);
char* join_strings(char* str1, char* str2, uint32_t len1, uint32_t len2, uint8_t free_mem);
#endif