#ifndef j1939_compress_h__
#define j1939_compress_h__

#include <stdio.h>
#include "platmacro.h"


/*!
 * @brief       压缩与解压缩初始化
 *
 * @param[in]   void
 * @return      Std_Ret_Type
 * @retval      Std_Ret_OK:初始化成功 Std_Ret_ERR：初始化失败
 *
 * @par         modify    log
 * Date        Author     Description             \n
 * 2023-5-11    jyg      Create             \n
 *
 */
Std_Ret_Type Compress_Init(void);


/**@brief      数据压缩
 * @param[in]  int16_t* src 原始电压
 * @param[in]  int32_t srcLen 原始电压数量
 * @param[out] uint8_t* dst 压缩后存放的数组(含压缩数据及压缩类型)
 * @param[out] int32_t* dstLen 压缩后的长度（含压缩数据长度及压缩类型长度）
 * @return
 * @retval
 * @par         修改日志:
 * Date                Author      Description           \n
 * 2023/05/10           tbh        创建初始版本     \n
 * 2023/05/19           tbh        更换压缩算法\n
 */
void Compress_EnCode(int16_t* src, int32_t srcLen, uint8_t* dst, int32_t* dstLen);

/**@brief      数据解压缩
 * @param[in]  uint8_t* src 压缩后的数据（含压缩类型）
 * @param[in]  int32_t srcLen 压缩后的数据长度(剔除第一个字节(压缩类型)长度)
 * @param[out] uint8_t* dst 还原后存放原始电压的数组
 * @param[out] int32_t* dstLen 原始电压数量
 * @return
 * @retval
 * @par         修改日志:
 * Date                Author      Description           \n
 * 2023/05/10           tbh        创建初始版本     \n
 * 2023/05/19           tbh        更换解压算法\n
 * 2023/07/21           jyg        zigzag解压缩时，防止数组越界\n
 */
void Compress_DeCode(uint8_t* src, int32_t srcLen, int16_t* dst, int32_t* dstLen);


#endif

