/* ============================================================================= * jsonbody.h - 서버로 보낼 요청 본문(JSON) 생성 * * raw-body 서명을 쓰므로 본문은 "유효한 JSON"이기만 하면 되고, 서버가 받은 * 바이트 그대로 서명을 검증한다. 따라서 키 정렬/PHP json_encode 포맷 재현이 * 불필요하다. (단, 서명한 본문 바이트와 실제 전송 바이트는 100% 동일해야 한다.) * * RPi 대응: * jb_sht30_event <- sht30_monitor.py post_reading() data * ===========================================================================*/ #ifndef JSONBODY_H #define JSONBODY_H #include #include /* SHT30 보드 이벤트 본문. temperature_c/humidity_percent 는 소수 2자리로 * 직렬화된다. 반환값: 기록한 길이(NUL 제외), 버퍼 부족 시 -1. */ int jb_sht30_event(char *out, size_t cap, const char *device_id, const char *device_location, int sensor_id, const char *sensor_name, const char *event_type, uint32_t timestamp, double temperature_c, double humidity_percent, const char *metric_status, const char *app_version); #endif /* JSONBODY_H */