/****************************************************************************** 文 件 名:UDS_ISO14229_Server.h 功能描述:ISO 14229 规范规定的诊断服务服务器端函数头文件 作 者:张暄 版 本:V1.0 日 期:2016.11.1 ******************************************************************************/ /****************************************************************************** 诊断服务的OSI模型映射 =============================================================================== * NO. OSI Layer Diagnostics services ------------------------------------------------------------------------------- * 7 Application ISO 14229-1 ISO 14229-3 6 Presentation - * 5 Session ISO 14229-2 4 Transport ISO 15765-2 3 Network ISO 15765-2 2 Data Link ISO 11898 1 Physical ISO 11898 =============================================================================== ******************************************************************************/ #ifndef _UDS_ISO14229_SERVER_H_ #define _UDS_ISO14229_SERVER_H_ #include "DoCAN_ISO15765.h" #include "DoCAN_ISO15765_Config.h" #include "UDS_ISO14229_Services.h" /****************************************************************************** 结构体声明 ******************************************************************************/ /*** 会话层数据发送结果枚举 ***/ typedef enum { S_OK = 0, S_NOK, } S_Result_Enum; /*---------------------------------------------------------------------------*/ /*** A_PCI解析结构(非负反馈) ***/ typedef struct { uint8_t SI; } UDS_A_PCI_Struct; /*** A_PCI解析结构(负反馈) ***/ typedef struct { uint8_t NR_SI; uint8_t SI; } UDS_NEG_A_PCI_Struct; /*** 应用层接收数据解析结构 ***/ typedef struct { uint16_t TA_type; uint8_t A_Data [ A_DATA_RX_BUFFER_SIZE ]; uint16_t Length; // 有效数据长度(不含A_PCI) uint8_t New; // 新收到的数据 } UDS_RX_App_Data_Struct; /*** 应用层接收A_PDU解析结构 ***/ typedef struct { uint16_t TA_type; UDS_A_PCI_Struct A_PCI; uint8_t Data [ A_DATA_RX_BUFFER_SIZE - 1 ]; uint16_t Length; // 有效数据长度(不含A_PCI) uint8_t New; // 新收到的数据 } UDS_RX_A_PDU_Struct; /*** 应用层发送数据解析结构 ***/ typedef struct { uint16_t TA_type; uint8_t A_Data [ A_DATA_TX_BUFFER_SIZE ]; uint16_t Length; // 有效数据长度(不含A_PCI) } UDS_TX_App_Data_Struct; /*** 应用层发送正反馈A_PDU解析结构 ***/ typedef struct { uint16_t TA_type; UDS_A_PCI_Struct A_PCI; uint8_t Data [ A_DATA_TX_BUFFER_SIZE - 1 ]; uint16_t Length; // 有效数据长度(不含A_PCI) } UDS_TX_A_PDU_Struct; /*** 应用层发送负反馈A_PDU解析结构 ***/ typedef struct { uint16_t TA_type; UDS_NEG_A_PCI_Struct A_PCI; uint8_t Data [ A_DATA_TX_BUFFER_SIZE - 2 ]; uint16_t Length; // 有效数据长度(不含A_PCI) } UDS_TX_NEG_A_PDU_Struct; /*** 应用层接收数据解析联合体 ***/ typedef union { UDS_RX_App_Data_Struct Data; UDS_RX_A_PDU_Struct A_PDU; } UDS_APP_RX_Union; /*** 应用层发送正反馈数据解析联合体 ***/ typedef union { UDS_TX_App_Data_Struct Data; UDS_TX_A_PDU_Struct A_PDU; } UDS_APP_TX_Union; /*** 应用层发送负反馈数据解析联合体 ***/ typedef union { UDS_TX_App_Data_Struct Data; UDS_TX_NEG_A_PDU_Struct A_PDU; } UDS_APP_TX_NEG_Union; /* 全局变量 变更为局部变量 uint8_t Service10DiagDataLength; uint8_t Service11DiagDataLength; uint8_t Service14DiagDataLength; uint8_t Service19DiagDataLength; uint8_t Service22DiagDataLength; uint8_t Service27DiagDataLength; uint8_t Service28DiagDataLength; uint8_t Service2EDiagDataLength; uint8_t Service2FDiagDataLength; uint8_t Service31DiagDataLength; uint8_t Service34DiagDataLength; uint8_t Service36DiagDataLength; uint8_t Service37DiagDataLength; uint8_t Service3EDiagDataLength; uint8_t Service85DiagDataLength; */ /****************************************************************************** 函数声明 ******************************************************************************/ /*-- 外部接口函数 -----------------------------------------------------------*/ /*** 后台服务函数 ***/ void UDS_Server_Application_Service(void); /*** 传输层/网络层下层接口函数 ***/ void UDS_N_USData_Request(uint16_t N_TAtype, uint8_t *MessageData, uint16_t Length); void UDS_N_USData_Confirm(uint16_t N_TAtype, uint8_t N_Result); void UDS_N_USData_FF_Indication(uint16_t N_TAtype, uint16_t Length); void UDS_N_USData_Indication(uint16_t N_TAtype, uint8_t *MessageData, uint16_t Length, uint8_t N_Result); /*-- 内部函数 ---------------------------------------------------------------*/ /*** 会话层数据接口函数 ***/ void UDS_S_Data_Request(uint16_t S_TAtype, uint8_t *S_Data, uint16_t S_Length); void UDS_S_Data_Confirm(uint16_t S_TAtype, S_Result_Enum S_Result); void UDS_S_Data_Indication(uint16_t S_TAtype, uint8_t *S_Data, uint16_t S_Length, S_Result_Enum S_Result); /*** 会话层时序控制函数 ***/ /*** 应用层服务控制函数 ***/ void UDS_Process_Service_Request(void); extern void UDS_Service_Response(uint8_t si, uint8_t RspType, uint16_t A_TA_type, uint16_t A_Length, uint8_t *A_Data); #endif