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

67 lines
2.1 KiB
C
Raw Normal View History

2025-07-22 11:15:46 +08:00
/*
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#include "SID85_ControlDTCSetting.h"
#include "service_cfg.h"
#include "uds_def.h"
2025-10-21 13:59:50 +08:00
bool_t dtc_setting = UDS_DTC_SETTING_ON;
2025-07-22 11:15:46 +08:00
/******************************************************************************
* : bool_t service_85_check_len(const uint8_t* msg_buf, uint16_t msg_dlc)
* : 85
* : uint16_t msg_dlc --
* :
* : TRUE: ; FALSE:
* :
******************************************************************************/
2025-10-21 13:59:50 +08:00
bool_t service_85_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
(void)msg_buf;
if (2 == msg_dlc)
ret = TRUE;
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_85_ControlDTCSetting(const uint8_t* msg_buf, uint16_t msg_dlc)
* : 85 - DTC
* : uint8_t* msg_buf --
    uint8_t msg_dlc --
* :
* :
* :
******************************************************************************/
2025-10-21 13:59:50 +08:00
void service_85_ControlDTCSetting(const uint8_t *msg_buf, uint16_t msg_dlc)
2025-07-22 11:15:46 +08:00
{
uint8_t subfunction;
2025-10-21 13:59:50 +08:00
uint8_t rsp_buf[8];
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 UDS_DTC_SETTING_ON:
dtc_setting = UDS_DTC_SETTING_ON;
rsp_buf[0] = USD_GET_POSITIVE_RSP(SID_85);
rsp_buf[1] = subfunction;
uds_positive_rsp(rsp_buf, 2);
break;
case UDS_DTC_SETTING_OFF:
dtc_setting = UDS_DTC_SETTING_OFF;
rsp_buf[0] = USD_GET_POSITIVE_RSP(SID_85);
rsp_buf[1] = subfunction;
uds_positive_rsp(rsp_buf, 2);
break;
default:
uds_negative_rsp(SID_85, NRC_SUBFUNCTION_NOT_SUPPORTED);
break;
}
2025-07-22 11:15:46 +08:00
}
/****************EOF****************/