Initial commit: CCU621_M firmware project with BLE debug link support.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-08 17:28:36 +08:00
commit 9ceb218f80
1597 changed files with 724159 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
#ifndef VTK_TLV_H
#define VTK_TLV_H
#include "publicdata/public_define.h"
#if (POS_VTK_EN)
#ifdef __cplusplus
extern "C" {
#endif
#include "main.h"
/* 简化的 TLV 工具:目前仅支持
* - 1 字节 Tag
* - 短格式 Length1 字节,长度 < 128
* 满足本项目中金额 / 操作号 / 消息名等中小长度字段需求。
*/
/* 在缓冲末尾追加一个 TLV
* @param[in] tag 参数标识
* @param[in] pVal 值缓冲区
* @param[in] len 值长度
* @param[in,out] pBuf 目标缓冲区
* @param[in] bufMax 目标缓冲区大小
* @param[in,out] pOffset 当前已使用长度,调用成功后自动累加
* @return U8_T 1=成功 0=失败(空间不足或长度超限)
*/
U8_T vtk_tlv_append(U8_T tag, const U8_T *pVal, U16_T len,
U8_T *pBuf, U16_T bufMax, U16_T *pOffset);
/* 追加 ASCII 字符串 TLV(不含终止符 '\0' */
U8_T vtk_tlv_append_ascii(U8_T tag, const char *str,
U8_T *pBuf, U16_T bufMax, U16_T *pOffset);
/* 以十进制 ASCII 形式追加无符号整数(长度可变,最小宽度由 minWidth 控制) */
U8_T vtk_tlv_append_ascii_uint(U8_T tag, U32_T value, U8_T minWidth,
U8_T *pBuf, U16_T bufMax, U16_T *pOffset);
/* 在 TLV 缓冲中查找第一个指定 Tag
* @param[in] pBuf TLV 缓冲区
* @param[in] bufLen 缓冲区长度
* @param[in] tag 要查找的 Tag
* @param[out] ppVal 找到时指向 Value 起始地址
* @param[out] pValLen 找到时的 Value 长度
* @return U8_T 1=找到 0=未找到或格式错误
*/
U8_T vtk_tlv_find_first(const U8_T *pBuf, U16_T bufLen, U8_T tag,
const U8_T **ppVal, U16_T *pValLen);
#ifdef __cplusplus
}
#endif
#endif /* POS_VTK_EN */
#endif /* VTK_TLV_H */