/*
 * @Author       : ChenJie
 * @Date         : 2022-01-23 13:45:09
 * @Version      : V3.0
 * @LastEditors  : ChenJie
 * @LastEditTime : 2022-02-14 15:24:03
 * @Description  : file content
 * @FilePath     : \S32K146_4G\src\AppFuncLib.h
 */
/*
 * AppFunc.h
 *应用层函数库
 *  Created on: 2022年1月21日
 *      Author: QiXiang_CHENJIE
 */

#ifndef APPFUNCLIB_H_
#define APPFUNCLIB_H_
#include "hal_adapter.h"
#include <stdarg.h>
#include "stdio.h"
#ifndef va_copy
#define va_copy(dst, src) memcpy(&(dst), &(src), sizeof(va_list))
#endif
uint16 GetErrorNum(uint16 *ErrorArray, uint8 Errorlen);
uint8 PutErrorNum(uint16 *ErrorArray, uint8 Errorlen, uint16 ErrorNum);
uint16 ATstrdel(char *str);
uint16 mstrlen(const char *s);
int mstrncmp(const char *s1, const char *s2, int n);
unsigned char HexToChar(unsigned char bHex);
unsigned char CharToHex(unsigned char bChar);
uint8 AtStrCompare(const char *a, const char *b);
unsigned short CRC16_Modbus(unsigned char *pdata, int len);
uint8 bcc_chk(uint8 *data, uint16 length);
char *Myitoa(int value, char *result, int base);
// 整数转字符串
int _itoa(int num, char buf[32]);

int _i2a(int num, char buf[32], int radix);

// 浮点转字符串
int _ftoa(double val, char buf[32], int eps);

// 浮点转字符串，范围（-1，1）
int __ftoa(double val, char buf[32], int eps);

// 替代sprintf
int _sprintf(char *dst, const char *format, ...);
//串口校验
uint16 crc_chk(uint8 *data, uint8 length);
void Fota_Func(uint8 *DataPtr, sint32 connectId);
#endif /* APPFUNCLIB_H_ */
