2024-09-28 14:35:05 +00:00
|
|
|
/**
|
|
|
|
* Synchronisation response
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <cJSON.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct sync_response
|
|
|
|
{
|
|
|
|
size_t len;
|
|
|
|
bool relays[];
|
|
|
|
} sync_response;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decode synchronize response from server
|
|
|
|
*/
|
|
|
|
sync_response *sync_response_parse(cJSON *res);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Print synchronize reponse content
|
|
|
|
*/
|
|
|
|
void sync_response_print(sync_response *res);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free memory allocated for synchronize response
|
|
|
|
*/
|
|
|
|
void sync_response_free(sync_response *res);
|
|
|
|
|
2024-09-28 18:02:34 +00:00
|
|
|
/**
|
|
|
|
* Check the desired status of a relay
|
|
|
|
*/
|
|
|
|
bool sync_response_is_relay_on(sync_response *res, int relay_number);
|
|
|
|
|
2024-09-28 14:35:05 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|