feat: reporter — HMAC-signed hourly POST with 24-record offline buffer

Fix Arduino String .size() → .length() in hmac.cpp (pre-existing bug surfaced by compilation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-14 06:28:24 -07:00
parent 6422e052df
commit 244426ec8b
3 changed files with 155 additions and 5 deletions

20
firmware/src/reporter.h Normal file
View File

@@ -0,0 +1,20 @@
// firmware/src/reporter.h
#pragma once
#include <Arduino.h>
#include "config.h"
#include "ble_scanner.h"
struct CameraHourlyRecord {
uint32_t period_start;
uint32_t period_end;
int entries;
int exits;
};
static const int REPORTER_MAX_BUFFER = 24;
static const char* REPORTER_API_HOST = "https://logs.research.bike";
void reporter_submit_camera(const DeviceConfig& cfg, const CameraHourlyRecord& rec);
void reporter_submit_ble(const DeviceConfig& cfg, const BLEHourlyRecord& rec);
void reporter_heartbeat(const DeviceConfig& cfg, uint32_t uptime_s, int wifi_rssi);
void reporter_flush(const DeviceConfig& cfg);