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

65 lines
1.8 KiB
C
Raw Normal View History

2025-07-22 11:15:46 +08:00
/*
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#include "SID22_ReadDataByIdentifier.h"
#include "service_cfg.h"
#include "uds_def.h"
#include "SID10_SessionControl.h"
/******************************************************************************
* : bool_t service_22_check_len(const uint8_t* msg_buf, uint16_t msg_dlc)
* : 22
* : uint16_t msg_dlc --
* :
* : TRUE: ; FALSE:
* :
******************************************************************************/
2025-10-21 13:59:50 +08:00
bool_t service_22_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 (3 == 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_22_ReadDataByIdentifier(const uint8_t* msg_buf, uint16_t msg_dlc)
* : 22 -
* : uint8_t* msg_buf --
    uint8_t msg_dlc --
* :
* :
* :
******************************************************************************/
2025-10-21 13:59:50 +08:00
void service_22_ReadDataByIdentifier(const uint8_t *msg_buf, uint16_t msg_dlc)
2025-07-22 11:15:46 +08:00
{
uint8_t rsp_buf[128];
2025-10-21 13:59:50 +08:00
uint16_t did;
2025-07-22 11:15:46 +08:00
rsp_buf[0] = USD_GET_POSITIVE_RSP(SID_22);
2025-10-21 13:59:50 +08:00
rsp_buf[1] = msg_buf[1];
rsp_buf[2] = msg_buf[2];
2025-07-22 11:15:46 +08:00
2025-10-21 13:59:50 +08:00
did = ((uint16_t)msg_buf[1]) << 8;
did |= msg_buf[2];
2025-07-22 11:15:46 +08:00
2025-10-21 13:59:50 +08:00
switch (did) {
case 0xF186:
rsp_buf[3] = get_current_session();
uds_positive_rsp(rsp_buf, 4);
break;
2025-07-22 11:15:46 +08:00
2025-10-21 13:59:50 +08:00
default:
uds_negative_rsp(SID_22, NRC_REQUEST_OUT_OF_RANGE);
break;
}
}
2025-07-22 11:15:46 +08:00
/****************EOF****************/