UDS Client Stack
UDS Client Overview
RAPIDSEA supports ISO14229 protocol as explained in the ISO14229 - UDS Protocol page. This page explains the client architecture and details how the user should interface the stack with their custom logic and realize the Tester implementation quickly. It also provides guidelines on adopting the stack for different systems.
The below diagram captures the block level diagram of the DoCAN UDS client and how it interfaces with other modules.

The below diagram captures the block level diagram of the DoIP UDS client and how it interfaces with other modules.

DoCAN Interface
The UDS client communicates over the CAN network through the underlying DoCAN stack (ISO15765). This DoCAN stack is also available as part of the RAPIDSEA components. All the functions that are needed are available as part of the DoCAN stack and has to be compiled together.
Mode |
Description |
---|---|
rs_iso15765_* |
Set of functions called by UDS client to perform operation such as initialize, transmit messages etc |
rs_uds_client_docan_callback |
Callback function called by the DoCAN layer to inform of Data Indication, error etc |
These details with respect to the DoCAN interface are covered in detail in the ISO15765 - DoCAN Protocol page.
DoIP Interface
The UDS client communicates over the Ethernet through the underlying DoIP stack (ISO13400). This DoIP stack is also available as part of the RAPIDSEA components. All the functions that are needed are available as part of the DoIP stack and has to be compiled together.
Mode |
Description |
---|---|
rs_iso13400_* |
Set of functions called by UDS client to perform operation such as initialize, transmit messages etc |
rs_uds_client_docan_callback |
Callback function called by the DoIP layer to inform of Data Indication, error etc |
These details with respect to the DoIP interface are covered in detail in the ISO13400 - DoIP Protocol page.
Application Interface
While the RAPIDSEA UDS client stack can handle most of the functionality such as message validation, session management, timing control etc, the business logic has to implement the application functionality. The RAPIDSEA UDS client clearly defines API and callback functions that are essential for the user to use/implement.
The below table captures the function that are to be called from the application logic.
Function |
Description |
---|---|
rs_uds_client_open |
To initialize the UDS client stack. |
rs_uds_client_process |
To be called periodically to process the incoming/outgoing messages. |
rs_uds_client_req_diag_session_control |
To initiate a diagnostic session with the server. |
rs_uds_client_req_ecu_reset |
To request ECU reset. |
rs_uds_client_req_clear_diag_info |
To clear DTC information. |
rs_uds_client_req_read_data_by_id |
To read Data by ID. |
rs_uds_client_req_read_mem_by_addr |
To read memory by address. |
rs_uds_client_req_read_scaling_data_by_id |
To read scaling data of the data by ID. |
rs_uds_client_req_security_access |
To perform secure access. |
rs_uds_client_req_comm_control |
To set up communication control on the UDS channel. |
rs_uds_client_req_write_data_by_id |
To write data by ID. |
rs_uds_client_req_control_io_by_id |
To control IO by ID. |
rs_uds_client_req_routine_control |
To perform routine control operation. |
rs_uds_client_req_download |
To request download of data. |
rs_uds_client_req_transfer_data |
To transfer data. |
rs_uds_client_req_transfer_exit |
To terminate data transfer. |
rs_uds_client_req_write_mem_by_addr |
To write memory by address. |
rs_uds_client_req_tester_present |
To send tester present. |
rs_uds_client_req_access_timing_param |
To set up access timing parameters. |
rs_uds_client_req_control_dtc_setting |
To set up DTC settings. |
rs_uds_client_req_link_control |
To set up link control. |
rs_uds_client_req_read_data_by_periodic_id |
To read data using periodic IDs. |
rs_uds_client_req_read_dtc_info |
To read DTC information. |
rs_uds_client_enable_pos_resp_suppression |
To enable/disable positive response suppression. |
rs_uds_client_req_upload |
To requests upload the data. |
rs_uds_client_req_response_on_event |
To requests a server to start or stop transmission of responses on a specified event. |
rs_uds_client_close |
To free the UDS Client handle. |
There are many functions through which the UDS client stack retrieves information from the application logic or indicate actions to be performed. These functions are captured in the below table.
Function |
Description |
---|---|
rcb_uds_client_10h_diag_session_resp |
Called when response for a default session setup request is received |
rcb_uds_client_11h_ecu_reset_resp |
Called when response for ECU reset request is received |
rcb_uds_client_14h_clear_diag_info_resp |
Called when response for clear DTC request is received |
rcb_uds_client_22h_read_data_by_id_resp |
Called when response for read Data by ID is received |
rcb_uds_client_23h_read_mem_by_addr_resp |
Called when response for Memory by address is received |
rcb_uds_client_24h_read_scaling_data_by_id_resp |
Called when response for read scaling data by ID is received |
rcb_uds_client_27h_security_access_resp |
Called when response for secure access is received |
rcb_uds_client_28h_comm_ctrl_resp |
Called when response for communication control request is received |
rcb_uds_client_2eh_write_data_by_id_resp |
Called when response for write Data By ID is received |
rcb_uds_client_2fh_io_control_by_id_resp |
Called when response for control of given Data ID is received |
rcb_uds_client_31h_routine_control_resp |
Called when response for routine control is received |
rcb_uds_client_34h_download_data_resp |
Called when response for download request is received |
rcb_uds_client_36h_transfer_data_resp |
Called when response for transfer data is received |
rcb_uds_client_37h_transfer_exit_resp |
Called when response for exit transfer operation is received |
rcb_uds_client_3dh_write_mem_by_addr_resp |
Called when response for write by memory address is received |
rcb_uds_client_3eh_tester_present_resp |
Called when response for tester present is received |
rcb_uds_client_83h_access_timing_param_resp |
Called when response for access timing parameters is received |
rcb_uds_client_85h_control_dtc_setting_resp |
Called when response for control DTC setting is received |
rcb_uds_client_87h_link_control_resp |
Called when response for link control parameters is received |
rcb_uds_client_2ah_read_data_by_periodic_id_resp |
Called when a response to read data by periodic id is received |
rcb_uds_client_19h_read_dtc_info_resp |
Called when a response to read DTC information is received |
rcb_uds_client_transmit_confirm |
Called it indicate status of the last transmit operation |
rcb_uds_client_error_resp |
Called to indicate reception of error response for any request |
rcb_uds_client_35h_req_upload_resp |
Called when a response to upload data is received |
rcb_uds_client_86h_resp_on_event_resp |
Called when a response to response on event is received |
rcb_uds_client_2ch_ddid_resp |
Called when a response to dynamic define data ID is received |
These functions are documented in detail in the below sections. It is important for the client to implement these functions correct for proper operation of the system.
Implementation Guide
This section explains how the UDS server can be implemented using the RAPIDSEA stack. Whether the stack is available in source form or in binary form, the steps to be followed are
Implement the Callback functions mentioned above
Implement the underlying rs_can_* functions for DoCAN and rs_iso13400_* functions for DoIP as per the underlying hardware design as described in the CAN Interface page.
Initialize the buffers necessary for the operation
Initialize the CAN, ISO15765 and ISO14229 stack function for DoCAN and Ethernet socket , ISO13400 and ISO14229 fucction for DoIP .
Periodically call the process functions so that internal timeouts are handled.
If there is a need to send a request to ECU/server, send via rs_uds_client_req_* calls such as rs_uds_client_req_comm_control, rs_uds_client_req_clear_diag_info etc.
When the response from server is received, rcb_uds_client_* functions such as rcb_uds_client_14h_clear_diag_info_resp, rcb_uds_client_27h_security_access_resp are called.
On reception of negative response from server, rcb_uds_client_error_resp function is called.
Up on successful completion of transmission of request or failure to do so, rcb_uds_client_transmit_confirm is called with relevant reason code.
High level flow chart is depicted below for DoCAN:

High level flow chart is depicted below for DoIP:

This can be implemented in a bare-metal system or over RTOS or over full fledged OS such as Linux etc.
Example demo
An example implementation is available along with the release and is described in DoCAN UDS Client Demo.
UDS Client Header
Documentation from the relevant header as follows:
ISO14229 UDS Client Module.
This file contains the APIs for using ISO14229 defined UDS client module
- Author
Embien RAPIDSEA Team
- Copyright
Embien Technologies India Pvt. Ltd.
Defines
-
RS_UDS_CLIENT_MAX_NUM_RX_MSGS
Number of receive messages that can be buffered during reception.
Typedefs
-
typedef struct tag_rs_uds_client_config rs_uds_client_config_t
Contains information about UDS client configuration.
-
typedef struct tag_rs_uds_client_instance rs_uds_client_instance_t
Contains information about UDS client.
Functions
-
rs_handle_t rs_uds_client_open(rs_uds_client_instance_t *ptr_instance, rs_uds_client_config_t *ptr_config)
Initializes the UDS client stack.
This function initializes the UDS stack for client operation
- Parameters:
ptr_instance – [in] - Pointer to the UDS client instance
ptr_config – [in] - Pointer to the UDS client configuration
- Returns:
Handle of the UDS client instance information which include configuration information also
-
rs_ret_val_t rs_uds_client_process(rs_handle_t uds_client_handle)
Function to be called periodically to process underlying UDS client state machines.
This function is to be called at not more than 5 ms interval
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_diag_session_control(rs_handle_t uds_client_handle, uint8_t u8_session_type)
Requests a diagnostics session with the server.
This function initiates a diagnostic session (0x10) with the ECU of given type
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_session_type – [in] - Type of the session
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_10h_diag_session_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_session_type, uint8_t *ptr_resp)
Called when a response to diagnostics session is received.
This function is called when a diagnostic session response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_session_type – [in] - Type of the session
ptr_resp – [in] - Pointer to other information associated with the response.
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_ecu_reset(rs_handle_t uds_client_handle, uint8_t u8_reset_type)
Requests a reset of the server.
This function initiates reset sequence (0x11) with the ECU of given type
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_reset_type – [in] - Type of the reset
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_11h_ecu_reset_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_reset_type, uint8_t u8_power_down_time)
Called when a response to ECU reset is received.
This function is called when a ECU reset response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_reset_type – [in] - Type of the reset
u8_power_down_time – [in] - Power down time in seconds, if any
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_clear_diag_info(rs_handle_t uds_client_handle, uint32_t u32_dtc_group)
Requests Clear DTC for the server.
This function initiates clear DTC request (0x14) for the given type
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u32_dtc_group – [in] - DTC Group to be cleared
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_14h_clear_diag_info_resp(rs_handle_t uds_handle, uint8_t u8_err_code)
Called when a response to Clear DTC request is received.
This function is called when a Clear DTC response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_read_data_by_id(rs_handle_t uds_client_handle, uint32_t u32_num_data_id, uint16_t *ptr_data_id)
Requests read for given set of data IDs.
This function sends a read request (0x22) to fetch the given list of data IDs.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u32_num_data_id – [in] - Number of data IDs to read
ptr_data_id – [in] - Pointer to the list of data IDs
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_22h_read_data_by_id_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_data_record, uint16_t u16_resp_len)
Called when a response to read Data ID request is received.
This function is called when a read data by ID response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_data_record – [in] - Pointer to the memory with list of data ID and value returned
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_read_mem_by_addr(rs_handle_t uds_client_handle, uint32_t u32_mem_addr, uint8_t u8_mem_addr_len, uint32_t u32_mem_size, uint8_t u8_mem_size_len)
Requests read for memory for the given address and size.
This function sends a read memory (0x23) to fetch the data stored at the given address.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u32_mem_addr – [in] - Address to read from
u8_mem_addr_len – [in] - Number of bytes to be used to send the Address
u32_mem_size – [in] - Number of bytes to read
u8_mem_size_len – [in] - Number of bytes to be used to send the size information
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_23h_read_mem_by_addr_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to read memory by address is received.
This function is called when a read memory by address response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_read_scaling_data_by_id(rs_handle_t uds_client_handle, uint16_t u16_data_id)
Requests read for scaling data of the give Data ID.
This function sends a read scaling data by ID (0x24) to fetch the scaling information associated with the data ID
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u16_data_id – [in] - Data ID whose scaling data is to be read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_24h_read_scaling_data_by_id_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint16_t u16_data_id, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to read scaling data by ID is received.
This function is called when a read scaling data by ID response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u16_data_id – [in] - Data id
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_security_access(rs_handle_t uds_client_handle, uint8_t u8_type, uint8_t *ptr_data, uint16_t u16_data_len)
Requests security data of the give type.
This function sends a security access (0x27) for the given type and optional data
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_type – [in] - Security access type such as RS_ISO14229_SEQURITY_ACCESS_REQ_SEED etc
ptr_data – [in] - Pointer to data to be sent with this request
u16_data_len – [in] - Number of bytes of data to be sent. Zero for none
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_27h_security_access_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_type, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to security access is received.
This function is called when a security access response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_type – [in] - Security access type such as RS_ISO14229_SEQURITY_ACCESS_REQ_SEED etc
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_comm_control(rs_handle_t uds_client_handle, uint8_t u8_control_type, uint8_t u8_comm_type, uint16_t u16_node_id)
Requests a communication control request (0x28) to the server.
This function sends communication control request to the server
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_control_type – [in] - Type of the control requested
u8_comm_type – [in] - Type of the communication
u16_node_id – [in] - Node ID associated, if any
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_28h_comm_ctrl_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_control_type)
Called when a response to communication control request is received.
This function is called when a communication control response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_session_type – [in] - Type of the control
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_write_data_by_id(rs_handle_t uds_client_handle, uint16_t u16_data_id, uint8_t *ptr_data_record, uint16_t u16_data_len)
Requests a write data by ID request (0x2e) to the server.
This function sends write data by ID request to the server
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u16_data_id – [in] - Data ID to be written
ptr_data_record – [in] - Pointer to data to write
u16_data_len – [in] - Number of bytes of data to write
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_2eh_write_data_by_id_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint16_t u16_data_id)
Called when a response to write data by id request is received.
This function is called when a write data by id response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u16_data_id – [in] - Data ID written
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_control_io_by_id(rs_handle_t uds_client_handle, uint16_t u16_data_id, uint8_t *ptr_record, uint16_t u16_record_len, uint8_t *ptr_mask, uint16_t u16_mask_len)
Requests a Control by ID request (0x2f) to the server.
This function sends control IO by ID request to the server
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u16_data_id – [in] - Data ID to be written
ptr_record – [in] - Pointer to data to write
u16_record_len – [in] - Number of bytes of data to write
ptr_mask – [in] - Pointer to mask data to send
u16_mask_len – [in] - Number of bytes of mask data
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_2fh_io_control_by_id_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint16_t u16_data_id, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to control IO by id request is received.
This function is called when a control IO by id response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u16_data_id – [in] - Data ID written
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_routine_control(rs_handle_t uds_client_handle, uint16_t u16_routine_id, uint8_t u8_type, uint8_t *ptr_record, uint16_t u16_record_len)
Requests a Routine Control request (0x31) to the server.
This function sends control IO by ID request to the server
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u16_routine_id – [in] - Routine ID to be controlled
u8_type – [in] - control type such as RS_ISO14229_ROUTINE_CONTROL_START_ROUTINE
ptr_record – [in] - Pointer to data to write
u16_record_len – [in] - Number of bytes of data to write
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_31h_routine_control_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint16_t u16_routine_id, uint8_t u8_type, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to routine control request is received.
This function is called when a routine control response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u16_routine_id – [in] - Routine ID
u8_type – [in] - control type such as RS_ISO14229_ROUTINE_CONTROL_START_ROUTINE
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_download(rs_handle_t uds_client_handle, uint8_t u8_data_format, uint32_t u32_mem_addr, uint8_t u8_mem_addr_len, uint32_t u32_download_size, uint8_t u8_size_len)
Requests download of data.
This function sends a download data request (0x34) to store the data stored at the given address.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_data_format – [in] - Data format being sent
u32_mem_addr – [in] - Address to read from
u8_mem_addr_len – [in] - Number of bytes to be used to send the Address
u32_download_size – [in] - Number of bytes to send
u8_size_len – [in] - Number of bytes to be used to send the size information
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_34h_req_download_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_data, uint8_t u8_max_block_len)
Called when a response to download data is received.
This function is called when a download data response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_data – [in] - Pointer to data to be sent
u32_max_block_len – [in] - Maximum number bytes of data to be sent per block
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_transfer_data(rs_handle_t uds_client_handle, uint8_t u8_block_seq, uint8_t *ptr_data, uint16_t u16_data_len)
Sends the given data to server.
This function sends a transfer data request (0x36) to read/store the data stored at the given address.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_block_seq – [in] - Block number to be sent
ptr_data – [in] - Pointer to data to be sent
u16_data_len – [in] - Number of bytes of data being sent
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_36h_transfer_data_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_next_seq, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to transfer data is received.
This function is called when a transfer data response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_next_seq – [in] - Next sequence expected
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_transfer_exit(rs_handle_t uds_client_handle, uint8_t *ptr_data, uint16_t u16_data_len)
Sends the transfer exit request to server.
This function sends a exit transfer request (0x37) to the server
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
ptr_data – [in] - Pointer to optional data to be sent
u16_data_len – [in] - Number of bytes of data being sent
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_37h_transfer_exit_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to exit transfer is received.
This function is called when a exit transfer response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_write_mem_by_addr(rs_handle_t uds_client_handle, uint32_t u32_mem_addr, uint8_t u8_mem_addr_len, uint32_t u32_mem_size, uint8_t u8_mem_size_len, uint8_t *ptr_data)
Requests write for memory for the given address and size.
This function sends a write memory (0x3d) to write the data stored at the given address.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u32_mem_addr – [in] - Address to read from
u8_mem_addr_len – [in] - Number of bytes to be used to send the Address
u32_mem_size – [in] - Number of bytes to read
u8_mem_size_len – [in] - Number of bytes to be used to send the size information
ptr_data – [in] - Data to be programmed
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_3dh_write_mem_by_addr_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to write memory by address is received.
This function is called when a write memory by address response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_resp – [in] - Pointer to the data written to server
u16_resp_len – [in] - Number of bytes of data written
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_tester_present(rs_handle_t uds_client_handle, uint8_t u8_sub_func)
Requests tester present for the devices.
This function sends a tester present (0x3e) to the server.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_sub_func – [in] - Sub function to send
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_3eh_tester_present_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_sub_func)
Called when a response to tester present is received.
This function is called when a tester present response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_sub_func – [in] - Sub function code returned along with the response
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_access_timing_param(rs_handle_t uds_client_handle, uint8_t u8_access_type, uint8_t *ptr_data_record, uint16_t u16_record_len)
Requests read/write of access timing parameters.
This function sends a access timing parameter (0x3e) to read or change the same
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_access_type – [in] - Access type such as RS_ISO14229_ACCESS_TIMING_READ_EXT_TIMING_PARAM
ptr_data_record – [in] - Data to be sent, if any
u16_record_len – [in] - Number of bytes to be sent
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_83h_access_timing_param_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_timing_param_access_type, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to access timing parameter is received.
This function is called when the access timing parameter response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_timing_param_access_type – [in] - Access type
ptr_resp – [in] - Pointer to the data sent by server
u16_resp_len – [in] - Number of bytes of data retrieved
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_control_dtc_setting(rs_handle_t uds_client_handle, uint8_t u8_dtc_setting_type, uint8_t *ptr_data_record, uint16_t u16_record_len)
Requests read/write of DTC setting.
This function sends a control DTC setting request(0x85) to read or change the same
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_dtc_setting_type – [in] - Setting type like RS_ISO14229_CTRL_DTC_SETTING_ON
ptr_data_record – [in] - Data to be sent, if any
u16_record_len – [in] - Number of bytes to be sent
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_85h_control_dtc_setting_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_dtc_setting_type)
Called when a response to control DTC setting is received.
This function is called when the control DTC setting response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_dtc_setting_type – [in] - Setting type
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_link_control(rs_handle_t uds_client_handle, uint8_t u8_link_control_type, uint8_t u8_mode_id, uint8_t *ptr_link_record, uint16_t u16_record_len)
Requests update of link control for bandwidth management.
This function sends a link control request(0x87) to update the link control settings
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_link_control_type – [in] - Setting type like RS_ISO14229_LINK_CTRL_VERIFY_MODE_WITH_FIX_PARAMETER
u8_mode_id – [in] - Mode
ptr_link_record – [in] - Data to be sent, if any
u16_record_len – [in] - Number of bytes to be sent
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_87h_link_control_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_link_record_type, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to link control is received.
This function is called when the link control response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_link_record_type – [in] - Setting type
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_read_data_by_periodic_id(rs_handle_t uds_client_handle, uint8_t u8_transmission_mode, uint32_t u32_periodic_data_id_len, uint16_t *ptr_periodic_data_id)
Requests read data by periodic ID.
This function sends a read data by periodic ID(0x2A) to read data using periodic IDs
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_transmission_mode – [in] - transmission rate of the requested periodic Data Identifiers to be used by the server
u32_periodic_data_id_len – [in] - Length of periodic data ID
ptr_periodic_data_id – [in] - Pointer to the periodic data ID which need to be read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_2ah_read_data_by_periodic_id_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_resp)
Called when a response to read data by periodic id is received.
This function is called when a response to read data by periodic id is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_resp – [in] - Pointer to the data read from server
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_read_dtc_info(rs_handle_t uds_client_handle, uint8_t u8_report_type, uint8_t *ptr_record, uint16_t u16_record_len)
Requests to read DTC information.
This function sends a read DTC information request(0x19) to read.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_report_type – [in] - Report type
ptr_record – [in] - Data to be sent, if any
u16_record_len – [in] - Number of bytes to be sent
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_19h_read_dtc_info_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_report_type, uint8_t *ptr_resp, uint16_t u16_resp_len)
Called when a response to read DTC information is received.
This function is called when a response to read DTC information is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
u8_report_type – [in] - Report type
ptr_resp – [in] - Pointer to the data read from server
u16_resp_len – [in] - Number of bytes of data read
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_transmit_confirm(rs_uds_client_instance_t *ptr_instance, rs_ret_val_t reason)
Called when there is an update on the last transmit request.
This function is called when the server updates the successful delivery of last request or failure to do so
- Parameters:
ptr_instance – [in] - Pointer to the UDS client instance information
reason – [in] - Update reason such as RS_ISO15765_SERVICE_COMM_DATA_CONFIRM, RS_ISO15765_SERVICE_COMM_N_TIMEOUT_A etc
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rcb_uds_client_error_resp(rs_handle_t uds_handle, uint8_t u8_service, uint8_t u8_error_code)
Called when the server responds with error for a request.
This function is called when the server returns error for a request
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_service – [in] -Service code that failed such as RS_ISO14229_SI_ECU_RESET
u8_error_code – [in] - Error code such as RS_ISO14229_NRC_CONDITIONS_NOT_CORRECT, RS_ISO14229_NRC_GENERAL_PROGRAMMING_FAILURE etc
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_enable_pos_resp_suppression(rs_handle_t uds_client_handle, uint8_t u8_do_suppress)
Enables suppression of positive response from server.
This function can be used to disable/enable suppression of positive response messages from server
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_do_suppress – [in] - Non-zero value to suppress and zero not to suppress
- Returns:
Zero on success or error code on failure
-
rs_ret_val_t rs_uds_client_req_upload(rs_handle_t uds_client_handle, uint8_t u8_data_format, uint32_t u32_mem_addr, uint8_t u8_addr_len, uint32_t u32_mem_size, uint8_t u8_mem_len)
Requests upload the data.
This function sends a upload data request (0x35) to initiate a data transfer from the server to the client.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_data_format – [in] - Data format being sent
u32_mem_addr – [in] - Memory address is the starting address of server memory from which data is to be retrieved.
u8_addr_len – [in] - Number of bytes to be used to send the Address
u32_mem_size – [in] - Number of bytes to read from server
u8_mem_len – [in] - Number of bytes to be used to send the size information
- Returns:
Zero on success or negative on failure
-
rs_ret_val_t rcb_uds_client_35h_req_upload_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t *ptr_data, uint8_t u8_max_block_len)
Called when a response to upload data is received.
This function is called when a upload data response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code received, if any
ptr_data – [in] - Pointer to the data read from server
u32_max_block_len – [in] - Maximum number bytes of data to be receive per block
- Returns:
Zero on success or negative on failure
-
rs_ret_val_t rs_uds_client_req_response_on_event(rs_handle_t uds_client_handle, uint8_t u8_sub_function, void *ptr_config, uint32_t u32_config_len)
Requests a server to start or stop transmission of responses on a specified event.
This function sends a response on event request(0x86) to start or stop transmission of responses on a specified event in server.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
u8_sub_function – [in] - Event type like store event or do not store event
ptr_config – [in] - Pointer to the request data structure
u32_config_len – [in] - length of the request data structure
- Returns:
Zero on success or negative on failure
-
rs_ret_val_t rcb_uds_client_86h_resp_on_event_resp(rs_handle_t uds_handle, uint8_t u8_event_type, uint8_t u8_number_of_active_events, uint8_t u8_event_window_time, uint8_t *ptr_resp)
Called when a response to response on event is received.
This function is called when a response on event response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_event_type – [in] - event type
u8_number_of_active_events – [in] - Number of activated events
u8_event_window_time – [in] - Event window time
ptr_resp – [in] - Pointer to the response data
- Returns:
Zero on success or negative on failure
-
rs_ret_val_t rcb_uds_client_2ch_ddid_resp(rs_handle_t uds_handle, uint8_t u8_err_code, uint8_t u8_type, uint8_t *ptr_resp)
Called when a response to dynamic define data ID is received.
This function is called when a dynamic define data ID response is received from the server.
- Parameters:
uds_handle – [in] - Handle to the UDS client instance
u8_err_code – [in] - Error code, if any
u8_type – [in] - sub-function parameter from the request message.
ptr_resp – [in] - Pointer to the response data
- Returns:
Zero on success or negative on failure
-
rs_ret_val_t rs_uds_client_docan_callback(void *ptr_instance, rs_ret_val_t reason, rs_an_tp_msg_t *ptr_msg)
Called when DoCAN callback function called with appropriate reasons.
This function is called when DoCAN callback function called with appropriate reasons.
- Parameters:
ptr_instance – [in] - Pointer to the instance information
reason – [in] - Reason to called the callback function.
ptr_msg – [in] - Pointer to the received data
- Returns:
None
-
rs_ret_val_t rs_uds_client_doip_callback(void *ptr_instance, rs_ret_val_t reason, rs_an_tp_msg_t *ptr_msg)
Called when DoIP callback function called with appropriate reasons.
This function is called when DoIP callback function called with appropriate reasons.
- Parameters:
ptr_instance – [in] - Pointer to the instance information
reason – [in] - Reason to called the callback function.
ptr_msg – [in] - Pointer to the received data
- Returns:
None
-
rs_ret_val_t rs_uds_client_req_dynamically_define_data_id(rs_handle_t uds_client_handle, uint8_t *ptr_config, uint32_t u32_ddid_len)
Request to dynamically define data ID.
This function is called to initiate dynamically define data ID service.
- Parameters:
uds_client_handle – [in] - Handle to the UDS client instance
ptr_config – [in] - Pointer to the configuration details of data id .
u32_ddid_len – [in] - length of the DDID
- Returns:
Return 0 on success and negative on failure
-
rs_ret_val_t rs_uds_client_close(rs_handle_t uds_client_handle)
Function to free the UDS Client handle.
This function used to free the UDS Client handle
- Parameters:
uds_client_handle – [in] - Handle of the UDS client instance information
- Returns:
Return 0 on success or error code on failure
-
struct tag_rs_uds_client_config
- #include <rs_uds_client.h>
Contains information about UDS client configuration.
Public Members
-
uint8_t state
State.
-
uint8_t state
-
struct tag_rs_uds_client_instance
- #include <rs_uds_client.h>
Contains information about UDS client.
Public Members
-
rs_handle_t tp_handle
Transport Handle with corresponding type (DoIP/ DoCAN)
-
rs_uds_client_config_t *ptr_uds_client_config
Pointer to the UDS client configuration.
-
rs_buffer_mgr_t rx_msg_mgr
RX message FIFO.
-
void *arr_rx_msgs[RS_UDS_CLIENT_MAX_NUM_RX_MSGS]
Pointer array to hold incoming messages.
-
void *ptr_handlers
List of Client service handlers.
-
uint8_t pos_resp_suppress
Enable/disable positive response suppression.
-
uint8_t num_handlers
Number of Client service handlers.
-
rs_search_mgr_t si_search_mgr
Search manager for service handlers.
-
rs_handle_t tp_handle