forked from gary/BCU
2
0
Fork 0
BCU/app/stm32fxxx_app/protocol/protocol_mqtt_bcu.h

47 lines
1.4 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************************************
* @file protocol_mqtt_bcu.h
* @brief protocol_mqtt_bcu.h
* @version V1.0
* @author Gary
* @copyright
******************************************************************************/
#ifndef PROTOCOL_MQTT_BCU_H_
#define PROTOCOL_MQTT_BCU_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "cJSON.h"
#include "drv_qfc41d.h"
#include "drv_rtc.h"
typedef struct {
const char* key; // JSON 中的键,比如 "BCU_2"
uint8_t groupId; // mqtt因为json长度限制这里面用于分组传输,从0开始
uint16_t input; // get_val的入参用于获取key对应的数据
uint32_t (*get_val)(uint16_t); // 对应值的获取函数
} devPointMap;
typedef struct {
const char* key; // JSON 中的键,比如 "BCU_"后面不带数字数据后面通过BCU_pointId组合
uint16_t pointId; // 用于记录开始的测点号见bcu模型
uint16_t startCellIndex; // 开始的电压序号(入参)
uint16_t endCellIndex; // 结束的电压序号(入参)
uint32_t (*get_val)(uint16_t); // 对应值的获取函数
} devCellPointMap;
extern const devPointMap bms_points[];
extern const devCellPointMap bms_volt_points[];
extern const devCellPointMap bms_temp_points[];
void mqtt_publish_bms_data(uint32_t basetime);
#ifdef __cplusplus
}
#endif
#endif