Files
uvr67_multical603_wifi_logger/main/mqtt_service/mqtt_protocol.c
2026-06-12 21:45:31 +02:00

43 lines
790 B
C

/*
* mqtt_protocol.c
*
* Created on: 28 May 2026
* Author: Christian Lind Vie Madsen
*/
#include "mqtt_protocol.h"
char *topics[5] = {
};
void mqtt_protocol_GenerateTopic(char *buf, size_t size, mqtt_protocol_msg_t msg_type){
snprintf(buf, size,"SV/v1/1234/%d",msg_type+1);
}
void mqtt_protocol_heartbeat(char *buf,
size_t size,
const char *trailerId,
const char *timestamp,
const char *lat,
const char *lon)
{
snprintf(buf, size,
"{"
"\"timestamp\":\"%s\","
"\"location\":{"
"\"latitude\":\"%s\","
"\"longitude\":\"%s\""
"}"
"}",
timestamp,
lat,
lon
);
}