Files
luban-lite/packages/artinchip/uds/UDSLogic/SID19_ReadDTCInformation.c

69 lines
2.2 KiB
C
Raw Normal View History

2025-07-22 11:15:46 +08:00
/*
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#include "SID19_ReadDTCInformation.h"
#include "service_cfg.h"
#include "uds_def.h"
2025-10-21 13:59:50 +08:00
#define REPORT_DTC_NUMBER_BY_STATUS_MASK (0x01)
#define REPORT_DTC_BY_STATUS_MASK (0x02)
#define REPORT_DTC_SNOPSHOT_BY_DTC_NUMBER (0x04)
2025-07-22 11:15:46 +08:00
#define REPORT_DTC_EXTENDED_DATA_RECORD_BY_DTC_NUMBER (0x06)
2025-10-21 13:59:50 +08:00
#define REPORT_SUPPORTED_DTC (0x0a)
2025-07-22 11:15:46 +08:00
/******************************************************************************
* : bool_t service_19_check_len(const uint8_t* msg_buf, uint16_t msg_dlc)
* : 19
* : uint16_t msg_dlc --
* :
* : TRUE: ; FALSE:
* :
******************************************************************************/
2025-10-21 13:59:50 +08:00
bool_t service_19_check_len(const uint8_t *msg_buf, uint16_t msg_dlc)
2025-07-22 11:15:46 +08:00
{
2025-10-21 13:59:50 +08:00
bool_t ret = FALSE;
2025-07-22 11:15:46 +08:00
2025-10-21 13:59:50 +08:00
return ret;
2025-07-22 11:15:46 +08:00
}
/******************************************************************************
* : void service_19_ReadDTCInformation(const uint8_t* msg_buf, uint16_t msg_dlc)
* : 19 -
* : uint8_t* msg_buf --
    uint8_t msg_dlc --
* :
* :
* :
******************************************************************************/
2025-10-21 13:59:50 +08:00
void service_19_ReadDTCInformation(const uint8_t *msg_buf, uint16_t msg_dlc)
2025-07-22 11:15:46 +08:00
{
2025-10-21 13:59:50 +08:00
uint8_t subfunction;
2025-07-22 11:15:46 +08:00
uint8_t rsp_buf[64];
2025-10-21 13:59:50 +08:00
subfunction = UDS_GET_SUB_FUNCTION(msg_buf[1]);
2025-07-22 11:15:46 +08:00
2025-10-21 13:59:50 +08:00
switch (subfunction) {
case REPORT_DTC_NUMBER_BY_STATUS_MASK: {
uint16_t dtc_count;
dtc_count = 5; // example
rsp_buf[0] = USD_GET_POSITIVE_RSP(SID_19);
rsp_buf[1] = subfunction;
rsp_buf[2] = 0x7F;
rsp_buf[3] = 1; // 14229
rsp_buf[4] = (uint8_t)dtc_count;
rsp_buf[5] = (dtc_count >> 8) & 0xFF;
uds_positive_rsp(rsp_buf, 6);
break;
}
2025-07-22 11:15:46 +08:00
2025-10-21 13:59:50 +08:00
default:
uds_negative_rsp(SID_19, NRC_SUBFUNCTION_NOT_SUPPORTED);
break;
}
}
2025-07-22 11:15:46 +08:00
/****************EOF****************/