127 lines
5.5 KiB
C
127 lines
5.5 KiB
C
|
|
/*
|
|||
|
|
* log_api.h
|
|||
|
|
*
|
|||
|
|
* Created on: Jul 29, 2025
|
|||
|
|
* Author: cc
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef _LOG_API_H_
|
|||
|
|
#define _LOG_API_H_
|
|||
|
|
|
|||
|
|
#include "ch564.h"
|
|||
|
|
#include <stdint.h>
|
|||
|
|
|
|||
|
|
#define LogType_Enable 1 //LOGʹ<47><CAB9>
|
|||
|
|
|
|||
|
|
/*<2A><>־<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>*/
|
|||
|
|
#define LogType_Launcher 0x01 //Launcher<65><72>Ϣ<EFBFBD><CFA2>¼
|
|||
|
|
#define LogType_SYS_Record 0x02 //ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>¼
|
|||
|
|
#define LogType_Device_COMM 0x03 //<2F>豸ͨѶ<CDA8><D1B6>¼
|
|||
|
|
#define LogType_Device_Online 0x04 //<2F>豸ͨѶ״̬<D7B4><CCAC>¼
|
|||
|
|
#define LogType_Global_Parameters 0x05 //<2F><><EFBFBD><EFBFBD><EFBFBD>豸״̬<D7B4><CCAC><EFBFBD>ڼ<EFBFBD>¼
|
|||
|
|
#define LogType_Net_COMM 0x06 //<2F><><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6>¼
|
|||
|
|
#define LogType_Logic_Record 0x07 //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
|||
|
|
|
|||
|
|
/*<2A><>־<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD> - <20><>ʼ״̬*/
|
|||
|
|
#define LogType_Launcher_SWITCH 1
|
|||
|
|
#define LogType_SYS_Record_SWITCH 1
|
|||
|
|
#define LogType_Device_COMM_SWITCH 1
|
|||
|
|
#define LogType_Device_Online_SWITCH 1
|
|||
|
|
#define LogType_Global_Parameters_SWITCH 1
|
|||
|
|
#define LogType_Net_COMM_SWITCH 1
|
|||
|
|
#define LogType_Logic_Record_SWITCH 1
|
|||
|
|
|
|||
|
|
/*<2A><>־<EFBFBD>洢<EFBFBD><E6B4A2><EFBFBD><EFBFBD>λ*/
|
|||
|
|
#define LogType_Launcher_bit 0
|
|||
|
|
#define LogType_SYS_Record_bit 1
|
|||
|
|
#define LogType_Device_COMM_bit 2
|
|||
|
|
#define LogType_Device_Online_bit 3
|
|||
|
|
#define LogType_Global_Parameters_bit 4
|
|||
|
|
#define LogType_Net_COMM_bit 5
|
|||
|
|
#define LogType_Logic_Record_bit 6
|
|||
|
|
|
|||
|
|
extern uint32_t SYS_Log_Switch;
|
|||
|
|
|
|||
|
|
/*<2A><>־<EFBFBD><D6BE><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>*/
|
|||
|
|
#define LogInfo_Device_Online 0x01 //<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
|
#define LogInfo_Device_Offline 0x02 //<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
|
|
|||
|
|
typedef enum{
|
|||
|
|
LLauncher_App_Check = 0x01, //У<><D0A3>APP
|
|||
|
|
LLauncher_Read_App, //<2F><>ȡAPP<50><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>APP<50><50><EFBFBD><EFBFBD>д<EFBFBD>뵽MCU FLash<73><68>
|
|||
|
|
LLauncher_Write_Flash, //дFlash
|
|||
|
|
LLauncher_Factory_Reset, //<2F>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LLauncher_Reset_Source, //<2F><>λԴ
|
|||
|
|
LLauncher_RCUKey_State, //RCU<43><55><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>¼
|
|||
|
|
}LOGTYPE_Launcher_E;
|
|||
|
|
|
|||
|
|
typedef enum {
|
|||
|
|
LSYS_PHY_Change = 0x01, //PHY״̬<D7B4>仯<EFBFBD><E4BBAF>¼
|
|||
|
|
LSYS_DevInfo_Error, //<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
|||
|
|
LSYS_API_State, //<2F><><EFBFBD><EFBFBD>״̬
|
|||
|
|
LSYS_NET_ARGC, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LSYS_MQTT_ARGC, //MQTT<54><54><EFBFBD><EFBFBD>
|
|||
|
|
LSYS_Server_Comm_State, //<2F>ƶ<EFBFBD>ͨѶ״̬<D7B4><CCAC>¼
|
|||
|
|
LSYS_NET_DefaultARGC, //<2F><><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD>
|
|||
|
|
LSYS_RCUKey_State, //RCU<43><55><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>¼
|
|||
|
|
}LOGTYPR_SYSRecord;
|
|||
|
|
|
|||
|
|
typedef enum {
|
|||
|
|
LCOMM_ASK_TO_Reply = 0x01, //<2F><>ѯ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LCOMM_Send_Control, //RCU<43>·<EFBFBD><C2B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LCOMM_Control_Reply, //RCU<43><55><EFBFBD>ƻظ<C6BB><D8B8><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LCOMM_Adjust_Baud, //<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}LOGTYPE_DEV_COMM;
|
|||
|
|
|
|||
|
|
typedef enum {
|
|||
|
|
LGlobal_Para = 0x01, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LGlobal_Dev, //<2F>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
|||
|
|
}LOGTYPE_Global_E;
|
|||
|
|
|
|||
|
|
typedef enum {
|
|||
|
|
LNetComm_Send = 0x01, //<2F><><EFBFBD>緢<EFBFBD><E7B7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
LNetComm_Recv, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
}LOGTYPE_NET_COMM_E;
|
|||
|
|
|
|||
|
|
typedef enum {
|
|||
|
|
LLogic_DebugString = 0x01, //<2F><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD> - <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
|
|||
|
|
}LOGTYPE_LOGICRecord_E;
|
|||
|
|
|
|||
|
|
/*Launcher<65><72>Ϣ<EFBFBD><CFA2>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_Launcher_APP_Check_Record(uint8_t state);
|
|||
|
|
void LOG_Launcher_Read_App_Record(uint8_t state);
|
|||
|
|
void LOG_Launcher_Write_Flash_Record(uint32_t addr,uint16_t len);
|
|||
|
|
void LOG_Launcher_Factory_Reset_Record(void);
|
|||
|
|
/*ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_SYS_PHY_Change_Record(uint8_t state);
|
|||
|
|
void LOG_SYS_DevInfo_Error_Record(uint8_t dev,uint8_t addr,uint32_t info_addr);
|
|||
|
|
void LOG_SYS_API_State_Record(uint8_t API_way,uint8_t state);
|
|||
|
|
void LOG_SYS_NET_Argc_Record(uint8_t *IP,uint8_t *MAC,uint8_t *DNS_IP1,uint8_t *DNS_IP2,uint8_t *DNS_IP3);
|
|||
|
|
void LOG_SYS_MQTT_Argc_Record(uint8_t *productkey,uint8_t *devname,uint8_t *devsecret,uint8_t *publish,uint8_t *sublish);
|
|||
|
|
void LOG_SYS_Server_Comm_State_Record(uint8_t state);
|
|||
|
|
void LOG_SYS_NET_Argc_Init_Record(uint8_t *IP,uint8_t *Gateway,uint8_t *IP_Mask,uint8_t *DNS_Add,uint8_t ArgcFlag,uint8_t DHCPFlag,uint8_t ServerFlag);
|
|||
|
|
void LOG_SYS_RCUKey_State_Record(uint8_t state);
|
|||
|
|
/*<2A>豸ͨѶ<CDA8><D1B6>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_Device_COMM_ASK_TO_Reply_Record(uint8_t port,uint32_t baud,uint32_t data_tick,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_ASK_TO_Reply_Record2(uint32_t port_addr,uint32_t baud_addr,uint32_t data_tick,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_Send_Control_Record(uint8_t port,uint32_t baud,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_Send_Control_Record2(uint32_t port_addr,uint32_t baud_addr,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_Control_Reply_Record(uint8_t port,uint32_t baud,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_Control_Reply_Record2(uint32_t port_addr,uint32_t baud_addr,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_Control_Reply_Record3(uint32_t port_addr,uint32_t baud_addr,uint32_t buff_addr,uint16_t len);
|
|||
|
|
void LOG_Device_COMM_Adjust_Baud_Record(uint8_t dev_type,uint8_t dev_addr,uint32_t baud,uint8_t way,uint8_t fail_num,uint8_t sum,uint8_t num);
|
|||
|
|
void LOG_Device_COMM_Adjust_Baud_Record2(uint32_t dev_type,uint32_t dev_addr,uint32_t baud_addr);
|
|||
|
|
/*<2A>豸ͨѶ״̬<D7B4><CCAC>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_Device_Online_Record(uint8_t dev,uint8_t addr,uint8_t state);
|
|||
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD>豸״̬<D7B4><CCAC><EFBFBD>ڼ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_Global_ParaInfo_Record(uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_Global_DevInfo_Record(uint8_t *buff,uint16_t len);
|
|||
|
|
/*<2A><><EFBFBD><EFBFBD>ͨѶ<CDA8><D1B6>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_NET_COMM_Send_Record(uint8_t SocketId,uint8_t *ip,uint16_t port,uint8_t *buff,uint16_t len);
|
|||
|
|
void LOG_NET_COMM_Recv_Record(uint8_t SocketId,uint8_t *ip,uint16_t port,uint8_t *buff,uint16_t len);
|
|||
|
|
/*<2A><EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>API*/
|
|||
|
|
void LOG_LogicInfo_DebugRecord(char *fmt,...);
|
|||
|
|
|
|||
|
|
#endif /* MCU_DRIVER_INC_LOG_API_H_ */
|