PCAN-UDS-API UserMan Eng
PCAN-UDS-API UserMan Eng
x API
API Implementation of the UDS Standard
(ISO 14229-1:2013)
User Manual
PCAN® is a registered trademark of PEAK-System Technik GmbH. Other product names in this document may be the trademarks or
registered trademarks of their respective companies. They are not explicitly marked by ™ or ®.
www.peak-system.com
[email protected]
Technical support:
E-mail: [email protected]
Forum: forum.peak-system.com
2
PCAN-UDS 2.x API – User Manual
Contents
2 Introduction 11
2.1 Understanding PCAN-UDS 2.x 11
2.2 Using PCAN-UDS 2.x 12
2.3 Features 12
2.4 System Requirements 12
2.5 Scope of Supply 12
2.6 Backward Compatibility Notes 13
2.6.1 PCAN-ISO-TP Compatibility 13
2.6.2 Binary Compatibility 13
2.6.3 Code Compatibility 13
2.6.4 Remark 14
3
PCAN-UDS 2.x API – User Manual
3.5.23 uds_svc_param_rdtci 88
3.5.24 uds_svc_param_rdtci_dtcsvm 91
3.5.25 uds_svc_param_iocbi 92
3.5.26 uds_svc_param_rc 93
3.5.27 uds_svc_param_rc_rid 94
3.5.28 uds_svc_param_atp 95
3.5.29 uds_svc_param_rft_moop 96
3.5.30 uds_svc_authentication_subfunction 98
3.5.31 uds_svc_authentication_return_parameter 99
3.6 PCAN-ISO-TP 3.x Dependencies 101
3.6.1 cantp_bitrate 101
3.6.2 cantp_timestamp 104
3.6.3 cantp_handle 105
3.6.4 cantp_hwtype 113
3.6.5 cantp_isotp_addressing 115
3.6.6 cantp_baudrate 116
3.6.7 cantp_msg 118
3.6.8 cantp_can_msgtype 121
3.6.9 cantp_msgtype 123
3.6.10 cantp_can_info 124
3.6.11 cantp_msgdata 125
3.6.12 cantp_msgdata_can 126
3.6.13 cantp_msgdata_canfd 128
3.6.14 cantp_msgdata_isotp 129
3.6.15 cantp_msgflag 131
3.6.16 cantp_netstatus 132
3.6.17 cantp_netaddrinfo 134
3.6.18 cantp_isotp_msgtype 136
3.6.19 cantp_isotp_format 137
3.7 Methods 139
3.7.1 Initialize_2013 142
3.7.2 Initialize_2013(cantp_handle, cantp_baudrate) 142
3.7.3 Initialize_2013(cantp_handle, cantp_baudrate,
cantp_hwtype, UInt32, UInt16) 145
3.7.4 InitializeFD_2013 148
3.7.5 Uninitialize_2013 151
3.7.6 SetValue_2013 153
3.7.7 SetValue_2013(cantp_handle, uds_parameter, UInt32,
Uint32) 154
3.7.8 SetValue_2013(cantp_handle, uds_parameter, String,
UInt32) 156
3.7.9 SetValue_2013(cantp_handle, uds_parameter, Byte[],
Uint32) 158
3.7.10 SetValue_2013(cantp_handle, uds_parameter, IntPtr,
UInt32) 160
3.7.11 AddMapping_2013 164
3.7.12 RemoveMapping_2013 168
3.7.13 RemoveMappingByCanId_2013 171
3.7.14 AddCanIdFilter_2013 175
3.7.15 RemoveCanIdFilter_2013 176
3.7.16 GetValue_2013 178
3.7.17 GetValue_2013(cantp_handle, uds_parameter, String,
UInt32) 179
3.7.18 GetValue_2013(cantp_handle, uds_parameter, UInt32,
UInt32) 181
3.7.19 GetValue_2013(cantp_handle, uds_parameter, Byte[],
UInt32) 184
4
PCAN-UDS 2.x API – User Manual
5
PCAN-UDS 2.x API – User Manual
6
PCAN-UDS 2.x API – User Manual
7
PCAN-UDS 2.x API – User Manual
8
PCAN-UDS 2.x API – User Manual
9
PCAN-UDS 2.x API – User Manual
Welcome to the documentation of PCAN-UDS 2.x API, a PEAK CAN API that implements ISO 14229-1:2013,
UDS in CAN, an international standard that allows a diagnostic tester (client) to control diagnostic functions
in an on-vehicle Electronic Control Unit (ECU or server).
In the following chapters, you will find all the information needed to take advantage of this API.
Introduction on page 11
DLL API Reference on page 15
Additional Information on page 769
10
PCAN-UDS 2.x API – User Manual
2 Introduction
PCAN-UDS 2.x is a simple programming interface intended to support Windows automotive applications
that use PEAK-Hardware to communicate with Electronic Control Units (ECU) connected to the bus systems
of a car, for maintenance purpose.
11
PCAN-UDS 2.x API – User Manual
Initialization: To perform UDS on CAN communication using a channel, it is necessary to initialize it first.
This is done by making a call to the function UDS_Initialize_2013 (class-method: Initialize_2013 ).
Interaction: After successful initialization, a channel is ready to communicate with the connected CAN bus.
Further configuration is not needed. The functions starting with UDS_Svc (class-methods: starting with Svc )
can be used to transmit UDS requests and the utility functions starting with UDS_WaitFor (class-methods:
starting with WaitFor ) are used to retrieve the results of a previous request. The UDS_Read_2013 and
UDS_Write_2013 (class-methods: Read_2013 and Write_2013 ) are lower-level functions to read and write UDS
messages from scratch. If desired, an extra configuration can be made to improve a communication
session, like service request timeouts or PCAN-ISO-TP 3.x parameters.
2.3 Features
Implementation of the UDS protocol (14229-1:2013) for the communication with control units
Windows DLLs for the development of applications for the platforms Windows® 11 (x64/ARM64), 10
(x86/x64)
Physical communication via CAN using a CAN interface of the PCAN series
Uses the PCAN-Basic programming interface to access the CAN hardware in the computer
Uses the PCAN-ISO-TP 3.x programming interface (ISO 15765-2) for the transfer of data packages up to
4 Gigabytes via the CAN bus
12
PCAN-UDS 2.x API – User Manual
However, in some cases, a known issue can occur: writing UDS message or calling service function returns
an unexpected PUDS_ERROR_ALREADY_INITIALIZED error. This new error occurred when PCAN-UDS 2.x detects
that a message with the same service identifier is already pending in the reception queue (see
PUDS_STATUS_SERVICE_ALREADY_PENDING in uds_status on page 32): this could lead to a possible shift between
similar UDS requests and their responses. To correct this issue, the user must read a response for his
previous request before writing the new message or clear the reception queue by calling UDS_Reset .
All these files are included in the PCAN-UDS package under the folder “Include” (header files with suffix
_2013) and its subfolder “Backward Compatibility” (other header files).
Note: In C/C++: This header doesn’t include the required dependency “Window.h”. It may be needed
to include this reference manually, depending on the configuration of the project.
13
PCAN-UDS 2.x API – User Manual
C/C++ projects:
1. Copy all 3 header files, PCAN-UDS.h, PCAN-UDS_2006.h, and PCAN-UDS_2013.h into the project
folder.
Note: The header file called PCAN-UDS.h will be replaced by the new backward-compatible header
file of the same name. This header ensures that the old interface, i.e. all function prototypes from
the PCAN-UDS 1.x API, and also the new interface introduced with version 2.0, are available for the
project.
.NET and Delphi projects (Support for the revision 2006 only):
1. Copy the header file PCAN-UDS_2006.* (for Delphi, PUDS_2006.pas) into the project folder.
2. Load the project / solution.
3. Exclude the file PCAN-UDS.* (for Delphi, PUDS.pas) from the project.
4. Include the file PCAN-UDS_2006.* (for Delphi, PUDS_2006.pas) to the project.
5. Save and compile the project / solution.
.NET and Delphi projects (Support for both revisions, 2006 and 2013):
1. Copy the header files PCAN-UDS_2006.*, and PCAN-UDS_2013.* (for Delphi, PUDS_2006.pas
and PUDS_2013.pas) into the project folder.
2. Exclude the file PCAN-UDS.* (for Delphi, PUDS.pas) from the project.
3. Include the files PCAN-UDS_2006.*, PCAN-UDS_2013.* (for Delphi, PUDS_2006.pas and
PUDS_2013.pas).
4. Edit the file PCAN-UDS_2013.* (for Delphi, PUDS_2013.pas), and enable the commented define
directive for PUDS_API_COMPATIBILITY_ISO_2006 , within the description of the header file.
5. Save and compile the project / solution.
2.6.4 Remark
Beginning with version 2.1, the parameters of UDS_WaitFor*_2013 functions have a new order. They
do not keep the order of the previous version.
14
PCAN-UDS 2.x API – User Manual
This section contains information about the data types (classes, structures, types, defines, enumerations)
and API functions which are contained in the PCAN-UDS 2.x API.
3.1 Namespaces
PEAK offers the implementation of some specific programming interfaces as namespaces for the .NET
Framework programming environment. The following namespaces are available:
Namespaces
Name Description
{} Peak Contains all namespaces that are part of the managed programming environment from PEAK-System
{} Peak.Can Contains types and classes for using the PCAN API from PEAK-System
{} Peak.Can.Light Contains types and classes for using the PCAN-Light API from PEAK-System
{} Peak.Can.Basic Contains types and classes for using the PCAN-Basic API from PEAK-System
{} Peak.Can.Ccp Contains types and classes for using the CCP API implementation from PEAK-System
{} Peak.Can.Xcp Contains types and classes for using the XCP API implementation from PEAK-System
{} Peak.Can.IsoTp Contains types and classes for using the PCAN-ISO-TP 3.x API implementation from PEAK-System
{} Peak.Can.Uds Contains types and classes for using the PCAN-UDS 2.x API implementation from PEAK-System
{} Peak.Can.ObdII Contains types and classes for using the PCAN-OBDII API implementation from PEAK-System
{} Peak.Lin Contains types and classes used to handle with LIN devices from PEAK-System
{} Peak.RP1210A Contains types and classes used to handle with CAN devices from PEAK-System through the TMC
Recommended Practices 1210, version A, as known as RP1210(A)
3.1.1 Peak.Can.Uds
The Peak.Can.Uds namespace contains types and classes to use the PCAN-UDS 2.x API within the .NET
Framework programming environment and handle PCAN devices from PEAK-System.
Remarks
Under the Delphi environment, these elements are enclosed in the PUDS-Unit. The functionality of all
elements included here is just the same. The difference between this namespace and the Delphi unit
consists in the fact that Delphi accesses the Windows API directly (it is not Managed Code).
Classes
Class Description
UDSApi Defines a class which represents the PCAN-UDS 2.x API.
Structures
Structure Description
uds_msg Represents the content of a UDS message.
uds_mapping Represents a mapping between a network address information and a CAN identifier.
15
PCAN-UDS 2.x API – User Manual
uds_msgaccess This structure provides accessors to the corresponding data in the uds_msg structure.
Enumerations
Name Description
uds_errstatus Represents PUDS error codes (used in uds_status)
uds_status Represents a PUDS status or error code.
uds_parameter Represents a PUDS parameter to be read or set.
uds_service Represents a service identifier defined in ISO 14229-1.
uds_address Represents a standardized ISO-15765-4 address.
uds_can_id Represents a standardized ISO-15765-4 CAN identifier.
uds_msgprotocol Represents a standardized and supported network communication protocol.
uds_status_offset Defines constants used by the uds_status enumeration.
uds_msgtype Represents types and flags for a uds_msg.
uds_nrc Represents a UDS negative response code (NRC).
uds_svc_param_dsc Represents the subfunction parameter for the UDS service DiagnosticSessionControl.
uds_svc_param_er Represents the subfunction parameter for the UDS service ECUReset.
uds_svc_param_cc Represents the subfunction parameter for the UDS service CommunicationControl.
uds_svc_param_tp Represents the subfunction parameter for the UDS service TesterPresent.
uds_svc_param_cdtcs Represents the subfunction parameter for the UDS service ControlDTCSetting.
uds_svc_param_roe Represents the subfunction parameter for the UDS service ResponseOnEvent.
uds_svc_param_roe_recommended_se Represents the recommended service to respond to for the UDS service
rvice_id ResponseOnEvent.
uds_svc_param_lc Represents the subfunction parameter for the UDS service LinkControl.
uds_svc_param_lc_baudrate_identifier Represents the standard baud rate identifier for the UDS service LinkControl.
uds_svc_param_di Represents the data identifier parameter for the UDS services like
ReadDataByIdentifier.
uds_svc_param_rdbpi Represents the subfunction parameter for the UDS service
ReadDataByPeriodicIdentifier.
uds_svc_param_dddi Represents the subfunction parameter for the UDS service
DynamicallyDefineDataIdentifier.
uds_svc_param_rdtci Represents the subfunction parameter for the UDS service ReadDTCInformation.
uds_svc_param_rdtci_dtcsvm Represents the DTC severity mask for the UDS service ReadDTCInformation.
uds_svc_param_iocbi Represents the subfunction parameter for the UDS service
InputOutputControlByIdentifier.
uds_svc_param_rc Represents the subfunction parameter for the UDS service RoutineControl.
uds_svc_param_rc_rid Represents the routine identifier for the UDS service RoutineControl.
uds_svc_param_atp Represents the subfunction parameter for the UDS service AccessTimingParameter.
uds_svc_param_rft_moop Represents the mode of operation parameter for the UDS service RequestFileTransfer.
uds_svc_authentication_subfunction Represents the subfunction parameter for UDS service Authentication.
uds_svc_authentication_return_parame Represents the return parameter for UDS service Authentication.
ter
16
PCAN-UDS 2.x API – User Manual
3.2 Units
PEAK offers the implementation of some specific programming interfaces as Units for the Delphi’s
programming environment. The following units are available to be used:
Namespaces
Alias Description
{} PUDS Unit. Delphi unit for using the PCAN-UDS 2.x API from PEAK-System.
Remarks
For the .NET Framework, these elements are enclosed in the Peak.Can.Uds namespace. The functionality of
all elements included here is just the same. The difference between this Unit and the .NET namespace
consists in the fact that Delphi accesses the Windows API directly (it is not Managed Code).
Classes
Class Description
TUdsApi Defines a class which represents the PCAN-UDS 2.x API.
Structures
Structure Description
uds_msg Represents the content of a UDS message.
uds_mapping Represents a mapping between a network address information and a CAN identifier.
uds_msgaccess This structure provides accessors to the corresponding data in the uds_msg structure.
Enumerations
Name Description
uds_errstatus Represents PUDS error codes (used in uds_status)
uds_status Represents a PUDS status or error code.
uds_parameter Represents a PUDS parameter to be read or set.
uds_service Represents a service identifier defined in ISO 14229-1.
uds_address Represents a standardized ISO-15765-4 address.
uds_can_id Represents a standardized ISO-15765-4 CAN identifier.
uds_msgprotocol Represents a standardized and supported network communication protocol.
uds_status_offset Defines constants used by the uds_status enumeration.
uds_msgtype Represents types and flags for a uds_msg.
uds_ Represents a UDS negative response code (NRC).
uds_svc_param_dsc Represents the subfunction parameter for the UDS service DiagnosticSessionControl.
uds_svc_param_er Represents the subfunction parameter for the UDS service ECUReset.
uds_svc_param_cc Represents the subfunction parameter for the UDS service CommunicationControl.
17
PCAN-UDS 2.x API – User Manual
Name Description
uds_svc_param_tp Represents the subfunction parameter for the UDS service TesterPresent.
uds_svc_param_cdtcs Represents the subfunction parameter for the UDS service ControlDTCSetting.
uds_svc_param_roe Represents the subfunction parameter for the UDS service ResponseOnEvent.
uds_svc_param_roe_recommend Represents the recommended service to respond to for the UDS service ResponseOnEvent.
ed_service_id
uds_svc_param_lc Represents the subfunction parameter for the UDS service LinkControl.
uds_svc_param_lc_baudrate_ide Represents the standard baud rate identifier for the UDS service LinkControl.
ntifier
uds_svc_param_di Represents the data identifier parameter for the UDS services like ReadDataByIdentifier.
uds_svc_param_rdbpi Represents the subfunction parameter for the UDS service ReadDataByPeriodicIdentifier.
uds_svc_param_dddi Represents the subfunction parameter for the UDS service DynamicallyDefineDataIdentifier.
uds_svc_param_rdtci Represents the subfunction parameter for the UDS service ReadDTCInformation.
uds_svc_param_rdtci_dtcsvm Represents the DTC severity mask for the UDS service ReadDTCInformation.
uds_svc_param_iocbi Represents the subfunction parameter for the UDS service InputOutputControlByIdentifier.
uds_svc_param_rc Represents the subfunction parameter for the UDS service RoutineControl.
uds_svc_param_rc_rid Represents the routine identifier for the UDS service RoutineControl.
uds_svc_param_atp Represents the subfunction parameter for the UDS service AccessTimingParameter.
uds_svc_param_rft_moop Represents the mode of operation parameter for the UDS service RequestFileTransfer.
uds_svc_authentication_subfunct Represents the subfunction parameter for UDS service Authentication.
ion
uds_svc_authentication_return_p Represents the return parameter for UDS service Authentication.
arameter
18
PCAN-UDS 2.x API – User Manual
3.3 Classes
The following classes are offered to make use of the PCAN-UDS 2.x API in a managed or unmanaged
way.
Classes
Class Description
UDSApi Defines a class to use the PCAN-UDS 2.x API within the Microsoft's .NET Framework programming
environment.
TUdsApi Defines a class to use the PCAN-UDS 2.x API within the Delphi programming environment.
3.3.1 UDSApi
Defines a class that represents the PCAN-UDS 2.x API to be used within the Microsoft's .NET Framework.
Syntax
C#
C++ / CLR
Visual Basic
Remarks
The UDSApi class collects and implements the PCAN-UDS 2.x API methods. Each method is called just like
the API function with the exception that the prefix UDS_ is not used. The structure and functionality of the
methods and API functions are the same.
Within the .NET Framework from Microsoft, the UDSApi class is a static, not inheritable, class. It must directly
be used, without any instance of it, e.g.:
uds_status res;
// Static use, without any instance
//
res = UDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
cantp_baudrate.PCANTP_BAUDRATE_500K);
3.3.2 TUDSApi
Defines a class which represents the PCAN-UDS 2.x API to be used within the Delphi programming
environment.
19
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
TUDSApi = class
Remarks
TUDSApi is a class containing only class-methods and constant members, allowing their use without the
creation of any object, just like a static class of other programming languages. It collects and implements
the PCAN-UDS 2.x API functions. Each method is called just like the API function with the exception that
the prefix UDS_ is not used. The structure and functionality of the methods and API functions are the same.
20
PCAN-UDS 2.x API – User Manual
3.4 Structures
The PCAN-UDS 2.x API defines the following structures:
Name Description
uds_msg Represents the content of a UDS message.
uds_mapping Represents a mapping between a network address information and a CAN identifier.
uds_msgaccess This structure provides accessors to the corresponding data in the uds_msg structure.
3.4.1 uds_msg
Represents the content of a UDS message.
Syntax
C/C++
Pascal OO
uds_msg = record
typem: uds_msgtype;
links: uds_msgaccess;
msg: cantp_msg;
End;
C#
C++ / CLR
21
PCAN-UDS 2.x API – User Manual
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure uds_msg
<MarshalAs(UnmanagedType.U4)>
Public type As uds_msgtype
Public links As uds_msgaccess
Public msg As cantp_msg
End Structure
Fields
Name Description
type Type and flags of the message (see uds_msgtype on page 63).
links Quick accessors to the message data (see uds_msgaccess on page 28).
msg The PCANTP message encapsulating the UDS data (see cantp_msg on page 118).
Remarks
The uds_msg structure is automatically initialized and allocated by the PCAN-UDS 2.x API using:
Once processed, the uds_msg structure should be released using UDS_MsgFree_2013 function or MsgFree_2013
method.
Some message related values are predefined in the API: see Messages Related Definitions on page 766.
3.4.2 uds_sessioninfo
Represents the diagnostic session information of a server (ECU).
Syntax
C/C++
Pascal OO
uds_sessioninfo = record
nai: uds_netaddrinfo;
can_msg_type: cantp_can_msgtype;
session_type: Byte;
timeout_p2can_server_max: UInt16;
22
PCAN-UDS 2.x API – User Manual
timeout_enhanced_p2can_server_max: UInt16;
s3_client_ms: UInt16;
End;
C#
C++ / CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure uds_sessioninfo
Public nai As uds_netaddrinfo
<MarshalAs(UnmanagedType.U4)>
Public can_msg_type As cantp_can_msgtype
Public session_type As Byte
Public timeout_p2can_server_max As UInt16
Public timeout_enhanced_p2can_server_max As UInt16
Public s3_client_ms As UInt16
End Structure
Fields
Name Description
nai Network Addressing Information (see uds_netaddrinfo on page 24).
can_msg_type Type and flags of the CAN/CAN FD frame (see cantp_can_msgtype on page 121).
session_type Currently activated diagnostic session type (see uds_svc_param_dsc on page 71).
timeout_p2can_server_max Default P2 CAN server max timing for the activated session (i.e. maximum time allowed for
the ECU to transmit a response indication).
timeout_enhanced_p2can_server_max Enhanced P2 CAN server max timing for the activated session (i.e. maximum time allowed
for the ECU to transmit a response indication after having sent a negative response code
stating that more time is required: PUDS_NRC_EXTENDED_TIMING, 0x78). Warning:
according to the ISO 14229-2, the resolution of this parameter is 10ms.
s3_client_ms Time between two TesterPresents (using a null s3 timing will disable automatic
TesterPresent).
23
PCAN-UDS 2.x API – User Manual
3.4.3 uds_netaddrinfo
Represents the network addressing information of a UDS message.
Syntax
C/C++
Pascal OO
uds_netaddrinfo = record
protocol: uds_msgprotocol;
target_type: cantp_isotp_addressing;
source_addr: UInt16;
target_addr: UInt16;
extension_addr: Byte;
End;
C#
[StructLayout(LayoutKind.Sequential, Pack = 8)]
public struct uds_netaddrinfo
{
[MarshalAs(UnmanagedType.U4)]
public uds_msgprotocol protocol;
[MarshalAs(UnmanagedType.U4)]
public cantp_isotp_addressing target_type;
public UInt16 source_addr;
public UInt16 target_addr;
public Byte extension_addr;
}
24
PCAN-UDS 2.x API – User Manual
C++ / CLR
[StructLayout(LayoutKind::Sequential, Pack = 8)]
public value struct uds_netaddrinfo
{
[MarshalAs(UnmanagedType::U4)]
uds_msgprotocol protocol;
[MarshalAs(UnmanagedType::U4)]
cantp_isotp_addressing target_type;
UInt16 source_addr;
UInt16 target_addr;
Byte extension_addr;
};
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure uds_netaddrinfo
<MarshalAs(UnmanagedType.U4)>
Public protocol As uds_msgprotocol
<MarshalAs(UnmanagedType.U4)>
Public target_type As cantp_isotp_addressing
Public source_addr As UInt16
Public target_addr As UInt16
Public extension_addr As Byte
End Structure
Fields
Name Description
protocol Represents the protocol being used for communication (see uds_msgprotocol
on page 61).
target_type Represents the target address type (see cantp_isotp_addressing 115).
source_addr Represents the source address (see uds_address on page 56).
target_addr Represents the target address (see uds_address on page 56).
extension_addr Represents the extension address (see uds_address on page 56).
See also: uds_address on page 56, cantp_isotp_addressing on page 115, uds_msgprotocol on page 61.
3.4.4 uds_mapping
Represents a mapping between a network address information and a CAN identifier.
Syntax
C/C++
Pascal OO
uds_mapping = record
uid: Pointer;
can_id: UInt32;
25
PCAN-UDS 2.x API – User Manual
can_id_flow_ctrl: UInt32;
can_msgtype: cantp_can_msgtype;
can_tx_dlc: Byte;
nai: uds_netaddrinfo;
End;
C#
C++ / CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure uds_mapping
Public uid As UIntPtr
Public can_id As UInt32
Public can_id_flow_ctrl As UInt32
<MarshalAs(UnmanagedType.U4)>
Public can_msgtype As cantp_can_msgtype
Public can_tx_dlc As Byte
Public nai As uds_netaddrinfo
End Structure
Fields
Name Description
uid Read only, mapping's unique identifier.
can_id CAN identifier mapped to the network address information (see predefined uds_can_id values on page 58).
can_id_flow_ctrl CAN identifier used for the flow control frame, formerly response CAN identifier (see predefined uds_can_id
values on page 58).
can_msgtype CAN frame message type, only PCANTP_CAN_MSGTYPE_STANDARD or
PCANTP_CAN_MSGTYPE_EXTENDED is mandatory (see cantp_can_msgtype on page 121).
can_tx_dlc Default CAN DLC value to use with segmented messages. Value can be 8 or more if CAN FD communication
is supported. If non-zero, this value will supersede parameter PUDS_PARAMETER_CAN_TX_DL for
communications involving this mapping.
nai Network Addressing Information (see uds_netaddrinfo on page 24).
26
PCAN-UDS 2.x API – User Manual
Remark
By default, some mappings are initialized in the PCAN-UDS 2.x API. See UDS and ISO-TP Network
Addressing Information on page 771.
See also: UDS_AddMapping_2013 on page 632, UDS_RemoveMapping_2013 on page 635, AddMapping_2013 on page
164, RemoveMapping_2013 on page 168.
3.4.5 uds_msgconfig
Represents a PUDS message ( uds_msg ) configuration.
Syntax
C/C++
Pascal OO
uds_msgconfig = record
typem: uds_msgtype;
nai: uds_netaddrinfo;
can_id: UInt32;
can_msgtype: cantp_can_msgtype;
can_tx_dlc: Byte;
End;
C#
C++ / CLR
27
PCAN-UDS 2.x API – User Manual
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure uds_msgconfig
<MarshalAs(UnmanagedType.U4)>
Public type As uds_msgtype
Public nai As uds_netaddrinfo
Public can_id As UInt32
<MarshalAs(UnmanagedType.U4)>
Public can_msgtype As cantp_can_msgtype
Public can_tx_dlc As Byte
End Structure
Fields
Name Description
type Message specific flags (see uds_msgtype on page 63).
nai Message Network Addressing Information (see uds_netaddrinfo on page 24).
can_id Optional, CAN identifier (see predefined uds_can_id values on page 58).
can_msgtype Optional flags for the CAN layer: 29 bits CAN-ID, FD, BRS etc. (see cantp_can_msgtype on page 121).
can_tx_dlc If non-zero, Data Length Code of the frame (see Remarks below).
Remarks
Specifying a non-zero dlc value in this structure will set message’s can_info.dlc field with this value. That
means when the message will be written the value can_tx_dlc of the corresponding mapping and the value
of the parameter PUDS_PARAMETER_CAN_TX_DL will be overridden (see uds_mapping on page 25, uds_parameter
on page 41, cantp_can_info on page 124).
See also: UDS_MsgAlloc_2013 on page 644, MsgAlloc_2013 on page 211, UDS_Scv functions, Svc methods.
3.4.6 uds_msgaccess
This structure provides accessors to the corresponding data in the uds_msg structure.
Syntax
C/C++
Pascal OO
uds_msgaccess = record
service_id: ^Byte;
param: ^Byte;
nrc: ^Byte;
End;
C#
28
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure uds_msgaccess
Public service_id As IntPtr
Public param As IntPtr
Public nrc As IntPtr
End Structure
Fields
Name Description
service_id Pointer to the UDS Service Identifier in message's data (see uds_service on page 53).
param Pointer to the first parameter in message's data.
nrc Pointer to the Negative Response Code in message's data, NULL on positive response (see uds_ on
page 63).
29
PCAN-UDS 2.x API – User Manual
3.5 Types
The PCAN-UDS 2.x API defines the following types:
Name Description
uds_errstatus Represents PUDS error codes (used in uds_status)
uds_status Represents a PUDS status or error code.
uds_parameter Represents a PUDS parameter to be read or set.
uds_service Represents UDS Service Identifiers defined in ISO 14229-1.
uds_address Represents a standardized ISO-15765-4 address.
uds_can_id Represents a standardized ISO-15765-4 CAN identifier.
uds_status_offset Defines constants used by the uds_status enumeration.
uds_msgprotocol Represents a standardized and supported network communication protocol.
uds_msgtype Represents types and flags for a uds_msg.
uds_nrc Represents a UDS negative response code (NRC).
uds_svc_param_dsc Represents the subfunction parameter for the UDS service
DiagnosticSessionControl.
uds_svc_param_er Represents the subfunction parameter for the UDS service ECUReset.
uds_svc_param_cc Represents the subfunction parameter for the UDS service
CommunicationControl.
uds_svc_param_tp Represents the subfunction parameter for the UDS service TesterPresent.
uds_svc_param_cdtcs Represents the subfunction parameter for the UDS service ControlDTCSetting.
uds_svc_param_roe Represents the subfunction parameter for the UDS service ResponseOnEvent.
uds_svc_param_roe_recommended_service_id Represents the recommended service to respond to for the UDS service
ResponseOnEvent.
uds_svc_param_lc Represents the subfunction parameter for the UDS service LinkControl.
uds_svc_param_lc_baudrate_identifier Represents the standard baud rate identifier for the UDS service LinkControl.
uds_svc_param_di Represents the data identifier parameter for the UDS services like
ReadDataByIdentifier.
uds_svc_param_rdbpi Represents the subfunction parameter for the UDS service
ReadDataByPeriodicIdentifier.
uds_svc_param_dddi Represents the subfunction parameter for the UDS service
DynamicallyDefineDataIdentifier.
uds_svc_param_rdtci Represents the subfunction parameter for the UDS service
ReadDTCInformation.
uds_svc_param_rdtci_dtcsvm Represents the DTC severity mask for the UDS service ReadDTCInformation.
uds_svc_param_iocbi Represents the subfunction parameter for the UDS service
InputOutputControlByIdentifier.
uds_svc_param_rc Represents the subfunction parameter for the UDS service RoutineControl.
uds_svc_param_rc_rid Represents the routine identifier for the UDS service RoutineControl.
uds_svc_param_atp Represents the subfunction parameter for the UDS service
AccessTimingParameter. It defines the access type.
uds_svc_param_rft_moop Represents the mode of operation parameter for the UDS service
RequestFileTransfer.
uds_svc_authentication_subfunction Represents the subfunction parameter for UDS service Authentication.
uds_svc_authentication_return_parameter Represents the return parameter for UDS service Authentication.
30
PCAN-UDS 2.x API – User Manual
3.5.1 uds_errstatus
Represents a UDS error codes used in uds_status (see uds_status on page 32).
Syntax
C/C++
Pascal OO
uds_errstatus = (
PUDS_ERRSTATUS_SERVICE_NO_MESSAGE = 1,
PUDS_ERRSTATUS_SERVICE_TIMEOUT_CONFIRMATION,
PUDS_ERRSTATUS_SERVICE_TIMEOUT_RESPONSE,
PUDS_ERRSTATUS_RESET,
PUDS_ERRSTATUS_ERROR_WAIT_FOR_P3_TIMING,
PUDS_ERRSTATUS_SERVICE_ALREADY_PENDING,
PUDS_ERRSTATUS_SERVICE_TX_ERROR,
PUDS_ERRSTATUS_SERVICE_RX_ERROR,
PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW,
);
C#
C++ / CLR
31
PCAN-UDS 2.x API – User Manual
PUDS_ERRSTATUS_SERVICE_RX_ERROR,
PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW,
PUDS_ERRSTATUS_MESSAGE_BUFFER_ALREADY_USED
};
Visual Basic
Values
Name Value Description
PUDS_ERRSTATUS_SERVICE_NO_MESSAGE 1 No message available.
PUDS_ERRSTATUS_SERVICE_TIMEOUT_CONFIRMATION 2 Timeout while waiting message confirmation (loopback).
PUDS_ERRSTATUS_SERVICE_TIMEOUT_RESPONSE 3 Timeout while waiting for request message response.
PUDS_ERRSTATUS_RESET 4 UDS reset error.
PUDS_ERRSTATUS_ERROR_WAIT_FOR_P3_TIMING 5 UDS wait for P3 timing error.
PUDS_ERRSTATUS_SERVICE_ALREADY_PENDING 6 A UDS request is already pending. A message with the
same service identifier is already pending in the reception
queue, the user must read a response for his previous
request before or clear the reception queues with
UDS_Reset_2013 (see UDS_Reset_2013 on page 652).
PUDS_ERRSTATUS_SERVICE_TX_ERROR 7 An error occurred during the transmission of the UDS
request message.
PUDS_ERRSTATUS_SERVICE_RX_ERROR 8 An error occurred during the reception of the UDS
response message.
PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW 9 Service received more messages than input buffer
expected.
PUDS_ERRSTATUS_MESSAGE_BUFFER_ALREADY_USED 10 Given message buffer is already allocated, user must
release buffer with UDS_MsgFree_2013 or MsgFree_2013
before reusing it.
3.5.2 uds_status
Represents a PUDS status or error code.
Syntax
C/C++
32
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_MAPPING_INVALID = PCANTP_STATUS_MAPPING_INVALID,
PUDS_STATUS_MAPPING_ALREADY_INITIALIZED = PCANTP_STATUS_MAPPING_ALREADY_INITIALIZED,
PUDS_STATUS_PARAM_BUFFER_TOO_SMALL = PCANTP_STATUS_PARAM_BUFFER_TOO_SMALL,
PUDS_STATUS_QUEUE_TX_FULL = PCANTP_STATUS_QUEUE_TX_FULL,
PUDS_STATUS_LOCK_TIMEOUT = PCANTP_STATUS_LOCK_TIMEOUT,
PUDS_STATUS_HANDLE_INVALID = PCANTP_STATUS_HANDLE_INVALID,
PUDS_STATUS_UNKNOWN = PCANTP_STATUS_UNKNOWN,
PUDS_STATUS_FLAG_BUS_LIGHT = PCANTP_STATUS_FLAG_BUS_LIGHT,
PUDS_STATUS_FLAG_BUS_HEAVY = PCANTP_STATUS_FLAG_BUS_HEAVY,
PUDS_STATUS_FLAG_BUS_WARNING = PCANTP_STATUS_FLAG_BUS_WARNING,
PUDS_STATUS_FLAG_BUS_PASSIVE = PCANTP_STATUS_FLAG_BUS_PASSIVE,
PUDS_STATUS_FLAG_BUS_OFF = PCANTP_STATUS_FLAG_BUS_OFF,
PUDS_STATUS_FLAG_BUS_ANY = PCANTP_STATUS_FLAG_BUS_ANY,
PUDS_STATUS_FLAG_NETWORK_RESULT = PCANTP_STATUS_FLAG_NETWORK_RESULT,
PUDS_STATUS_NETWORK_TIMEOUT_A = PCANTP_STATUS_NETWORK_TIMEOUT_A,
PUDS_STATUS_NETWORK_TIMEOUT_Bs = PCANTP_STATUS_NETWORK_TIMEOUT_Bs,
PUDS_STATUS_NETWORK_TIMEOUT_Cr = PCANTP_STATUS_NETWORK_TIMEOUT_Cr,
PUDS_STATUS_NETWORK_WRONG_SN = PCANTP_STATUS_NETWORK_WRONG_SN,
PUDS_STATUS_NETWORK_INVALID_FS = PCANTP_STATUS_NETWORK_INVALID_FS,
PUDS_STATUS_NETWORK_UNEXP_PDU = PCANTP_STATUS_NETWORK_UNEXP_PDU,
PUDS_STATUS_NETWORK_WFT_OVRN = PCANTP_STATUS_NETWORK_WFT_OVRN,
PUDS_STATUS_NETWORK_BUFFER_OVFLW = PCANTP_STATUS_NETWORK_BUFFER_OVFLW,
PUDS_STATUS_NETWORK_ERROR = PCANTP_STATUS_NETWORK_ERROR,
PUDS_STATUS_NETWORK_IGNORED = PCANTP_STATUS_NETWORK_IGNORED,
PUDS_STATUS_CAUTION_INPUT_MODIFIED = PCANTP_STATUS_CAUTION_INPUT_MODIFIED,
PUDS_STATUS_CAUTION_DLC_MODIFIED = PCANTP_STATUS_CAUTION_DLC_MODIFIED,
PUDS_STATUS_CAUTION_DATA_LENGTH_MODIFIED = PCANTP_STATUS_CAUTION_DATA_LENGTH_MODIFIED,
PUDS_STATUS_CAUTION_FD_FLAG_MODIFIED = PCANTP_STATUS_CAUTION_FD_FLAG_MODIFIED,
PUDS_STATUS_CAUTION_RX_QUEUE_FULL = PCANTP_STATUS_CAUTION_RX_QUEUE_FULL,
PUDS_STATUS_CAUTION_BUFFER_IN_USE = PCANTP_STATUS_CAUTION_BUFFER_IN_USE,
PUDS_STATUS_FLAG_PCAN_STATUS = PCANTP_STATUS_FLAG_PCAN_STATUS,
PUDS_STATUS_MASK_ERROR = PCANTP_STATUS_MASK_ERROR,
PUDS_STATUS_MASK_BUS = PCANTP_STATUS_MASK_BUS,
PUDS_STATUS_MASK_ISOTP_NET = PCANTP_STATUS_MASK_ISOTP_NET,
PUDS_STATUS_MASK_INFO = PCANTP_STATUS_MASK_INFO,
PUDS_STATUS_MASK_PCAN = PCANTP_STATUS_MASK_PCAN,
PUDS_STATUS_FLAG_UDS_ERROR = 0x20 << PCANTP_STATUS_OFFSET_UDS,
PUDS_STATUS_MASK_UDS_ERROR = 0x3f << PCANTP_STATUS_OFFSET_UDS,
PUDS_STATUS_SERVICE_NO_MESSAGE = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_NO_MESSAGE << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_TIMEOUT_CONFIRMATION << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_TIMEOUT_RESPONSE << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_RESET = PUDS_STATUS_FLAG_UDS_ERROR | (PUDS_ERRSTATUS_RESET <<
PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_ERROR_WAIT_FOR_P3_TIMING = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_ERROR_WAIT_FOR_P3_TIMING << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_ALREADY_PENDING = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_ALREADY_PENDING << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_TX_ERROR << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_RX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_RX_ERROR << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_RX_OVERFLOW = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW << PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED = PUDS_STATUS_FLAG_UDS_ERROR |
(PUDS_ERRSTATUS_MESSAGE_BUFFER_ALREADY_USED << PCANTP_STATUS_OFFSET_UDS),
} uds_status;
33
PCAN-UDS 2.x API – User Manual
C++ / CLR
34
PCAN-UDS 2.x API – User Manual
C#
35
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_CAUTION_DATA_LENGTH_MODIFIED =
cantp_status.PCANTP_STATUS_CAUTION_DATA_LENGTH_MODIFIED,
PUDS_STATUS_CAUTION_FD_FLAG_MODIFIED = cantp_status.PCANTP_STATUS_CAUTION_FD_FLAG_MODIFIED,
PUDS_STATUS_CAUTION_RX_QUEUE_FULL = cantp_status.PCANTP_STATUS_CAUTION_RX_QUEUE_FULL,
PUDS_STATUS_CAUTION_BUFFER_IN_USE = cantp_status.PCANTP_STATUS_CAUTION_BUFFER_IN_USE,
PUDS_STATUS_FLAG_PCAN_STATUS = cantp_status.PCANTP_STATUS_FLAG_PCAN_STATUS,
PUDS_STATUS_MASK_ERROR = cantp_status.PCANTP_STATUS_MASK_ERROR,
PUDS_STATUS_MASK_BUS = cantp_status.PCANTP_STATUS_MASK_BUS,
PUDS_STATUS_MASK_ISOTP_NET = cantp_status.PCANTP_STATUS_MASK_ISOTP_NET,
PUDS_STATUS_MASK_INFO = cantp_status.PCANTP_STATUS_MASK_INFO,
PUDS_STATUS_MASK_PCAN = cantp_status.PCANTP_STATUS_MASK_PCAN,
PUDS_STATUS_FLAG_UDS_ERROR = 0x20 << uds_status_offset.PCANTP_STATUS_OFFSET_UDS,
PUDS_STATUS_MASK_UDS_ERROR = (UInt32)0x3f << uds_status_offset.PCANTP_STATUS_OFFSET_UDS,
PUDS_STATUS_SERVICE_NO_MESSAGE = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_NO_MESSAGE <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_TIMEOUT_CONFIRMATION <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_TIMEOUT_RESPONSE <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_RESET = PUDS_STATUS_FLAG_UDS_ERROR | (uds_errstatus.PUDS_ERRSTATUS_RESET <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_ERROR_WAIT_FOR_P3_TIMING = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_ERROR_WAIT_FOR_P3_TIMING <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_ALREADY_PENDING = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_ALREADY_PENDING <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_TX_ERROR <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_RX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_RX_ERROR <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_RX_OVERFLOW = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED = PUDS_STATUS_FLAG_UDS_ERROR |
(uds_errstatus.PUDS_ERRSTATUS_MESSAGE_BUFFER_ALREADY_USED <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
}
Pascal OO
uds_status = (
PUDS_STATUS_OK = UInt32(PCANTP_STATUS_OK),
PUDS_STATUS_NOT_INITIALIZED = UInt32(PCANTP_STATUS_NOT_INITIALIZED),
PUDS_STATUS_ALREADY_INITIALIZED = UInt32(PCANTP_STATUS_ALREADY_INITIALIZED),
PUDS_STATUS_NO_MEMORY = UInt32(PCANTP_STATUS_NO_MEMORY),
PUDS_STATUS_OVERFLOW = UInt32(PCANTP_STATUS_OVERFLOW),
PUDS_STATUS_NO_MESSAGE = UInt32(PCANTP_STATUS_NO_MESSAGE),
PUDS_STATUS_PARAM_INVALID_TYPE = UInt32(PCANTP_STATUS_PARAM_INVALID_TYPE),
PUDS_STATUS_PARAM_INVALID_VALUE = UInt32(PCANTP_STATUS_PARAM_INVALID_VALUE),
PUDS_STATUS_MAPPING_NOT_INITIALIZED = UInt32(PCANTP_STATUS_MAPPING_NOT_INITIALIZED),
PUDS_STATUS_MAPPING_INVALID = UInt32(PCANTP_STATUS_MAPPING_INVALID),
PUDS_STATUS_MAPPING_ALREADY_INITIALIZED = UInt32(PCANTP_STATUS_MAPPING_ALREADY_INITIALIZED),
PUDS_STATUS_PARAM_BUFFER_TOO_SMALL = UInt32(PCANTP_STATUS_PARAM_BUFFER_TOO_SMALL),
PUDS_STATUS_QUEUE_TX_FULL = UInt32(PCANTP_STATUS_QUEUE_TX_FULL),
PUDS_STATUS_LOCK_TIMEOUT = UInt32(PCANTP_STATUS_LOCK_TIMEOUT),
PUDS_STATUS_HANDLE_INVALID = UInt32(PCANTP_STATUS_HANDLE_INVALID),
36
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_UNKNOWN = UInt32(PCANTP_STATUS_UNKNOWN),
PUDS_STATUS_FLAG_BUS_LIGHT = UInt32(PCANTP_STATUS_FLAG_BUS_LIGHT),
PUDS_STATUS_FLAG_BUS_HEAVY = UInt32(PCANTP_STATUS_FLAG_BUS_HEAVY),
PUDS_STATUS_FLAG_BUS_WARNING = UInt32(PCANTP_STATUS_FLAG_BUS_WARNING),
PUDS_STATUS_FLAG_BUS_PASSIVE = UInt32(PCANTP_STATUS_FLAG_BUS_PASSIVE),
PUDS_STATUS_FLAG_BUS_OFF = UInt32(PCANTP_STATUS_FLAG_BUS_OFF),
PUDS_STATUS_FLAG_BUS_ANY = UInt32(PCANTP_STATUS_FLAG_BUS_ANY),
PUDS_STATUS_FLAG_NETWORK_RESULT = UInt32(PCANTP_STATUS_FLAG_NETWORK_RESULT),
PUDS_STATUS_NETWORK_TIMEOUT_A = UInt32(PCANTP_STATUS_NETWORK_TIMEOUT_A),
PUDS_STATUS_NETWORK_TIMEOUT_Bs = UInt32(PCANTP_STATUS_NETWORK_TIMEOUT_Bs),
PUDS_STATUS_NETWORK_TIMEOUT_Cr = UInt32(PCANTP_STATUS_NETWORK_TIMEOUT_Cr),
PUDS_STATUS_NETWORK_WRONG_SN = UInt32(PCANTP_STATUS_NETWORK_WRONG_SN),
PUDS_STATUS_NETWORK_INVALID_FS = UInt32(PCANTP_STATUS_NETWORK_INVALID_FS),
PUDS_STATUS_NETWORK_UNEXP_PDU = UInt32(PCANTP_STATUS_NETWORK_UNEXP_PDU),
PUDS_STATUS_NETWORK_WFT_OVRN = UInt32(PCANTP_STATUS_NETWORK_WFT_OVRN),
PUDS_STATUS_NETWORK_BUFFER_OVFLW = UInt32(PCANTP_STATUS_NETWORK_BUFFER_OVFLW),
PUDS_STATUS_NETWORK_ERROR = UInt32(PCANTP_STATUS_NETWORK_ERROR),
PUDS_STATUS_NETWORK_IGNORED = UInt32(PCANTP_STATUS_NETWORK_IGNORED),
PUDS_STATUS_CAUTION_INPUT_MODIFIED = UInt32(PCANTP_STATUS_CAUTION_INPUT_MODIFIED),
PUDS_STATUS_CAUTION_DLC_MODIFIED = UInt32(PCANTP_STATUS_CAUTION_DLC_MODIFIED),
PUDS_STATUS_CAUTION_DATA_LENGTH_MODIFIED =
UInt32(PCANTP_STATUS_CAUTION_DATA_LENGTH_MODIFIED),
PUDS_STATUS_CAUTION_FD_FLAG_MODIFIED = UInt32(PCANTP_STATUS_CAUTION_FD_FLAG_MODIFIED),
PUDS_STATUS_CAUTION_RX_QUEUE_FULL = UInt32(PCANTP_STATUS_CAUTION_RX_QUEUE_FULL),
PUDS_STATUS_CAUTION_BUFFER_IN_USE = UInt32(PCANTP_STATUS_CAUTION_BUFFER_IN_USE),
PUDS_STATUS_FLAG_PCAN_STATUS = UInt32(PCANTP_STATUS_FLAG_PCAN_STATUS),
PUDS_STATUS_MASK_ERROR = UInt32(PCANTP_STATUS_MASK_ERROR),
PUDS_STATUS_MASK_BUS = UInt32(PCANTP_STATUS_MASK_BUS),
PUDS_STATUS_MASK_ISOTP_NET = UInt32(PCANTP_STATUS_MASK_ISOTP_NET),
PUDS_STATUS_MASK_INFO = UInt32(PCANTP_STATUS_MASK_INFO),
PUDS_STATUS_MASK_PCAN = UInt32(PCANTP_STATUS_MASK_PCAN),
PUDS_STATUS_FLAG_UDS_ERROR = $20 Shl PCANTP_STATUS_OFFSET_UDS,
PUDS_STATUS_MASK_UDS_ERROR = $3F Shl PCANTP_STATUS_OFFSET_UDS,
PUDS_STATUS_SERVICE_NO_MESSAGE = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_NO_MESSAGE) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_TIMEOUT_CONFIRMATION) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_TIMEOUT_RESPONSE) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_RESET = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_RESET) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_ERROR_WAIT_FOR_P3_TIMING = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_ERROR_WAIT_FOR_P3_TIMING) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_ALREADY_PENDING = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_ALREADY_PENDING) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_TX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_TX_ERROR) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_RX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_RX_ERROR) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_SERVICE_RX_OVERFLOW = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW) shl PCANTP_STATUS_OFFSET_UDS),
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED = PUDS_STATUS_FLAG_UDS_ERROR Or
(UInt32(PUDS_ERRSTATUS_MESSAGE_BUFFER_ALREADY_USED) shl PCANTP_STATUS_OFFSET_UDS)
);
Visual Basic
37
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_OVERFLOW = cantp_status.PCANTP_STATUS_OVERFLOW
PUDS_STATUS_NO_MESSAGE = cantp_status.PCANTP_STATUS_NO_MESSAGE
PUDS_STATUS_PARAM_INVALID_TYPE = cantp_status.PCANTP_STATUS_PARAM_INVALID_TYPE
PUDS_STATUS_PARAM_INVALID_VALUE = cantp_status.PCANTP_STATUS_PARAM_INVALID_VALUE
PUDS_STATUS_MAPPING_NOT_INITIALIZED = cantp_status.PCANTP_STATUS_MAPPING_NOT_INITIALIZED
PUDS_STATUS_MAPPING_INVALID = cantp_status.PCANTP_STATUS_MAPPING_INVALID
PUDS_STATUS_MAPPING_ALREADY_INITIALIZED =
cantp_status.PCANTP_STATUS_MAPPING_ALREADY_INITIALIZED
PUDS_STATUS_PARAM_BUFFER_TOO_SMALL = cantp_status.PCANTP_STATUS_PARAM_BUFFER_TOO_SMALL
PUDS_STATUS_QUEUE_TX_FULL = cantp_status.PCANTP_STATUS_QUEUE_TX_FULL
PUDS_STATUS_LOCK_TIMEOUT = cantp_status.PCANTP_STATUS_LOCK_TIMEOUT
PUDS_STATUS_HANDLE_INVALID = cantp_status.PCANTP_STATUS_HANDLE_INVALID
PUDS_STATUS_UNKNOWN = cantp_status.PCANTP_STATUS_UNKNOWN
PUDS_STATUS_FLAG_BUS_LIGHT = cantp_status.PCANTP_STATUS_FLAG_BUS_LIGHT
PUDS_STATUS_FLAG_BUS_HEAVY = cantp_status.PCANTP_STATUS_FLAG_BUS_HEAVY
PUDS_STATUS_FLAG_BUS_WARNING = cantp_status.PCANTP_STATUS_FLAG_BUS_WARNING
PUDS_STATUS_FLAG_BUS_PASSIVE = cantp_status.PCANTP_STATUS_FLAG_BUS_PASSIVE
PUDS_STATUS_FLAG_BUS_OFF = cantp_status.PCANTP_STATUS_FLAG_BUS_OFF
PUDS_STATUS_FLAG_BUS_ANY = cantp_status.PCANTP_STATUS_FLAG_BUS_ANY
PUDS_STATUS_FLAG_NETWORK_RESULT = cantp_status.PCANTP_STATUS_FLAG_NETWORK_RESULT
PUDS_STATUS_NETWORK_TIMEOUT_A = cantp_status.PCANTP_STATUS_NETWORK_TIMEOUT_A
PUDS_STATUS_NETWORK_TIMEOUT_Bs = cantp_status.PCANTP_STATUS_NETWORK_TIMEOUT_Bs
PUDS_STATUS_NETWORK_TIMEOUT_Cr = cantp_status.PCANTP_STATUS_NETWORK_TIMEOUT_Cr
PUDS_STATUS_NETWORK_WRONG_SN = cantp_status.PCANTP_STATUS_NETWORK_WRONG_SN
PUDS_STATUS_NETWORK_INVALID_FS = cantp_status.PCANTP_STATUS_NETWORK_INVALID_FS
PUDS_STATUS_NETWORK_UNEXP_PDU = cantp_status.PCANTP_STATUS_NETWORK_UNEXP_PDU
PUDS_STATUS_NETWORK_WFT_OVRN = cantp_status.PCANTP_STATUS_NETWORK_WFT_OVRN
PUDS_STATUS_NETWORK_BUFFER_OVFLW = cantp_status.PCANTP_STATUS_NETWORK_BUFFER_OVFLW
PUDS_STATUS_NETWORK_ERROR = cantp_status.PCANTP_STATUS_NETWORK_ERROR
PUDS_STATUS_NETWORK_IGNORED = cantp_status.PCANTP_STATUS_NETWORK_IGNORED
PUDS_STATUS_CAUTION_INPUT_MODIFIED = cantp_status.PCANTP_STATUS_CAUTION_INPUT_MODIFIED
PUDS_STATUS_CAUTION_DLC_MODIFIED = cantp_status.PCANTP_STATUS_CAUTION_DLC_MODIFIED
PUDS_STATUS_CAUTION_DATA_LENGTH_MODIFIED =
cantp_status.PCANTP_STATUS_CAUTION_DATA_LENGTH_MODIFIED
PUDS_STATUS_CAUTION_FD_FLAG_MODIFIED = cantp_status.PCANTP_STATUS_CAUTION_FD_FLAG_MODIFIED
PUDS_STATUS_CAUTION_RX_QUEUE_FULL = cantp_status.PCANTP_STATUS_CAUTION_RX_QUEUE_FULL
PUDS_STATUS_CAUTION_BUFFER_IN_USE = cantp_status.PCANTP_STATUS_CAUTION_BUFFER_IN_USE
PUDS_STATUS_FLAG_PCAN_STATUS = cantp_status.PCANTP_STATUS_FLAG_PCAN_STATUS
PUDS_STATUS_MASK_ERROR = cantp_status.PCANTP_STATUS_MASK_ERROR
PUDS_STATUS_MASK_BUS = cantp_status.PCANTP_STATUS_MASK_BUS
PUDS_STATUS_MASK_ISOTP_NET = cantp_status.PCANTP_STATUS_MASK_ISOTP_NET
PUDS_STATUS_MASK_INFO = cantp_status.PCANTP_STATUS_MASK_INFO
PUDS_STATUS_MASK_PCAN = cantp_status.PCANTP_STATUS_MASK_PCAN
PUDS_STATUS_FLAG_UDS_ERROR = &H20 << uds_status_offset.PCANTP_STATUS_OFFSET_UDS
PUDS_STATUS_MASK_UDS_ERROR = CType(&H3F, UInt32) <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS
PUDS_STATUS_SERVICE_NO_MESSAGE = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_NO_MESSAGE <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_TIMEOUT_CONFIRMATION <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_TIMEOUT_RESPONSE <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_RESET = PUDS_STATUS_FLAG_UDS_ERROR Or (uds_errstatus.PUDS_ERRSTATUS_RESET <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_ERROR_WAIT_FOR_P3_TIMING = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_ERROR_WAIT_FOR_P3_TIMING <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_SERVICE_ALREADY_PENDING = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_ALREADY_PENDING <<
38
PCAN-UDS 2.x API – User Manual
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_SERVICE_TX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_TX_ERROR <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_SERVICE_RX_ERROR = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_RX_ERROR <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_SERVICE_RX_OVERFLOW = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_SERVICE_RX_OVERFLOW <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED = PUDS_STATUS_FLAG_UDS_ERROR Or
(uds_errstatus.PUDS_ERRSTATUS_MESSAGE_BUFFER_ALREADY_USED <<
uds_status_offset.PCANTP_STATUS_OFFSET_UDS)
End Enum
Values
Name Value Description
PUDS_STATUS_OK 0x0 (0) No error, success.
PUDS_STATUS_NOT_INITIALIZED 0x1 (1) Not initialized.
PUDS_STATUS_ALREADY_INITIALIZED 0x2 (2) Already initialized.
PUDS_STATUS_NO_MEMORY 0x3 (3) Could not obtain memory.
PUDS_STATUS_OVERFLOW 0x4 (4) Input buffer overflow.
PUDS_STATUS_NO_MESSAGE 0x7 (7) No message available.
PUDS_STATUS_PARAM_INVALID_TYPE 0x8 (8) Parameter has an invalid or unexpected type.
PUDS_STATUS_PARAM_INVALID_VALUE 0x9 (9) Parameter has an invalid value.
PUDS_STATUS_MAPPING_NOT_INITIALIZED 0xd (13) PUDS mapping not initialized.
PUDS_STATUS_MAPPING_INVALID 0xe (14) PUDS mapping parameters are invalid.
PUDS_STATUS_MAPPING_ALREADY_INITIALIZED 0xf (15) PUDS mapping already defined.
PUDS_STATUS_PARAM_BUFFER_TOO_SMALL 0x10 (16) Buffer is too small.
PUDS_STATUS_QUEUE_TX_FULL 0x11 (17) Tx queue is full.
PUDS_STATUS_LOCK_TIMEOUT 0x12 (18) Failed to get an access to the internal lock.
PUDS_STATUS_HANDLE_INVALID 0x13 (19) Invalid cantp_handle.
PUDS_STATUS_UNKNOWN 0xff (255) Unknown/generic error.
PUDS_STATUS_FLAG_BUS_LIGHT 0x100 (256) PUDS channel is in BUS - LIGHT error state.
PUDS_STATUS_FLAG_BUS_HEAVY 0x200 (512) PUDS channel is in BUS - HEAVY error state.
PUDS_STATUS_FLAG_BUS_WARNING 0x200 (512) PUDS channel is in BUS - HEAVY error state.
PUDS_STATUS_FLAG_BUS_PASSIVE 0x400 (1024) PUDS channel is in error passive state.
PUDS_STATUS_FLAG_BUS_OFF 0x800 (2048) PUDS channel is in BUS - OFF error state.
PUDS_STATUS_FLAG_BUS_ANY 0xf00 (3840) Mask for all bus errors.
PUDS_STATUS_FLAG_NETWORK_RESULT 0x2000 (8192) This flag states if one of the following network
errors occurred with the fetched message.
PUDS_STATUS_NETWORK_TIMEOUT_A 0x6000 (24576) Timeout occurred between 2 frames
transmission (sender and receiver side).
PUDS_STATUS_NETWORK_TIMEOUT_Bs 0xa000 (40960) Sender side timeout while waiting for flow
control frame.
PUDS_STATUS_NETWORK_TIMEOUT_Cr 0xe000 (57344) Receiver side timeout while waiting for
consecutive frame.
PUDS_STATUS_NETWORK_WRONG_SN 0x12000 (73728) Unexpected sequence number.
PUDS_STATUS_NETWORK_INVALID_FS 0x16000 (90112) Invalid or unknown Flow Status.
PUDS_STATUS_NETWORK_UNEXP_PDU 0x1a000 (106496) Unexpected protocol data unit.
PUDS_STATUS_NETWORK_WFT_OVRN 0x1e000 (122880) Reception of flow control WAIT frame that
exceeds the maximum counter defined by
PUDS_PARAMETER_WFT_MAX.
PUDS_STATUS_NETWORK_BUFFER_OVFLW 0x22000 (139264) Buffer on the receiver side cannot store the data
length (server side only).
PUDS_STATUS_NETWORK_ERROR 0x26000 (155648) General error.
39
PCAN-UDS 2.x API – User Manual
Remarks
The PUDS_STATUS_FLAG_PCAN_STATUS status is a generic error code that is used to identify PCAN-Basic errors
(as PCAN-Basic API is used internally by the PCAN-UDS 2.x API). When a PCAN-Basic error occurs, the API
performs a bitwise combination of the PUDS_STATUS_MASK_PCAN and the PCAN-Basic ( TPCANStatus ) error.
40
PCAN-UDS 2.x API – User Manual
3.5.3 uds_parameter
Represents a PUDS parameter or a PUDS value that can be read or set. With some exceptions, a channel
must first be initialized before their parameters can be read or set.
Syntax
C/C++
Pascal OO
uds_parameter = (
PUDS_PARAMETER_API_VERSION = $201,
PUDS_PARAMETER_DEBUG = $203,
PUDS_PARAMETER_RECEIVE_EVENT = $204,
PUDS_PARAMETER_SERVER_ADDRESS = $207,
PUDS_PARAMETER_SESSION_INFO = $209,
PUDS_PARAMETER_TIMEOUT_REQUEST = $20A,
PUDS_PARAMETER_TIMEOUT_RESPONSE = $20B,
PUDS_PARAMETER_AUTOMATIC_TESTER_PRESENT = $20C,
PUDS_PARAMETER_USE_NO_RESPONSE_AUTOMATIC_TESTER_PRESENT = $213,
PUDS_PARAMETER_AUTO_P3_TIMING_MANAGEMENT = $20D,
PUDS_PARAMETER_LISTENED_ADDRESSES = $210,
PUDS_PARAMETER_ADD_LISTENED_ADDRESS = $211,
PUDS_PARAMETER_REMOVE_LISTENED_ADDRESS = $212,
PUDS_PARAMETER_CHANNEL_CONDITION = UInt32(PCANTP_PARAMETER_CHANNEL_CONDITION),
PUDS_PARAMETER_CAN_TX_DL = UInt32(PCANTP_PARAMETER_CAN_TX_DL),
PUDS_PARAMETER_CAN_DATA_PADDING = UInt32(PCANTP_PARAMETER_CAN_DATA_PADDING),
PUDS_PARAMETER_CAN_PADDING_VALUE = UInt32(PCANTP_PARAMETER_CAN_PADDING_VALUE),
PUDS_PARAMETER_J1939_PRIORITY = UInt32(PCANTP_PARAMETER_J1939_PRIORITY),
PUDS_PARAMETER_BLOCK_SIZE = UInt32(PCANTP_PARAMETER_BLOCK_SIZE),
PUDS_PARAMETER_SEPARATION_TIME = UInt32(PCANTP_PARAMETER_SEPARATION_TIME),
41
PCAN-UDS 2.x API – User Manual
PUDS_PARAMETER_WFT_MAX = UInt32(PCANTP_PARAMETER_WFT_MAX),
PUDS_PARAMETER_ISO_TIMEOUTS = UInt32(PCANTP_PARAMETER_ISO_TIMEOUTS),
PUDS_PARAMETER_RESET_HARD = UInt32(PCANTP_PARAMETER_RESET_HARD),
PUDS_PARAMETER_HARDWARE_NAME = UInt32(PCAN_HARDWARE_NAME),
PUDS_PARAMETER_DEVICE_NUMBER = Uint32(PCAN_DEVICE_NUMBER),
PUDS_PARAMETER_CONTROLLER_NUMBER = UInt32(PCAN_CONTROLLER_NUMBER),
PUDS_PARAMETER_CHANNEL_FEATURES = UInt32(PCAN_CHANNEL_FEATURES)
);
C#
C++ / CLR
42
PCAN-UDS 2.x API – User Manual
PUDS_PARAMETER_CAN_PADDING_VALUE = cantp_parameter::PCANTP_PARAMETER_CAN_PADDING_VALUE,
PUDS_PARAMETER_J1939_PRIORITY = cantp_parameter::PCANTP_PARAMETER_J1939_PRIORITY,
PUDS_PARAMETER_BLOCK_SIZE = cantp_parameter::PCANTP_PARAMETER_BLOCK_SIZE,
PUDS_PARAMETER_SEPARATION_TIME = cantp_parameter::PCANTP_PARAMETER_SEPARATION_TIME,
PUDS_PARAMETER_WFT_MAX = cantp_parameter::PCANTP_PARAMETER_WFT_MAX,
PUDS_PARAMETER_ISO_TIMEOUTS = cantp_parameter::PCANTP_PARAMETER_ISO_TIMEOUTS,
PUDS_PARAMETER_RESET_HARD = cantp_parameter::PCANTP_PARAMETER_RESET_HARD,
PUDS_PARAMETER_HARDWARE_NAME = (UInt32)TPCANParameter::PCAN_HARDWARE_NAME,
PUDS_PARAMETER_DEVICE_NUMBER = (UInt32)TPCANParameter::PCAN_DEVICE_NUMBER,
PUDS_PARAMETER_CONTROLLER_NUMBER = (UInt32)TPCANParameter::PCAN_CONTROLLER_NUMBER,
PUDS_PARAMETER_CHANNEL_FEATURES = (UInt32)TPCANParameter::PCAN_CHANNEL_FEATURES
};
Visual Basic
Values
Name Value Data type Description
PUDS_PARAMETER_API_VERSION 0x201 String API version of the PCAN-
UDS API.
PUDS_PARAMETER_DEBUG 0x203 Byte Debug mode.
PUDS_PARAMETER_RECEIVE_EVENT 0x204 Pointer Defines PUDS receive-
event handler, require a
pointer to an event
HANDLE.
PUDS_PARAMETER_SERVER_ADDRESS 0x207 UInt16 Physical address of the
server (ECU)
PUDS_PARAMETER_SESSION_INFO 0x209 uds_sessioninfo UDS current server (ECU)
session information (see
uds_sessioninfo on page
22).
43
PCAN-UDS 2.x API – User Manual
44
PCAN-UDS 2.x API – User Manual
Access:
Description: This parameter is used to get information about the PCAN-UDS API implementation version.
Possible Values: The value is a null-terminated string indication the version number of the API
implementation. The returned text has the following form: x,x,x,x for major, minor, release and build. It
represents the binary version of the API, within two 32-bit integers, defined by four 16-bit integers. The
length of this text value will have a maximum length of 24 bytes, 5 bytes for represent each 16-bit value,
three separator characters ( , or . ) and the null-termination.
PCAN-Device: NA. Any PCAN device can be used, including the PCANTP_HANDLE_NONEBUS channel.
PUDS_PARAMETER_DEBUG
Access:
Description: This parameter is used to control debug mode. If enabled, any received or transmitted CAN
frames will be logged in PCANBasic log file (default filename is PCANBasic.log located inside the current
directory).
Possible Values:
PUDS_PARAMETER_RECEIVE_EVENT
Access:
Description: This parameter is used to let the PCAN-UDS 2.x API notify an application when UDS messages
are available to be read. In this form, message processing tasks of an application can react faster and make
a more efficient use of the processor time.
Possible Values: This value has to be a handle for an event object returned by the Windows API function
CreateEvent or the value 0 ( IntPtr.Zero in a managed environment). When setting this parameter, the value of
0 resets the parameter in the PCAN-UDS 2.x API. Reading a value of 0 indicates that no event handle is set.
For more information about reading with events, please refer to the topic Using Events on page 778.
45
PCAN-UDS 2.x API – User Manual
Note: .NET environment should use the prototype SetValue_2013 , as in the following C# example:
UInt32 ibuf_event =
Convert.ToUInt32(receive_event.SafeWaitHandle.DangerousGetHandle().ToInt32());
UDSApi.SetValue_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
uds_parameter.PUDS_PARAMETER_RECEIVE_EVENT, ref ibuf_event, sizeof(UInt32));
PUDS_PARAMETER_SERVER_ADDRESS
Access:
Description: This value is used to define the address of the server. Defining this parameter is required as it
allows configuration of the underlying ISO-TP 3.0 API. By default the address is set to the standard address
of external test equipment (0xF1, see uds_address on page 56). Although most UDS addresses are 1 byte
data, the parameter requires a 2 bytes value in order to be compatible with ISO 15765-3:2004 addresses
(see PUDS_SERVER_ADDR_MASK_ENHANCED_ISO_15765_3 , 0x7FF).
Note that with ISO 14229-1:2013 enhanced addresses are considered deprecated, yet if you need to define
an ISO 15765-3:2004 address, add the flag PUDS_SERVER_ADDR_FLAG_ENHANCED_ISO_15765_3 (0x1000) to the
address (using a bitwise OR operation, i.e.: ( PUDS_SERVER_ADDR_FLAG_ENHANCED_ISO_15765_3 | 0x123).
Possible Values: 0x00 to 0xFF, or 0x1000 to 0x17FF for enhanced ISO 14229-1:2013 addresses (see
predefined uds_address values on page 56).
PUDS_PARAMETER_SESSION_INFO
Access:
Description: This parameter is used to read the current diagnostic session information. The diagnostic
session information is a value which is internally updated when the UDS service
UDS_SvcDiagnosticSessionControl_2013 is invoked: it keeps track of the active session and its associated timeouts.
If a non-default diagnostic session is active, a keep-alive mechanism (using physically addressed
TesterPresent service requests with the “suppress positive response message” flag) is automatically
activated according to UDS standard (see below PUDS_PARAMETER_AUTOMATIC_TESTER_PRESENT to
enable/disable this mechanism). This parameter can also be used to override the current session
information (for example, some custom ECU may be in a non default session after reset, in this case the
current session information must be overridden).
Default Value: automatically updated when the response of the service UDS_SvcDiagnosticSessionControl_2013
is processed (with the UDS_WaitForService_2013 or UDS_WaitForServiceFunctional_2013 functions).
46
PCAN-UDS 2.x API – User Manual
PUDS_PARAMETER_TIMEOUT_REQUEST
Access:
Description: This value defines the maximum waiting time in milliseconds to receive a confirmation of a
transmission (or request loopback). It is used in PCAN-UDS 2.x API utility functions like
UDS_WaitForService_2013 or method like WaitForService_2013 .
PUDS_PARAMETER_TIMEOUT_RESPONSE
Access:
Description: This value defines the maximum waiting time in milliseconds to receive a response indication.
Note that the exact timeout value is the sum of this parameter and the timeout defined in the active
diagnostic session. It is used in PCAN-UDS 2.x API utility functions like UDS_WaitForService_2013 or methods
like WaitForService_2013 .
PUDS_PARAMETER_AUTOMATIC_TESTER_PRESENT
Access:
Description: Activates or not the automatic UDS Tester Present request that should occur when a non-
default UDS session is set.
PUDS_PARAMETER_USE_NO_RESPONSE_AUTOMATIC_TESTER_PRESENT
Access:
Description: Activates or not the no response flag for automatic UDS Tester Present requests.
PUDS_PARAMETER_AUTO_P3_TIMING_MANAGEMENT
Access:
Description: Activates or not automatic P3 timing management (P3 client/server is the time to wait before
sending a new UDS request to the same ECU). If activated, required waiting timing between consecutive
47
PCAN-UDS 2.x API – User Manual
requests (functional or physical request without response) will be included in the call to UDS_Write_2013
function. If not UDS_Write_2013 will return the status PUDS_STATUS_ERROR_WAIT_FOR_P3_TIMING .
See also: ISO-14229-2_2013 §8.3 Minimum time between client request messages, p.36.
PUDS_PARAMETER_LISTENED_ADDRESSES
Access:
Description: Gets the list of physical addresses to listen to. The length of the array must be specified in the
buffer_size parameter of the UDS_GetValue_2013 function or GetValue_2013 method. If a UDS message is received
and its target address does not match an item in the list of physical addresses, then this message is
discarded.
Possible Values: 0x00 to 0xFF (see predefined uds_address values on page 56), or 0x1000 to 0x17FF for
enhanced ISO 14229-1:2013 addresses (with PUDS_SERVER_ADDR_FLAG_ENHANCED_ISO_15765_3 flag).
PUDS_PARAMETER_ADD_LISTENED_ADDRESS
Access:
Description: Adds a listening address to the list of physical addresses to listen to. If a UDS message is
received and its target address does not match an item in the list of physical addresses, then this message
is discarded. Note: if a call to UDS_Write_2013 function is requested with a source address that is not in this list,
it will be automatically added to this list.
Possible Values: 0x00 to 0xFF (see predefined uds_address values on page 56), or 0x1000 to 0x17FF for
enhanced ISO 14229-1:2013 addresses (with PUDS_SERVER_ADDR_FLAG_ENHANCED_ISO_15765_3 flag).
PUDS_PARAMETER_REMOVE_LISTENED_ADDRESS
Access:
Description: Removes a listened address from the list of physical addresses to listen to.
Possible Values: 0x00 to 0xFF (see predefined uds_address values on page 56), or 0x1000 to 0x17FF for
enhanced ISO 14229-1:2013 addresses (with PUDS_SERVER_ADDR_FLAG_ENHANCED_ISO_15765_3 flag).
PUDS_PARAMETER_CHANNEL_CONDITION
Access:
Description: This parameter is used to check and detect available PCAN hardware on a computer, even
before trying to connect any of them. This is useful when an application wants the user to select which
hardware should be using in a communication session.
Possible Values: This parameter can have one of these values: PUDS_CHANNEL_UNAVAILABLE ,
PUDS_CHANNEL_AVAILABLE and PUDS_CHANNEL_OCCUPIED .
48
PCAN-UDS 2.x API – User Manual
Note: It is not needed to have a PUDS channel initialized before asking for its condition.
PUDS_PARAMETER_CAN_TX_DL
Access:
Description: This parameter is used to define the default Data Length Code (DLC) used when transmitting
ISO-TP messages CAN FD enabled: the fragmented CAN FD frames composing the full CAN ISO-TP
message will have at most a length corresponding to that DLC (It depends if the data fit in a lower DLC
value). Note that member can_tx_dlc in uds_mapping or uds_msgconfig or message’s can_info.dlc can be used to
override this parameter locally (see uds_mapping on page 25, uds_msgconfig on page 27, cantp_can_info on page
124).
PUDS_PARAMETER_CAN_DATA_PADDING
Access:
Description: This parameter is used to define if the API should use CAN data optimization or CAN data
padding: the first case will optimize the CAN DLC to avoid sending unnecessary data, on the other hand
with CAN data padding the API will always send CAN frames with a DLC of 8 and pads the data with the
padding value.
Possible values: PUDS_CAN_DATA_PADDING_NONE disables data padding (enabling CAN data optimization) and
PUDS_CAN_DATA_PADDING_ON (enabling data padding).
Default value: PUDS_CAN_DATA_PADDING_ON since ECUs that do not support CAN data optimization may not
respond to UDS/CAN-TP messages.
PUDS_PARAMETER_CAN_PADDING_VALUE
Access:
Description: This parameter is used to define the value (or pattern) for CAN data padding when it is
enabled.
49
PCAN-UDS 2.x API – User Manual
PUDS_PARAMETER_J1939_PRIORITY
Access:
Description: This parameter is used to define the default priority for messages compliant with SAE J1939
data link layer (i.e. 29-bit CAN identifier messages with normal fixed, mixed, or enhanced addressing).
PUDS_PARAMETER_BLOCK_SIZE
Access:
Description: This value is used to set the BlockSize (BS) parameter defined in the ISO-TP standard: it
indicates to the sender the maximum number of consecutive frames that can be received without an
intermediate FlowControl frame from the receiving network entity. A value of 0 indicates that no limit is
set, and the sending network layer entity shall send all remaining consecutive frames.
PUDS_PARAMETER_SEPARATION_TIME
Access:
Description: This value is used to set the Separation Time (STmin) parameter defined in the ISO-TP
standard: it indicates the minimum time the sender is to wait between the transmissions of two
Consecutive Frames.
Possible values: 0x00 to 0x7F (range from 0 to 127 milliseconds) and 0xF1 to 0xF9 (range from 100 to 900
µs).
Note: Values between 0xF1 to 0xF3 should define a minimum time of 100 to 300 µs, but in practice the
time to transmit effectively a frame takes about 300 µs (which is to send the message to the CAN
controller and to assert that the message is physically emitted on the CAN bus). Other values than the
ones stated above are ISO reserved.
PUDS_PARAMETER_WFT_MAX
Access:
Description: This parameter is used to set the maximum number of FlowControl Wait frame transmission
(N_WFTmax) defined in the ISO-TP standard: it indicates how many FlowControl Wait frames with the wait
status can be transmitted by a receiver in a row.
Possible value: Any positive number.
50
PCAN-UDS 2.x API – User Manual
Note: Also, this parameter is set globally, channels will use the value sets when they are initialized,
so it is possible to define different values of N_WFTmax on separate channels. Consequently, once a
channel is initialized, changing the WFTmax parameter will not affect that channel.
PUDS_PARAMETER_ISO_TIMEOUTS
Access:
Possible values:
PUDS_PARAMETER_RESET_HARD
Access:
Description: Resets the CAN controller and clears internal reception and transmission queues. This
parameter provides a way to uninitialize then initialize the CAN channel without losing any configured
mappings and PUDS/PCANTP related settings.
Possible values: 1.
PUDS_PARAMETER_HARDWARE_NAME
Access:
Description: This parameter is used to retrieve the name of the hardware represented by a PUDS channel.
This is useful when an application wants to differentiate between several models of the same device, e.g.
a PCAN-USB and a PCAN-USB Pro.
Possible values: The value is a null-terminated string which contains the name of the hardware specified
by the given PUDS channel. The length of this text will have a maximum length of 32 bytes (null termination
included).
51
PCAN-UDS 2.x API – User Manual
PUDS_PARAMETER_DEVICE_NUMBER
Access:
Description: This parameter is used on PCAN hardware to distinguish between 2 (or more) devices of the
same type connected to the same computer. This value is persistent, i.e. the identifier will not be lost after
disconnecting and connecting again a device.
Possible values: According to the firmware version, this value can be a number in the range [1..255] or
[1..4294967295]. If the firmware has a resolution of one byte and the specified value is bigger, the value
will be truncated.
Default value: If this parameter was never set before, the value is the maximum value possible for the used
resolution. For 8-bits: 255 (0xFF), for 32 bits: 429496729 (0xFFFFFFFF).
PUDS_PARAMETER_CONTROLLER_NUMBER
Access:
Description: This parameter is a zero-based index used to identify the CAN controllers built in a hardware.
This parameter is useful when it is needed to communicate with a specific physical channel on a
multichannel CAN Hardware, e.g. "0" or "1" on a PCAN-USB Pro device.
Possible values: A number in the range [0..n-1], where n is the number of physical channels on the device
being used.
PUDS_PARAMETER_CHANNEL_FEATURES
Access:
Possible values: The value can be one of the following values or a combination of them:
52
PCAN-UDS 2.x API – User Manual
3.5.4 uds_service
Represents a UDS service identifier. According to the programming language, this type can be a group of
defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_service = (
PUDS_SERVICE_SI_DiagnosticSessionControl = $10,
PUDS_SERVICE_SI_ECUReset = $11,
PUDS_SERVICE_SI_SecurityAccess = $27,
PUDS_SERVICE_SI_CommunicationControl = $28,
PUDS_SERVICE_SI_TesterPresent = $3E,
PUDS_SERVICE_SI_AccessTimingParameter = $83,
PUDS_SERVICE_SI_SecuredDataTransmission = $84,
PUDS_SERVICE_SI_ControlDTCSetting = $85,
PUDS_SERVICE_SI_ResponseOnEvent = $86,
PUDS_SERVICE_SI_LinkControl = $87,
PUDS_SERVICE_SI_ReadDataByIdentifier = $22,
PUDS_SERVICE_SI_ReadMemoryByAddress = $23,
PUDS_SERVICE_SI_ReadScalingDataByIdentifier = $24,
PUDS_SERVICE_SI_ReadDataByPeriodicIdentifier = $2A,
PUDS_SERVICE_SI_DynamicallyDefineDataIdentifier = $2C,
PUDS_SERVICE_SI_WriteDataByIdentifier = $2E,
PUDS_SERVICE_SI_WriteMemoryByAddress = $3D,
PUDS_SERVICE_SI_ClearDiagnosticInformation = $14,
PUDS_SERVICE_SI_ReadDTCInformation = $19,
PUDS_SERVICE_SI_InputOutputControlByIdentifier = $2F,
PUDS_SERVICE_SI_RoutineControl = $31,
PUDS_SERVICE_SI_RequestDownload = $34,
53
PCAN-UDS 2.x API – User Manual
PUDS_SERVICE_SI_RequestUpload = $35,
PUDS_SERVICE_SI_TransferData = $36,
PUDS_SERVICE_SI_RequestTransferExit = $37,
PUDS_SERVICE_SI_RequestFileTransfer = $38,
PUDS_SERVICE_SI_Authentication = $29,
PUDS_SERVICE_NR_SI = $7F
);
C#
C++ / CLR
54
PCAN-UDS 2.x API – User Manual
PUDS_SERVICE_SI_WriteMemoryByAddress = 0x3D,
PUDS_SERVICE_SI_ClearDiagnosticInformation = 0x14,
PUDS_SERVICE_SI_ReadDTCInformation = 0x19,
PUDS_SERVICE_SI_InputOutputControlByIdentifier = 0x2F,
PUDS_SERVICE_SI_RoutineControl = 0x31,
PUDS_SERVICE_SI_RequestDownload = 0x34,
PUDS_SERVICE_SI_RequestUpload = 0x35,
PUDS_SERVICE_SI_TransferData = 0x36,
PUDS_SERVICE_SI_RequestTransferExit = 0x37,
PUDS_SERVICE_SI_RequestFileTransfer = 0x38,
PUDS_SERVICE_SI_Authentication = 0x29,
PUDS_SERVICE_NR_SI = 0x7F,
};
Visual Basic
Values
Name Value Description
PUDS_SI_DiagnosticSessionControl 0x10 (16) Identifier of the UDS Service DiagnosticSessionControl.
PUDS_SI_ECUReset 0x11 (17) Identifier of the UDS Service ECUReset.
PUDS_SI_SecurityAccess 0x27 (39) Identifier of the UDS Service SecurityAccess.
PUDS_SI_CommunicationControl 0x28 (40) Identifier of the UDS Service CommunicationControl.
PUDS_SI_TesterPresent 0x3E (62) Identifier of the UDS Service TesterPresent.
PUDS_SI_AccessTimingParameter 0x83 (131) Identifier of the UDS Service AccessTimingParameter.
PUDS_SI_SecuredDataTransmission 0x84 (132) Identifier of the UDS Service SecuredDataTransmission.
PUDS_SI_ControlDTCSetting 0x85 (133) Identifier of the UDS Service ControlDTCSetting.
PUDS_SI_ResponseOnEvent 0x86 (134) Identifier of the UDS Service ResponseOnEvent.
PUDS_SI_LinkControl 0x87 (135) Identifier of the UDS Service LinkControl.
55
PCAN-UDS 2.x API – User Manual
3.5.5 uds_address
Represents the legislated addresses used with OBD (ISO-15765-4) communication. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_address = (
PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT = $F1,
PUDS_ADDRESS_ISO_15765_4_ADDR_OBD_FUNCTIONAL = $33,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1 = $1,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_2 = $2,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_3 = $3,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_4 = $4,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_5 = $5,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_6 = $6,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_7 = $7,
PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_8 = $8
);
56
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT 0xF1 (241) Legislated physical address for external equipment.
PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL 0x33 (51) Functional address for legislated OBD system.
PUDS_ISO_15765_4_ADDR_ECU_1 0x01 (1) Legislated-OBD ECU #1.
PUDS_ISO_15765_4_ADDR_ECU_2 0x02 (2) Legislated-OBD ECU #2.
PUDS_ISO_15765_4_ADDR_ECU_3 0x03 (3) Legislated-OBD ECU #3.
PUDS_ISO_15765_4_ADDR_ECU_4 0x04 (4) Legislated-OBD ECU #4.
PUDS_ISO_15765_4_ADDR_ECU_5 0x05 (5) Legislated-OBD ECU #5.
PUDS_ISO_15765_4_ADDR_ECU_6 0x06 (6) Legislated-OBD ECU #6.
PUDS_ISO_15765_4_ADDR_ECU_7 0x07 (7) Legislated-OBD ECU #7.
PUDS_ISO_15765_4_ADDR_ECU_8 0x08 (8) Legislated-OBD ECU #8.
57
PCAN-UDS 2.x API – User Manual
3.5.6 uds_can_id
Represents the legislated CAN Identifiers used with OBD (ISO-15765-4) communication. Each of these CAN
identifiers is assigned to a specific network addressing information (see uds_mapping on page 25 and default
mappings in UDS and ISO-TP Network Addressing Information on page 771). According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_can_id = (
PUDS_CAN_ID_ISO_15765_4_FUNCTIONAL_REQUEST = $7DF,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1 = $7E0,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1 = $7E8,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_2 = $7E1,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_2 = $7E9,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_3 = $7E2,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_3 = $7EA,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_4 = $7E3,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_4 = $7EB,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_5 = $7E4,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_5 = $7EC,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_6 = $7E5,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_6 = $7ED,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_7 = $7E6,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_7 = $7EE,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_8 = $7E7,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_8 = $7EF
);
C#
58
PCAN-UDS 2.x API – User Manual
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_2 = 0x7E9,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_3 = 0x7E2,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_3 = 0x7EA,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_4 = 0x7E3,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_4 = 0x7EB,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_5 = 0x7E4,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_5 = 0x7EC,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_6 = 0x7E5,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_6 = 0x7ED,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_7 = 0x7E6,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_7 = 0x7EE,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_8 = 0x7E7,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_8 = 0x7EF
}
C++ / CLR
Visual Basic
59
PCAN-UDS 2.x API – User Manual
Values
Name Value Description
PUDS_ISO_15765_4_CAN_ID_FUNCTIONAL_REQUEST 0x7DF CAN identifier for functionally addressed request messages sent
by external test equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1 0x7E0 Physical request CAN ID from external test equipment to ECU #1.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_1 0x7E8 Physical response CAN ID from ECU #1 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_2 0x7E1 Physical request CAN ID from external test equipment to ECU #2.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_2 0x7E9 Physical response CAN ID from ECU #2 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_3 0x7E2 Physical request CAN ID from external test equipment to ECU #3.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_3 0x7EA Physical response CAN ID from ECU #3 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_4 0x7E3 Physical request CAN ID from external test equipment to ECU #4.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_4 0x7EB Physical response CAN ID from ECU #4 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_5 0x7E4 Physical request CAN ID from external test equipment to ECU #5.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_5 0x7EC Physical response CAN ID from ECU #5 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_6 0x7E5 Physical request CAN ID from external test equipment to ECU #6.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_6 0x7ED Physical response CAN ID from ECU #6 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_7 0x7E6 Physical request CAN ID from external test equipment to ECU #7.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_7 0x7EE Physical response CAN ID from ECU #7 to external test
equipment.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_8 0x7E7 Physical request CAN ID from external test equipment to ECU #8.
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_8 0x7EF Physical response CAN ID from ECU #8 to external test
equipment.
3.5.7 uds_status_offset
Defines constants used by the uds_status enumeration. According to the programming language, this type
can be a group of defined values or an enumeration.
Syntax
C/C++
#define PCANTP_STATUS_OFFSET_BUS 8
#define PCANTP_STATUS_OFFSET_NET (PCANTP_STATUS_OFFSET_BUS + 5)
#define PCANTP_STATUS_OFFSET_INFO (PCANTP_STATUS_OFFSET_NET + 5)
#define PCANTP_STATUS_OFFSET_UDS (PCANTP_STATUS_OFFSET_INFO + 6)
Pascal OO
const
PCANTP_STATUS_OFFSET_BUS = 8;
PCANTP_STATUS_OFFSET_NET = (PCANTP_STATUS_OFFSET_BUS + 5);
PCANTP_STATUS_OFFSET_INFO = (PCANTP_STATUS_OFFSET_NET + 5);
PCANTP_STATUS_OFFSET_UDS = (PCANTP_STATUS_OFFSET_INFO + 6);
C#
60
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Values
Name Value Description
PCANTP_STATUS_OFFSET_BUS 8 Bit shifting offset used for bus status code (see uds_status on page 32).
PCANTP_STATUS_OFFSET_NET 13 Bit shifting offset used for network status code (see uds_status on page 32).
PCANTP_STATUS_OFFSET_INFO 18 Bit shifting offset used for extra information status code (see uds_status on page 32).
PCANTP_STATUS_OFFSET_UDS 24 Bit shifting offset used for PUDS status code (see uds_status on page 32).
3.5.8 uds_msgprotocol
Represents a standardized and supported network communication protocol. It is a combination of the ISO-
TP network addressing information supported in UDS.
Syntax
C/C++
Pascal OO
uds_msgprotocol = (
PUDS_MSGPROTOCOL_NONE = UInt32($0),
PUDS_MSGPROTOCOL_ISO_15765_2_11B_EXTENDED = UInt32($07),
61
PCAN-UDS 2.x API – User Manual
PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL = UInt32($01),
PUDS_MSGPROTOCOL_ISO_15765_2_11B_REMOTE = UInt32($02),
PUDS_MSGPROTOCOL_ISO_15765_2_29B_EXTENDED = UInt32($08),
PUDS_MSGPROTOCOL_ISO_15765_2_29B_FIXED_NORMAL = UInt32($03),
PUDS_MSGPROTOCOL_ISO_15765_2_29B_NORMAL = UInt32($06),
PUDS_MSGPROTOCOL_ISO_15765_2_29B_REMOTE = UInt32($04),
PUDS_MSGPROTOCOL_ISO_15765_3_29B_ENHANCED = UInt32($05));
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_MSGPROTOCOL_NONE 0 Network layer configuration for Unacknowledged
Unsegmented Data Transfer (UUDT).
PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL 1 Network layer configuration for the PCAN-ISO-TP 3.x API: 11
BIT CAN identifier, NORMAL addressing, and diagnostic
message type (mapping required).
62
PCAN-UDS 2.x API – User Manual
3.5.9 uds_msgtype
Represents type and flags for a uds_msg .
Syntax
C/C++
Pascal OO
uds_msgtype = (
PUDS_MSGTYPE_USDT = 0,
PUDS_MSGTYPE_UUDT = 1,
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE = 2,
PUDS_MSGTYPE_FLAG_LOOPBACK = 4,
PUDS_MSGTYPE_MASK_TYPE = $1
);
63
PCAN-UDS 2.x API – User Manual
C#
[Flags]
public enum uds_msgtype : UInt32
{
PUDS_MSGTYPE_USDT = 0,
PUDS_MSGTYPE_UUDT = 1,
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE = 2,
PUDS_MSGTYPE_FLAG_LOOPBACK = 4,
PUDS_MSGTYPE_MASK_TYPE = 0x01,
}
C++ / CLR
Visual Basic
<Flags()>
Public Enum uds_msgtype As UInt32
PUDS_MSGTYPE_USDT = 0
PUDS_MSGTYPE_UUDT = 1
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE = 2
PUDS_MSGTYPE_FLAG_LOOPBACK = 4
PUDS_MSGTYPE_MASK_TYPE = &H1
End Enum
Values
Name Value Description
PUDS_MSGTYPE_USDT 0 Unacknowledged Segmented Data Transfer (ISO-TP message).
PUDS_MSGTYPE_UUDT 1 Unacknowledged Unsegmented Data Transfer (physical message will
use a single CAN/CAN FD frame without ISO-TP protocol control
information).
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE 2 ECU(s) shall not reply to the request on a positive response.
PUDS_MSGTYPE_FLAG_LOOPBACK 4 Message is a loopback.
PUDS_MSGTYPE_MASK_TYPE 1 Mask to get the type (USDT or UUDT).
3.5.10 uds_nrc
Represents UDS negative response codes (see ISO 14229-1:2013 §A.1 Negative response codes p.325).
Syntax
C/C++
64
PCAN-UDS 2.x API – User Manual
PUDS_NRC_SFNS = 0x12,
PUDS_NRC_IMLOIF = 0x13,
PUDS_NRC_RTL = 0x14,
PUDS_NRC_BRR = 0x21,
PUDS_NRC_CNC = 0x22,
PUDS_NRC_RSE = 0x24,
PUDS_NRC_NRFSC = 0x25,
PUDS_NRC_FPEORA = 0x26,
PUDS_NRC_ROOR = 0x31,
PUDS_NRC_SAD = 0x33,
PUDS_NRC_AR = 0x34,
PUDS_NRC_IK = 0x35,
PUDS_NRC_ENOA = 0x36,
PUDS_NRC_RTDNE = 0x37,
PUDS_NRC_SDTR = 0x38,
PUDS_NRC_SDTNA = 0x39,
PUDS_NRC_SDTF = 0x3A,
PUDS_NRC_CVFITP = 0x50,
PUDS_NRC_CVFISIG = 0x51,
PUDS_NRC_CVFICOT = 0x52,
PUDS_NRC_CVFIT = 0x53,
PUDS_NRC_CVFIF = 0x54,
PUDS_NRC_CVFIC = 0x55,
PUDS_NRC_CVFISCP = 0x56,
PUDS_NRC_CVFICERT = 0x57,
PUDS_NRC_OVF = 0x58,
PUDS_NRC_CCF = 0x59,
PUDS_NRC_SARF = 0x5A,
PUDS_NRC_SKCDF = 0x5B,
PUDS_NRC_CDUF = 0x5C,
PUDS_NRC_DAF = 0x5D,
PUDS_NRC_UDNA = 0x70,
PUDS_NRC_TDS = 0x71,
PUDS_NRC_GPF = 0x72,
PUDS_NRC_WBSC = 0x73,
PUDS_NRC_RCRRP = 0x78,
PUDS_NRC_SFNSIAS = 0x7E,
PUDS_NRC_SNSIAS = 0x7F,
PUDS_NRC_RPMTH = 0x81,
PUDS_NRC_RPMTL = 0x82,
PUDS_NRC_EIR = 0x83,
PUDS_NRC_EINR = 0x84,
PUDS_NRC_ERTTL = 0x85,
PUDS_NRC_TEMPTH = 0x86,
PUDS_NRC_TEMPTL = 0x87,
PUDS_NRC_VSTH = 0x88,
PUDS_NRC_VSTL = 0x89,
PUDS_NRC_TPTH = 0x8A,
PUDS_NRC_TPTL = 0x8B,
PUDS_NRC_TRNIN = 0x8C,
PUDS_NRC_TRNIG = 0x8D,
PUDS_NRC_BSNC = 0x8F,
PUDS_NRC_SLNIP = 0x90,
PUDS_NRC_TCCL = 0x91,
PUDS_NRC_VTH = 0x92,
PUDS_NRC_VTL = 0x93,
PUDS_NRC_RTNA = 0x94
} uds_nrc;
65
PCAN-UDS 2.x API – User Manual
Pascal OO
uds_nrc = (
PUDS_NRC_PR = $00,
PUDS_NRC_GR = $10,
PUDS_NRC_SNS = $11,
PUDS_NRC_SFNS = $12,
PUDS_NRC_IMLOIF = $13,
PUDS_NRC_RTL = $14,
PUDS_NRC_BRR = $21,
PUDS_NRC_CNC = $22,
PUDS_NRC_RSE = $24,
PUDS_NRC_NRFSC = $25,
PUDS_NRC_FPEORA = $26,
PUDS_NRC_ROOR = $31,
PUDS_NRC_SAD = $33,
PUDS_NRC_AR = $34,
PUDS_NRC_IK = $35,
PUDS_NRC_ENOA = $36,
PUDS_NRC_RTDNE = $37,
PUDS_NRC_SDTR = $38,
PUDS_NRC_SDTNA = $39,
PUDS_NRC_SDTF = $3A,
PUDS_NRC_CVFITP = $50,
PUDS_NRC_CVFISIG = $51,
PUDS_NRC_CVFICOT = $52,
PUDS_NRC_CVFIT = $53,
PUDS_NRC_CVFIF = $54,
PUDS_NRC_CVFIC = $55,
PUDS_NRC_CVFISCP = $56,
PUDS_NRC_CVFICERT = $57,
PUDS_NRC_OVF = $58,
PUDS_NRC_CCF = $59,
PUDS_NRC_SARF = $5A,
PUDS_NRC_SKCDF = $5B,
PUDS_NRC_CDUF = $5C,
PUDS_NRC_DAF = $5D,
PUDS_NRC_UDNA = $70,
PUDS_NRC_TDS = $71,
PUDS_NRC_GPF = $72,
PUDS_NRC_WBSC = $73,
PUDS_NRC_RCRRP = $78,
PUDS_NRC_SFNSIAS = $7E,
PUDS_NRC_SNSIAS = $7F,
PUDS_NRC_RPMTH = $81,
PUDS_NRC_RPMTL = $82,
PUDS_NRC_EIR = $83,
PUDS_NRC_EINR = $84,
PUDS_NRC_ERTTL = $85,
PUDS_NRC_TEMPTH = $86,
PUDS_NRC_TEMPTL = $87,
PUDS_NRC_VSTH = $88,
PUDS_NRC_VSTL = $89,
PUDS_NRC_TPTH = $8A,
PUDS_NRC_TPTL = $8B,
PUDS_NRC_TRNIN = $8C,
PUDS_NRC_TRNIG = $8D,
PUDS_NRC_BSNC = $8F,
PUDS_NRC_SLNIP = $90,
PUDS_NRC_TCCL = $91,
66
PCAN-UDS 2.x API – User Manual
PUDS_NRC_VTH = $92,
PUDS_NRC_VTL = $93,
PUDS_NRC_RTNA = $94);
C#
67
PCAN-UDS 2.x API – User Manual
PUDS_NRC_BSNC = 0x8F,
PUDS_NRC_SLNIP = 0x90,
PUDS_NRC_TCCL = 0x91,
PUDS_NRC_VTH = 0x92,
PUDS_NRC_VTL = 0x93,
PUDS_NRC_RTNA = 0x94
}
C++ / CLR
68
PCAN-UDS 2.x API – User Manual
PUDS_NRC_TPTH = 0x8A,
PUDS_NRC_TPTL = 0x8B,
PUDS_NRC_TRNIN = 0x8C,
PUDS_NRC_TRNIG = 0x8D,
PUDS_NRC_BSNC = 0x8F,
PUDS_NRC_SLNIP = 0x90,
PUDS_NRC_TCCL = 0x91,
PUDS_NRC_VTH = 0x92,
PUDS_NRC_VTL = 0x93,
PUDS_NRC_RTNA = 0x94
};
Visual Basic
69
PCAN-UDS 2.x API – User Manual
PUDS_NRC_TEMPTL = &H87
PUDS_NRC_VSTH = &H88
PUDS_NRC_VSTL = &H89
PUDS_NRC_TPTH = &H8A
PUDS_NRC_TPTL = &H8B
PUDS_NRC_TRNIN = &H8C
PUDS_NRC_TRNIG = &H8D
PUDS_NRC_BSNC = &H8F
PUDS_NRC_SLNIP = &H90
PUDS_NRC_TCCL = &H91
PUDS_NRC_VTH = &H92
PUDS_NRC_VTL = &H93
PUDS_NRC_RTNA = &H94
End Enum
Values
Name Value Description
PUDS_NRC_PR 0x00 Positive Response
PUDS_NRC_GR 0x10 General Reject
PUDS_NRC_SNS 0x11 Service Not Supported
PUDS_NRC_SFNS 0x12 Sub Function Not Supported
PUDS_NRC_IMLOIF 0x13 Incorrect Message Length Or Invalid Format
PUDS_NRC_RTL 0x14 Response Too Long
PUDS_NRC_BRR 0x21 Busy Repeat Request
PUDS_NRC_CNC 0x22 Conditions Not Correct
PUDS_NRC_RSE 0x24 Request Sequence Error
PUDS_NRC_NRFSC 0x25 No Response From Subnet Component
PUDS_NRC_FPEORA 0x26 Failure Prevents Execution Of Requested Action
PUDS_NRC_ROOR 0x31 Request Out Of Range
PUDS_NRC_SAD 0x33 Security Access Denied
PUDS_NRC_AR 0x34 Authentication Required
PUDS_NRC_IK 0x35 Invalid Key
PUDS_NRC_ENOA 0x36 Exceeded Number Of Attempts
PUDS_NRC_RTDNE 0x37 Required Time Delay Not Expired
PUDS_NRC_SDTR 0x38 Secure Data Transmission Required
PUDS_NRC_SDTNA 0x39 Secure Data Transmission Not Allowed
PUDS_NRC_SDTF 0x3A Secure Data Verification Failed
PUDS_NRC_CVFITP 0x50 Certificate Verification Failed Invalid Time Period
PUDS_NRC_CVFISIG 0x51 Certificate Verification Failed Invalid SIGnature
PUDS_NRC_CVFICOT 0x52 Certificate Verification Failed Invalid Chain of Trust
PUDS_NRC_CVFIT 0x53 Certificate Verification Failed Invalid Type
PUDS_NRC_CVFIF 0x54 Certificate Verification Failed Invalid Format
PUDS_NRC_CVFIC 0x55 Certificate Verification Failed Invalid Content
PUDS_NRC_CVFISCP 0x56 Certificate Verification Failed Invalid ScoPe
PUDS_NRC_CVFICERT 0x57 Certificate Verification Failed Invalid CERTificate(revoked)
PUDS_NRC_OVF 0x58 Ownership Verification Failed
PUDS_NRC_CCF 0x59 Challenge Calculation Failed
PUDS_NRC_SARF 0x5A Setting Access Rights Failed
PUDS_NRC_SKCDF 0x5B Session Key Creation / Derivation Failed
PUDS_NRC_CDUF 0x5C Configuration Data Usage Failed
PUDS_NRC_DAF 0x5D DeAuthentication Failed
PUDS_NRC_UDNA 0x70 Upload Download Not Accepted
PUDS_NRC_TDS 0x71 Transfer Data Suspended
PUDS_NRC_GPF 0x72 General Programming Failure
PUDS_NRC_WBSC 0x73 Wrong Block Sequence Counter
70
PCAN-UDS 2.x API – User Manual
3.5.11 uds_svc_param_dsc
Represents the subfunction parameter for UDS service DiagnosticSessionControl. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_dsc = (
PUDS_SVC_PARAM_DSC_DS = $1,
PUDS_SVC_PARAM_DSC_ECUPS = $2,
PUDS_SVC_PARAM_DSC_ECUEDS = $3,
PUDS_SVC_PARAM_DSC_SSDS = $4
);
71
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_DSC_DS 1 Default Session.
PUDS_SVC_PARAM_DSC_ECUPS 2 ECU Programming Session.
PUDS_SVC_PARAM_DSC_ECUEDS 3 ECU Extended Diagnostic Session.
PUDS_SVC_PARAM_DSC_SSDS 4 Safety System Diagnostic Session.
3.5.12 uds_svc_param_er
Represents the subfunction parameter for UDS service ECUReset. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
72
PCAN-UDS 2.x API – User Manual
Pascal OO
uds_svc_param_er = (
PUDS_SVC_PARAM_ER_HR = $1,
PUDS_SVC_PARAM_ER_KOFFONR = $2,
PUDS_SVC_PARAM_ER_SR = $3,
PUDS_SVC_PARAM_ER_ERPSD = $4,
PUDS_SVC_PARAM_ER_DRPSD = $5
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_ER_HR 1 Hard Reset.
PUDS_SVC_PARAM_ER_KOFFONR 2 Key Off on Reset.
PUDS_SVC_PARAM_ER_SR 3 Soft Reset.
PUDS_SVC_PARAM_ER_ERPSD 4 Enable Rapid Power Shutdown.
PUDS_SVC_PARAM_ER_DRPSD 5 Disable Rapid Power Shutdown.
73
PCAN-UDS 2.x API – User Manual
3.5.13 uds_svc_param_cc
Represents the subfunction parameter for UDS service ComunicationControl. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_cc = (
PUDS_SVC_PARAM_CC_ERXTX = $0,
PUDS_SVC_PARAM_CC_ERXDTX = $1,
PUDS_SVC_PARAM_CC_DRXETX = $2,
PUDS_SVC_PARAM_CC_DRXTX = $3,
PUDS_SVC_PARAM_CC_ERXDTXWEAI = $4,
PUDS_SVC_PARAM_CC_ERXTXWEAI = $5
);
C#
Visual Basic
74
PCAN-UDS 2.x API – User Manual
Values
Name Value Description
PUDS_SVC_PARAM_CC_ERXTX 0 Enable Rx and Tx.
PUDS_SVC_PARAM_CC_ERXDTX 1 Enable Rx and Disable Tx.
PUDS_SVC_PARAM_CC_DRXETX 2 Disable Rx and Enable Tx.
PUDS_SVC_PARAM_CC_DRXTX 3 Disable Rx and Tx.
PUDS_SVC_PARAM_CC_ERXDTXWEAI 4 Enable Rx And Disable Tx With Enhanced Address Information.
PUDS_SVC_PARAM_CC_ERXTXWEAI 5 Enable Rx And Tx With Enhanced Address Information.
3.5.14 uds_svc_param_tp
Represents the subfunction parameter for UDS service TesterPresent. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_tp = (
PUDS_SVC_PARAM_TP_ZSUBF = $0
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_TP_ZSUBF 0 Zero subfunction.
75
PCAN-UDS 2.x API – User Manual
3.5.15 uds_svc_param_cdtcs
Represents the subfunction parameter for UDS service ControlDTCSetting. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_cdtcs = (
PUDS_SVC_PARAM_CDTCS_ON = $1,
PUDS_SVC_PARAM_CDTCS_OFF = $2
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_CDTCS_ON 1 The server(s)/ECU(s) shall resume the setting of diagnostic trouble
codes.
PUDS_SVC_PARAM_CDTCS_OFF 2 The server(s)/ECU(s) shall stop the setting of diagnostic trouble codes.
76
PCAN-UDS 2.x API – User Manual
3.5.16 uds_svc_param_roe
Represents the subfunction parameter for UDS service ResponseOnEvent. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_roe = (
PUDS_SVC_PARAM_ROE_STPROE = $0,
PUDS_SVC_PARAM_ROE_ONDTCS = $1,
PUDS_SVC_PARAM_ROE_OTI = $2,
PUDS_SVC_PARAM_ROE_OCODID = $3,
PUDS_SVC_PARAM_ROE_RAE = $4,
PUDS_SVC_PARAM_ROE_STRTROE = $5,
PUDS_SVC_PARAM_ROE_CLRROE = $6,
PUDS_SVC_PARAM_ROE_OCOV = $7,
PUDS_SVC_PARAM_ROE_RMRDOSC = $8,
PUDS_SVC_PARAM_ROE_RDRIODSC = $9
);
C#
public enum uds_svc_param_roe : Byte
{
PUDS_SVC_PARAM_ROE_STPROE = 0x00,
PUDS_SVC_PARAM_ROE_ONDTCS = 0x01,
PUDS_SVC_PARAM_ROE_OTI = 0x02,
PUDS_SVC_PARAM_ROE_OCODID = 0x03,
PUDS_SVC_PARAM_ROE_RAE = 0x04,
PUDS_SVC_PARAM_ROE_STRTROE = 0x05,
PUDS_SVC_PARAM_ROE_CLRROE = 0x06,
PUDS_SVC_PARAM_ROE_OCOV = 0x07,
PUDS_SVC_PARAM_ROE_RMRDOSC = 0x08,
PUDS_SVC_PARAM_ROE_RDRIODSC = 0x09
}
C++ / CLR
enum struct uds_svc_param_roe : Byte
{
PUDS_SVC_PARAM_ROE_STPROE = 0x00,
PUDS_SVC_PARAM_ROE_ONDTCS = 0x01,
PUDS_SVC_PARAM_ROE_OTI = 0x02,
PUDS_SVC_PARAM_ROE_OCODID = 0x03,
PUDS_SVC_PARAM_ROE_RAE = 0x04,
PUDS_SVC_PARAM_ROE_STRTROE = 0x05,
PUDS_SVC_PARAM_ROE_CLRROE = 0x06,
PUDS_SVC_PARAM_ROE_OCOV = 0x07,
77
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_ROE_RMRDOSC = 0x08,
PUDS_SVC_PARAM_ROE_RDRIODSC = 0x09
};
Visual Basic
Public Enum uds_svc_param_roe As Byte
PUDS_SVC_PARAM_ROE_STPROE = &H0
PUDS_SVC_PARAM_ROE_ONDTCS = &H1
PUDS_SVC_PARAM_ROE_OTI = &H2
PUDS_SVC_PARAM_ROE_OCODID = &H3
PUDS_SVC_PARAM_ROE_RAE = &H4
PUDS_SVC_PARAM_ROE_STRTROE = &H5
PUDS_SVC_PARAM_ROE_CLRROE = &H6
PUDS_SVC_PARAM_ROE_OCOV = &H7
PUDS_SVC_PARAM_ROE_RMRDOSC = &H8
PUDS_SVC_PARAM_ROE_RDRIODSC = &H9
End Enum
Values
Name Value Description
PUDS_SVC_PARAM_ROE_STPROE 0 Stop Response On Event.
PUDS_SVC_PARAM_ROE_ONDTCS 1 On DTC Status Change.
PUDS_SVC_PARAM_ROE_OTI 2 On Timer Interrupt.
PUDS_SVC_PARAM_ROE_OCODID 3 On Change Of Data Identifier.
PUDS_SVC_PARAM_ROE_RAE 4 Report Activated Events.
PUDS_SVC_PARAM_ROE_STRTROE 5 Start Response On Event.
PUDS_SVC_PARAM_ROE_CLRROE 6 Clear Response On Event.
PUDS_SVC_PARAM_ROE_OCOV 7 On Comparison Of Values.
PUDS_SVC_PARAM_ROE_RMRDOSC 8 Report Most Recent Dtc On Status Change (ISO 14229-1:2020)
PUDS_SVC_PARAM_ROE_RDRIODSC 9 Report Dtc Record Information On Dtc Status Change (ISO
14229-1:2020)
3.5.17 uds_svc_param_roe_recommended_service_id
Represents the recommended service to use with the UDS service ResponseOnEvent. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
#define PUDS_SVC_PARAM_ROE_STRT_SI_RDBI PUDS_SI_ReadDataByIdentifier
#define PUDS_SVC_PARAM_ROE_STRT_SI_RDTCI PUDS_SI_ReadDTCInformation
#define PUDS_SVC_PARAM_ROE_STRT_SI_RC PUDS_SI_RoutineControl
#define PUDS_SVC_PARAM_ROE_STRT_SI_IOCBI PUDS_SI_InputOutputControlByIdentifier
Pascal OO
uds_svc_param_roe_recommended_service_id = (
PUDS_SVC_PARAM_ROE_STRT_SI_RDBI = Byte(PUDS_SERVICE_SI_ReadDataByIdentifier),
PUDS_SVC_PARAM_ROE_STRT_SI_RDTCI = Byte(PUDS_SERVICE_SI_ReadDTCInformation),
PUDS_SVC_PARAM_ROE_STRT_SI_RC = Byte(PUDS_SERVICE_SI_RoutineControl),
PUDS_SVC_PARAM_ROE_STRT_SI_IOCBI = Byte(PUDS_SERVICE_SI_InputOutputControlByIdentifier)
);
78
PCAN-UDS 2.x API – User Manual
C#
enum uds_svc_param_roe_recommended_service_id : Byte
{
PUDS_SVC_PARAM_ROE_STRT_SI_RDBI = uds_service.PUDS_SERVICE_SI_ReadDataByIdentifier,
PUDS_SVC_PARAM_ROE_STRT_SI_RDTCI = uds_service.PUDS_SERVICE_SI_ReadDTCInformation,
PUDS_SVC_PARAM_ROE_STRT_SI_RC = uds_service.PUDS_SERVICE_SI_RoutineControl,
PUDS_SVC_PARAM_ROE_STRT_SI_IOCBI = uds_service.PUDS_SERVICE_SI_InputOutputControlByIdentifier
}
C++ / CLR
enum struct uds_svc_param_roe_recommended_service_id : Byte
{
PUDS_SVC_PARAM_ROE_STRT_SI_RDBI = uds_service::PUDS_SERVICE_SI_ReadDataByIdentifier,
PUDS_SVC_PARAM_ROE_STRT_SI_RDTCI = uds_service::PUDS_SERVICE_SI_ReadDTCInformation,
PUDS_SVC_PARAM_ROE_STRT_SI_RC = uds_service::PUDS_SERVICE_SI_RoutineControl,
PUDS_SVC_PARAM_ROE_STRT_SI_IOCBI = uds_service::PUDS_SERVICE_SI_InputOutputControlByIdentifier
};
Visual Basic
Enum uds_svc_param_roe_recommended_service_id As Byte
PUDS_SVC_PARAM_ROE_STRT_SI_RDBI = uds_service.PUDS_SERVICE_SI_ReadDataByIdentifier
PUDS_SVC_PARAM_ROE_STRT_SI_RDTCI = uds_service.PUDS_SERVICE_SI_ReadDTCInformation
PUDS_SVC_PARAM_ROE_STRT_SI_RC = uds_service.PUDS_SERVICE_SI_RoutineControl
PUDS_SVC_PARAM_ROE_STRT_SI_IOCBI = uds_service.PUDS_SERVICE_SI_InputOutputControlByIdentifier
End Enum
Values
Name Value Description
PUDS_SVC_PARAM_ROE_STRT_SI_RDBI PUDS_SI_ReadDataByIdentifier UDS service ReadDataByIdentifier.
PUDS_SVC_PARAM_ROE_STRT_SI_RDTCI PUDS_SI_ReadDTCInformation UDS service ReadDTCInformation.
PUDS_SVC_PARAM_ROE_STRT_SI_RC PUDS_SI_RoutineControl UDS service RoutineControl.
PUDS_SVC_PARAM_ROE_STRT_SI_IOCBI PUDS_SI_InputOutputControlByIdentifier UDS service
InputOutputControlByIdentifier.
3.5.18 uds_svc_param_lc
Represents the subfunction parameter for UDS service LinkControl. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_lc = (
PUDS_SVC_PARAM_LC_VBTWFBR = $1,
PUDS_SVC_PARAM_LC_VBTWSBR = $2,
PUDS_SVC_PARAM_LC_TB = $3
);
79
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_LC_VBTWFBR 1 Verify Baud rate Transition With Fixed Baud rate.
PUDS_SVC_PARAM_LC_VBTWSBR 2 Verify Baud rate Transition With Specific Baud rate.
PUDS_SVC_PARAM_LC_TB 3 Transition Baud rate.
3.5.19 uds_svc_param_lc_baudrate_identifier
Represents the standard baud rate identifiers to use with the UDS service LinkControl. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_lc_baudrate_identifier = (
PUDS_SVC_PARAM_LC_BAUDRATE_PC_9600 = $1,
PUDS_SVC_PARAM_LC_BAUDRATE_PC_19200 = $2,
80
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_LC_BAUDRATE_PC_38400 = $3,
PUDS_SVC_PARAM_LC_BAUDRATE_PC_57600 = $4,
PUDS_SVC_PARAM_LC_BAUDRATE_PC_115200 = $5,
PUDS_SVC_PARAM_LC_BAUDRATE_CAN_125K = $10,
PUDS_SVC_PARAM_LC_BAUDRATE_CAN_250K = $11,
PUDS_SVC_PARAM_LC_BAUDRATE_CAN_500K = $12,
PUDS_SVC_PARAM_LC_BAUDRATE_CAN_1M = $13,
PUDS_SVC_PARAM_LC_BAUDRATE_PROGSU = $20
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_LC_BAUDRATE_PC_9600 0x1 (1) Standard PC baud rate of 9.6 KBaud.
81
PCAN-UDS 2.x API – User Manual
3.5.20 uds_svc_param_di
Represents the Data Identifiers defined in UDS standard ISO-14229-1. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_di = (
PUDS_SVC_PARAM_DI_BSIDID = $F180,
PUDS_SVC_PARAM_DI_ASIDID = $F181,
PUDS_SVC_PARAM_DI_ADIDID = $F182,
82
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_DI_BSFPDID = $F183,
PUDS_SVC_PARAM_DI_ASFPDID = $F184,
PUDS_SVC_PARAM_DI_ADFPDID = $F185,
PUDS_SVC_PARAM_DI_ADSDID = $F186,
PUDS_SVC_PARAM_DI_VMSPNDID = $F187,
PUDS_SVC_PARAM_DI_VMECUSNDID = $F188,
PUDS_SVC_PARAM_DI_VMECUSVNDID = $F189,
PUDS_SVC_PARAM_DI_SSIDDID = $F18A,
PUDS_SVC_PARAM_DI_ECUMDDID = $F18B,
PUDS_SVC_PARAM_DI_ECUSNDID = $F18C,
PUDS_SVC_PARAM_DI_SFUDID = $F18D,
PUDS_SVC_PARAM_DI_VMKAPNDID = $F18E,
PUDS_SVC_PARAM_DI_VINDID = $F190,
PUDS_SVC_PARAM_DI_VMECUHNDID = $F191,
PUDS_SVC_PARAM_DI_SSECUHWNDID = $F192,
PUDS_SVC_PARAM_DI_SSECUHWVNDID = $F193,
PUDS_SVC_PARAM_DI_SSECUSWNDID = $F194,
PUDS_SVC_PARAM_DI_SSECUSWVNDID = $F195,
PUDS_SVC_PARAM_DI_EROTANDID = $F196,
PUDS_SVC_PARAM_DI_SNOETDID = $F197,
PUDS_SVC_PARAM_DI_RSCOTSNDID = $F198,
PUDS_SVC_PARAM_DI_PDDID = $F199,
PUDS_SVC_PARAM_DI_CRSCOCESNDID = $F19A,
PUDS_SVC_PARAM_DI_CDDID = $F19B,
PUDS_SVC_PARAM_DI_CESWNDID = $F19C,
PUDS_SVC_PARAM_DI_EIDDID = $F19D,
PUDS_SVC_PARAM_DI_ODXFDID = $F19E,
PUDS_SVC_PARAM_DI_EDID = $F19F
);
C#
83
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_DI_EIDDID = 0xF19D,
PUDS_SVC_PARAM_DI_ODXFDID = 0xF19E,
PUDS_SVC_PARAM_DI_EDID = 0xF19F
}
C++ / CLR
Visual Basic
84
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_DI_SSECUHWNDID = &HF192
PUDS_SVC_PARAM_DI_SSECUHWVNDID = &HF193
PUDS_SVC_PARAM_DI_SSECUSWNDID = &HF194
PUDS_SVC_PARAM_DI_SSECUSWVNDID = &HF195
PUDS_SVC_PARAM_DI_EROTANDID = &HF196
PUDS_SVC_PARAM_DI_SNOETDID = &HF197
PUDS_SVC_PARAM_DI_RSCOTSNDID = &HF198
PUDS_SVC_PARAM_DI_PDDID = &HF199
PUDS_SVC_PARAM_DI_CRSCOCESNDID = &HF19A
PUDS_SVC_PARAM_DI_CDDID = &HF19B
PUDS_SVC_PARAM_DI_CESWNDID = &HF19C
PUDS_SVC_PARAM_DI_EIDDID = &HF19D
PUDS_SVC_PARAM_DI_ODXFDID = &HF19E
PUDS_SVC_PARAM_DI_EDID = &HF19F
End Enum
Values
Name Value Description
PUDS_SVC_PARAM_DI_BSIDID 0xF180 Boot Software Identification Data Identifier.
PUDS_SVC_PARAM_DI_ASIDID 0xF181 Application Software Identification Data Identifier.
PUDS_SVC_PARAM_DI_ADIDID 0xF182 Application Data Identification Data Identifier.
PUDS_SVC_PARAM_DI_BSFPDID 0xF183 Boot Software Identification Data Identifier.
PUDS_SVC_PARAM_DI_ASFPDID 0xF184 Application Software Fingerprint Data Identifier.
PUDS_SVC_PARAM_DI_ADFPDID 0xF185 Application Data Fingerprint Data Identifier.
PUDS_SVC_PARAM_DI_ADSDID 0xF186 Active Diagnostic Session Data Identifier.
PUDS_SVC_PARAM_DI_VMSPNDID 0xF187 Vehicle Manufacturer Spare Part Number Data Identifier.
PUDS_SVC_PARAM_DI_VMECUSNDID 0xF188 Vehicle Manufacturer ECU Software Number Data Identifier.
PUDS_SVC_PARAM_DI_VMECUSVNDID 0xF189 Vehicle Manufacturer ECU Software Version Number Data Identifier.
PUDS_SVC_PARAM_DI_SSIDDID 0xF18A System Supplier Identifier Data Identifier.
PUDS_SVC_PARAM_DI_ECUMDDID 0xF18B ECU Manufacturing Date Data Identifier.
PUDS_SVC_PARAM_DI_ECUSNDID 0xF18C ECU Serial Number Data Identifier.
PUDS_SVC_PARAM_DI_SFUDID 0xF18D Supported Functional Units Data Identifier.
PUDS_SVC_PARAM_DI_VMKAPNDID 0xF18E Vehicle Manufacturer Kit Assembly Part Number Data Identifier.
PUDS_SVC_PARAM_DI_VINDID 0xF190 VIN Data Identifier.
PUDS_SVC_PARAM_DI_VMECUHNDID 0xF191 Vehicle Manufacturer ECU Hardware Number Data Identifier.
PUDS_SVC_PARAM_DI_SSECUHWNDID 0xF192 System Supplier ECU Hardware Number Data Identifier.
PUDS_SVC_PARAM_DI_SSECUHWVNDID 0xF193 System Supplier ECU Hardware Version Number Data Identifier.
PUDS_SVC_PARAM_DI_SSECUSWNDID 0xF194 System Supplier ECU Software Number Data Identifier.
PUDS_SVC_PARAM_DI_SSECUSWVNDID 0xF195 System Supplier ECU Software Version Number Data Identifier.
PUDS_SVC_PARAM_DI_EROTANDID 0xF196 Exhaust Regulation Or Type Approval Number Data Identifier.
PUDS_SVC_PARAM_DI_SNOETDID 0xF197 System Name Or Engine Type Data Identifier.
PUDS_SVC_PARAM_DI_RSCOTSNDID 0xF198 Repair Shop Code Or Tester Serial Number Data Identifier.
PUDS_SVC_PARAM_DI_PDDID 0xF199 Programming Date Data Identifier.
PUDS_SVC_PARAM_DI_CRSCOCESNDID 0xF19A Calibration Repair Shop Code Or Calibration Equipment Serial Number Data
Identifier.
PUDS_SVC_PARAM_DI_CDDID 0xF19B Calibration Date Data Identifier.
PUDS_SVC_PARAM_DI_CESWNDID 0xF19C Calibration Equipment Software Number Data Identifier.
PUDS_SVC_PARAM_DI_EIDDID 0xF19D ECU Installation Date Data Identifier.
PUDS_SVC_PARAM_DI_ODXFDID 0xF19E ODX File Data Identifier.
PUDS_SVC_PARAM_DI_EDID 0xF19F Entity Data Identifier.
85
PCAN-UDS 2.x API – User Manual
3.5.21 uds_svc_param_rdbpi
Represents the subfunction parameter for UDS service ReadDataByPeriodicIdentifier. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_rdbpi = (
PUDS_SVC_PARAM_RDBPI_SASR = $1,
PUDS_SVC_PARAM_RDBPI_SAMR = $2,
PUDS_SVC_PARAM_RDBPI_SAFR = $3,
PUDS_SVC_PARAM_RDBPI_SS = $4
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_RDBPI_SASR 1 Send At Slow Rate.
PUDS_SVC_PARAM_RDBPI_SAMR 2 Send At Medium Rate.
PUDS_SVC_PARAM_RDBPI_SAFR 3 Send At Fast Rate.
PUDS_SVC_PARAM_RDBPI_SS 4 Stop Sending.
86
PCAN-UDS 2.x API – User Manual
3.5.22 uds_svc_param_dddi
Represents the subfunction parameter for UDS service DynamicallyDefineDataIdentifier. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_dddi = (
PUDS_SVC_PARAM_DDDI_DBID = $1,
PUDS_SVC_PARAM_DDDI_DBMA = $2,
PUDS_SVC_PARAM_DDDI_CDDDI = $3
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_DDDI_DBID 1 Define By Identifier.
PUDS_SVC_PARAM_DDDI_DBMA 2 Define By Memory Address.
PUDS_SVC_PARAM_DDDI_CDDDI 3 Clear Dynamically Defined Data Identifier.
87
PCAN-UDS 2.x API – User Manual
3.5.23 uds_svc_param_rdtci
Represents the subfunction parameter for UDS service ReadDTCInformation. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_rdtci = (
PUDS_SVC_PARAM_RDTCI_RNODTCBSM = $1,
PUDS_SVC_PARAM_RDTCI_RDTCBSM = $2,
PUDS_SVC_PARAM_RDTCI_RDTCSSI = $3,
PUDS_SVC_PARAM_RDTCI_RDTCSSBDTC = $4,
PUDS_SVC_PARAM_RDTCI_RDTCSSBRN = $5,
PUDS_SVC_PARAM_RDTCI_RDTCEDRBDN = $6,
PUDS_SVC_PARAM_RDTCI_RNODTCBSMR = $7,
PUDS_SVC_PARAM_RDTCI_RDTCBSMR = $8,
PUDS_SVC_PARAM_RDTCI_RSIODTC = $9,
PUDS_SVC_PARAM_RDTCI_RSUPDTC = $A,
PUDS_SVC_PARAM_RDTCI_RFTFDTC = $B,
PUDS_SVC_PARAM_RDTCI_RFCDTC = $C,
PUDS_SVC_PARAM_RDTCI_RMRTFDTC = $D,
PUDS_SVC_PARAM_RDTCI_RMRCDTC = $E,
PUDS_SVC_PARAM_RDTCI_RMMDTCBSM = $F,
PUDS_SVC_PARAM_RDTCI_RMMDEDRBDN = $10,
PUDS_SVC_PARAM_RDTCI_RNOMMDTCBSM = $11,
PUDS_SVC_PARAM_RDTCI_RNOOBDDTCBSM = $12,
PUDS_SVC_PARAM_RDTCI_ROBDDTCBSM = $13,
PUDS_SVC_PARAM_RDTCI_RDTCEDBR = $16,
PUDS_SVC_PARAM_RDTCI_RUDMDTCBSM = $17,
88
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_RDTCI_RUDMDTCSSBDTC = $18,
PUDS_SVC_PARAM_RDTCI_RUDMDTCEDRBDN = $19,
PUDS_SVC_PARAM_RDTCI_RDTCEDI = $1A,
PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCBMR = $42,
PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCWPS = $55,
PUDS_SVC_PARAM_RDTCI_RDTCBRGI = $56,
PUDS_SVC_PARAM_RDTCI_RDTCFDC = $14,
PUDS_SVC_PARAM_RDTCI_RDTCWPS = $15
);
C#
C++ / CLR
89
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_RDTCI_RMRCDTC = 0x0E,
PUDS_SVC_PARAM_RDTCI_RMMDTCBSM = 0x0F,
PUDS_SVC_PARAM_RDTCI_RMMDEDRBDN = 0x10,
PUDS_SVC_PARAM_RDTCI_RNOMMDTCBSM = 0x11,
PUDS_SVC_PARAM_RDTCI_RNOOBDDTCBSM = 0x12,
PUDS_SVC_PARAM_RDTCI_ROBDDTCBSM = 0x13,
PUDS_SVC_PARAM_RDTCI_RDTCEDBR = 0x16,
PUDS_SVC_PARAM_RDTCI_RUDMDTCBSM = 0x17,
PUDS_SVC_PARAM_RDTCI_RUDMDTCSSBDTC = 0x18,
PUDS_SVC_PARAM_RDTCI_RUDMDTCEDRBDN = 0x19,
PUDS_SVC_PARAM_RDTCI_RDTCEDI = 0x1A,
PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCBMR = 0x42,
PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCWPS = 0x55,
PUDS_SVC_PARAM_RDTCI_RDTCBRGI = 0x56,
PUDS_SVC_PARAM_RDTCI_RDTCFDC = 0x14,
PUDS_SVC_PARAM_RDTCI_RDTCWPS = 0x15
};
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_RDTCI_RNODTCBSM 0x01 (1) Report Number Of DTC By Status Mask.
PUDS_SVC_PARAM_RDTCI_RDTCBSM 0x02 (2) Report DTC By Status Mask.
PUDS_SVC_PARAM_RDTCI_RDTCSSI 0x03 (3) Report DTC Snapshot Identification.
PUDS_SVC_PARAM_RDTCI_RDTCSSBDTC 0x04 (4) Report DTC Snapshot Record By DTC Number.
PUDS_SVC_PARAM_RDTCI_RDTCSSBRN 0x05 (5) Report DTC Snapshot Record By Record Number.
PUDS_SVC_PARAM_RDTCI_RDTCEDRBDN 0x06 (6) Report DTC Extended Data Record By DTC Number.
90
PCAN-UDS 2.x API – User Manual
3.5.24 uds_svc_param_rdtci_dtcsvm
Represents the DTC severity mask’s flags (DTCSVM) used with the UDS service SvcReadDTCInformation.
According to the programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_rdtci_dtcsvm = (
PUDS_SVC_PARAM_RDTCI_DTCSVM_NSA = $0,
PUDS_SVC_PARAM_RDTCI_DTCSVM_MO = $20,
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKANH = $40,
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKI = $80
);
C#
[Flags]
public enum uds_svc_param_rdtci_dtcsvm : Byte
{
PUDS_SVC_PARAM_RDTCI_DTCSVM_NSA = 0x00,
91
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_RDTCI_DTCSVM_MO = 0x20,
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKANH = 0x40,
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKI = 0x80
}
C++ / CLR
Visual Basic
<Flags()>
Public Enum uds_svc_param_rdtci_dtcsvm As Byte
PUDS_SVC_PARAM_RDTCI_DTCSVM_NSA = &H0
PUDS_SVC_PARAM_RDTCI_DTCSVM_MO = &H20
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKANH = &H40
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKI = &H80
End Enum
Values
Name Value Description
PUDS_SVC_PARAM_RDTCI_DTCSVM_NSA 0x00 (0) DTC severity bit definitions: No Severity Available.
PUDS_SVC_PARAM_RDTCI_DTCSVM_MO 0x20 (32) DTC severity bit definitions: Maintenance Only.
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKANH 0x40 (64) DTC severity bit definitions: CHecK At Next Halt.
PUDS_SVC_PARAM_RDTCI_DTCSVM_CHKI 0x80 (128) DTC severity bit definitions: ChecK Immediately.
3.5.25 uds_svc_param_iocbi
Represents the InputOutputControl parameter for UDS service InputOutputControlByIdentifier. According
to the programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
#define PUDS_SVC_PARAM_IOCBI_RCTECU 0x00
#define PUDS_SVC_PARAM_IOCBI_RTD 0x01
#define PUDS_SVC_PARAM_IOCBI_FCS 0x02
#define PUDS_SVC_PARAM_IOCBI_STA 0x03
Pascal OO
uds_svc_param_iocbi = (
PUDS_SVC_PARAM_IOCBI_RCTECU = $0,
PUDS_SVC_PARAM_IOCBI_RTD = $1,
PUDS_SVC_PARAM_IOCBI_FCS = $2,
PUDS_SVC_PARAM_IOCBI_STA = $3
);
C#
92
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_IOCBI_RCTECU 0 Return Control To ECU.
PUDS_SVC_PARAM_IOCBI_RTD 1 Reset To Default.
PUDS_SVC_PARAM_IOCBI_FCS 2 Freeze Current State.
PUDS_SVC_PARAM_IOCBI_STA 3 Short Term Adjustment.
3.5.26 uds_svc_param_rc
Represents the subfunction parameter for UDS service RoutineControl. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_rc = (
PUDS_SVC_PARAM_RC_STR = $1,
PUDS_SVC_PARAM_RC_STPR = $2,
PUDS_SVC_PARAM_RC_RRR = $3
);
C#
93
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_RC_STR 1 Start Routine.
PUDS_SVC_PARAM_RC_STPR 2 Stop Routine.
PUDS_SVC_PARAM_RC_RRR 3 Request Routine Results.
3.5.27 uds_svc_param_rc_rid
Represents the routine identifier used with the UDS service RoutineControl. According to the programming
language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_rc_rid = (
PUDS_SVC_PARAM_RC_RID_DLRI_ = $E200,
PUDS_SVC_PARAM_RC_RID_EM_ = $FF00,
PUDS_SVC_PARAM_RC_RID_CPD_ = $FF01,
PUDS_SVC_PARAM_RC_RID_EMMDTC_ = $FF02
);
C#
94
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_RC_RID_DLRI_ = 0xE200,
PUDS_SVC_PARAM_RC_RID_EM_ = 0xFF00,
PUDS_SVC_PARAM_RC_RID_CPD_ = 0xFF01,
PUDS_SVC_PARAM_RC_RID_EMMDTC_ = 0xFF02
}
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_RC_RID_DLRI_ 0xE200 (57856) Deploy Loop Routine ID.
PUDS_SVC_PARAM_RC_RID_EM_ 0xFF00 (65280) Erase Memory.
PUDS_SVC_PARAM_RC_RID_CPD_ 0xFF01 (65281) Check Programming Dependencies.
PUDS_SVC_PARAM_RC_RID_EMMDTC_ 0xFF02 (65282) Erase Mirror Memory DTCs.
3.5.28 uds_svc_param_atp
Represents the subfunction parameter for the UDS service AccessTimingParameter. It defines the access
type. According to the programming language, this type can be a group of defined values or an
enumeration.
Syntax
C/C++
Pascal OO
uds_svc_param_atp = (
PUDS_SVC_PARAM_ATP_TRETPS = $1,
PUDS_SVC_PARAM_ATP_STPTDV = $2,
PUDS_SVC_PARAM_ATP_RCATP = $3,
PUDS_SVC_PARAM_ATP_STPTGV = $4
);
C#
95
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_ATP_TRETPS 0x01 Read Extended Timing Parameter Set.
PUDS_SVC_PARAM_ATP_STPTDV 0x02 Set Timing Parameters to Default Values.
PUDS_SVC_PARAM_ATP_RCATP 0x03 Read Currently Active Timing Parameters.
PUDS_SVC_PARAM_ATP_STPTGV 0x04 Set Timing Parameters to Given Values.
3.5.29 uds_svc_param_rft_moop
Represents the mode of operation parameter for the UDS service RequestFileTransfer. According to the
programming language, this type can be a group of defined values or an enumeration.
Syntax
C/C++
#define PUDS_SVC_PARAM_RFT_MOOP_ADDFILE 0x1
#define PUDS_SVC_PARAM_RFT_MOOP_DELFILE 0x2
#define PUDS_SVC_PARAM_RFT_MOOP_REPLFILE 0x3
#define PUDS_SVC_PARAM_RFT_MOOP_RDFILE 0x4
#define PUDS_SVC_PARAM_RFT_MOOP_RDDIR 0x5
#define PUDS_SVC_PARAM_RFT_MOOP_RSFILE 0x6
Pascal OO
uds_svc_param_rft_moop = (
PUDS_SVC_PARAM_RFT_MOOP_ADDFILE = $1,
PUDS_SVC_PARAM_RFT_MOOP_DELFILE = $2,
PUDS_SVC_PARAM_RFT_MOOP_REPLFILE = $3,
96
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_RFT_MOOP_RDFILE = $4,
PUDS_SVC_PARAM_RFT_MOOP_RDDIR = $5,
PUDS_SVC_PARAM_RFT_MOOP_RSFILE = $6
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_RFT_MOOP_ADDFILE 0x1 Add file.
PUDS_SVC_PARAM_RFT_MOOP_DELFILE 0x2 Delete file.
PUDS_SVC_PARAM_RFT_MOOP_REPLFILE 0x3 Replace file.
PUDS_SVC_PARAM_RFT_MOOP_RDFILE 0x4 Read file.
PUDS_SVC_PARAM_RFT_MOOP_RDDIR 0x5 Read directory.
PUDS_SVC_PARAM_RFT_MOOP_RSFILE 0x6 Resume file (ISO-14229-1:2020).
97
PCAN-UDS 2.x API – User Manual
3.5.30 uds_svc_authentication_subfunction
Represents the subfunction parameter for UDS service Authentication (see ISO 14229-1:2020 §10.6.5.2
Table 74 Request message SubFunction parameter definition p.76).
Syntax
C/C++
Pascal OO
uds_svc_authentication_subfunction = (
PUDS_SVC_PARAM_AT_DA = $00,
PUDS_SVC_PARAM_AT_VCU = $01,
PUDS_SVC_PARAM_AT_VCB = $02,
PUDS_SVC_PARAM_AT_POWN = $03,
PUDS_SVC_PARAM_AT_TC = $04,
PUDS_SVC_PARAM_AT_RCFA = $05,
PUDS_SVC_PARAM_AT_VPOWNU = $06,
PUDS_SVC_PARAM_AT_VPOWNB = $07,
PUDS_SVC_PARAM_AT_AC = $08);
C#
public enum uds_svc_authentication_subfunction : Byte
{
PUDS_SVC_PARAM_AT_DA = 0x00,
PUDS_SVC_PARAM_AT_VCU = 0x01,
PUDS_SVC_PARAM_AT_VCB = 0x02,
PUDS_SVC_PARAM_AT_POWN = 0x03,
PUDS_SVC_PARAM_AT_TC = 0x04,
PUDS_SVC_PARAM_AT_RCFA = 0x05,
PUDS_SVC_PARAM_AT_VPOWNU = 0x06,
PUDS_SVC_PARAM_AT_VPOWNB = 0x07,
PUDS_SVC_PARAM_AT_AC = 0x08
}
C++ / CLR
enum struct uds_svc_authentication_subfunction : Byte
{
PUDS_SVC_PARAM_AT_DA = 0x00,
PUDS_SVC_PARAM_AT_VCU = 0x01,
PUDS_SVC_PARAM_AT_VCB = 0x02,
PUDS_SVC_PARAM_AT_POWN = 0x03,
PUDS_SVC_PARAM_AT_TC = 0x04,
PUDS_SVC_PARAM_AT_RCFA = 0x05,
PUDS_SVC_PARAM_AT_VPOWNU = 0x06,
PUDS_SVC_PARAM_AT_VPOWNB = 0x07,
PUDS_SVC_PARAM_AT_AC = 0x08
98
PCAN-UDS 2.x API – User Manual
};
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_AT_DA 0x00 DeAuthenticate subfunction.
PUDS_SVC_PARAM_AT_VCU 0x01 VerifyCertificateUnidirectional subfunction.
PUDS_SVC_PARAM_AT_VCB 0x02 VerifyCertificateBidirectional subfunction.
PUDS_SVC_PARAM_AT_POWN 0x03 ProofOfOwnership subfunction.
PUDS_SVC_PARAM_AT_TC 0x04 TransmitCertificate subfunction.
PUDS_SVC_PARAM_AT_RCFA 0x05 RequestChallengeForAuthentication subfunction.
PUDS_SVC_PARAM_AT_VPOWNU 0x06 VerifyProofOfOwnershipUnidirectional subfunction.
PUDS_SVC_PARAM_AT_VPOWNB 0x07 VerifyProofOfOwnershipBidirectional subfunction.
PUDS_SVC_PARAM_AT_AC 0x08 AuthenticationConfiguration subfunction.
3.5.31 uds_svc_authentication_return_parameter
Represents the return parameter for UDS service Authentication (see ISO 14229-1:2020 §B.5
AuthenticationReturnParameter definitions p.403).
Syntax
C/C++
typedef enum _uds_svc_authentication_return_parameter
{
PUDS_SVC_PARAM_AT_RV_RA = 0x00,
PUDS_SVC_PARAM_AT_RV_GR = 0x01,
PUDS_SVC_PARAM_AT_RV_ACAPCE = 0x02,
PUDS_SVC_PARAM_AT_RV_ACACRAC = 0x03,
PUDS_SVC_PARAM_AT_RV_ACACRSC = 0x04,
PUDS_SVC_PARAM_AT_RV_DAS = 0x10,
PUDS_SVC_PARAM_AT_RV_CVOVN = 0x11,
PUDS_SVC_PARAM_AT_RV_OVAC = 0x12,
PUDS_SVC_PARAM_AT_RV_CV = 0x13
} uds_svc_authentication_return_parameter;
Pascal OO
uds_svc_authentication_return_parameter = (
PUDS_SVC_PARAM_AT_RV_RA = $00,
PUDS_SVC_PARAM_AT_RV_GR = $01,
PUDS_SVC_PARAM_AT_RV_ACAPCE = $02,
PUDS_SVC_PARAM_AT_RV_ACACRAC = $03,
PUDS_SVC_PARAM_AT_RV_ACACRSC = $04,
PUDS_SVC_PARAM_AT_RV_DAS = $10,
99
PCAN-UDS 2.x API – User Manual
PUDS_SVC_PARAM_AT_RV_CVOVN = $11,
PUDS_SVC_PARAM_AT_RV_OVAC = $12,
PUDS_SVC_PARAM_AT_RV_CV = $13);
C#
public enum uds_svc_authentication_return_parameter : Byte
{
PUDS_SVC_PARAM_AT_RV_RA = 0x00,
PUDS_SVC_PARAM_AT_RV_GR = 0x01,
PUDS_SVC_PARAM_AT_RV_ACAPCE = 0x02,
PUDS_SVC_PARAM_AT_RV_ACACRAC = 0x03,
PUDS_SVC_PARAM_AT_RV_ACACRSC = 0x04,
PUDS_SVC_PARAM_AT_RV_DAS = 0x10,
PUDS_SVC_PARAM_AT_RV_CVOVN = 0x11,
PUDS_SVC_PARAM_AT_RV_OVAC = 0x12,
PUDS_SVC_PARAM_AT_RV_CV = 0x13
}
C++ / CLR
enum struct uds_svc_authentication_return_parameter : Byte
{
PUDS_SVC_PARAM_AT_RV_RA = 0x00,
PUDS_SVC_PARAM_AT_RV_GR = 0x01,
PUDS_SVC_PARAM_AT_RV_ACAPCE = 0x02,
PUDS_SVC_PARAM_AT_RV_ACACRAC = 0x03,
PUDS_SVC_PARAM_AT_RV_ACACRSC = 0x04,
PUDS_SVC_PARAM_AT_RV_DAS = 0x10,
PUDS_SVC_PARAM_AT_RV_CVOVN = 0x11,
PUDS_SVC_PARAM_AT_RV_OVAC = 0x12,
PUDS_SVC_PARAM_AT_RV_CV = 0x13
};
Visual Basic
Values
Name Value Description
PUDS_SVC_PARAM_AT_RV_RA 0x00 Request Accepted.
PUDS_SVC_PARAM_AT_RV_GR 0x01 General Reject.
PUDS_SVC_PARAM_AT_RV_ACAPCE 0x02 Authentication Configuration APCE.
PUDS_SVC_PARAM_AT_RV_ACACRAC 0x03 Authentication Configuration ACR with Asymmetric Cryptography.
PUDS_SVC_PARAM_AT_RV_ACACRSC 0x04 Authentication Configuration ACR with Symmetric Cryptography.
PUDS_SVC_PARAM_AT_RV_DAS 0x10 DeAuthentication Successful.
PUDS_SVC_PARAM_AT_RV_CVOVN 0x11 Certificate Verified, Ownership Verification Necessary.
PUDS_SVC_PARAM_AT_RV_OVAC 0x12 Ownership Verified, Authentication Complete.
PUDS_SVC_PARAM_AT_RV_CV 0x13 Certificate Verified.
100
PCAN-UDS 2.x API – User Manual
Aliases
Alias Description
cantp_bitrate Represents a PCAN FD bit rate string.
cantp_timestamp Defines the timestamp of a message.
Enumerations
Name Description
cantp_handle Represents a PCANTP channel or a PUDS channel.
cantp_hwtype Represents the type of PCAN hardware to be initialized.
cantp_isotp_addressing Represents the type of message addressing of a PCANTP message.
cantp_baudrate Represents a PCAN Baud rate register value for the PCANTP channel.
cantp_msg Defines a PCANTP message.
cantp_can_msgtype Represents the flags of a CAN or CAN FD message.
cantp_msgtype Represents the type of a PCANTP message.
cantp_can_info Represents common CAN information.
cantp_msgdata Represents the content of a generic PCANTP message.
cantp_msgdata_can Represents the content of a standard CAN message.
cantp_msgdata_canfd Represents the content of a CAN FD message.
cantp_msgdata_isotp Represents the content of an ISO TP message.
cantp_msgflag Represents the flags common to all types of cantp_msg.
cantp_netstatus Represents the network result of the communication of an PCANTP message.
cantp_netaddrinfo Represents the network address information of an PCANTP message.
cantp_isotp_msgtype Represents the addressing format of an PCANTP message.
cantp_isotp_format Represents the addressing format of an PCANTP message.
3.6.1 cantp_bitrate
Represents a bit rate string with flexible data rate (FD) for PCANTP or PUDS channels.
Syntax
C/C++
Pascal OO
cantp_bitrate = PAnsiChar;
C#
C++ / CLR
101
PCAN-UDS 2.x API – User Manual
Visual Basic
Remarks
.NET Framework programming languages:
An alias is used to represent a flexible data rate under Microsoft .NET to originate a homogeneity between
all programming languages listed above.
Aliases are defined in the Peak.Can.IsoTp Namespace for C# and VB .NET. However, including a namespace
does not include the defined aliases.
If it is wished to work with aliases, those must be copied to the working file, right after the inclusion of the
Peak.Can.IsoTp Namespace. Otherwise, just use the native type, which in this case is a string.
C#
using System;
using Peak.Can.IsoTp;
using cantp_bitrate = System.String; // Alias' declaration for System.String
Visual Basic
Imports System
Imports Peak.Can.IsoTp
Imports cantp_bitrate = System.String ' Alias declaration for System.String
102
PCAN-UDS 2.x API – User Manual
Remarks
These definitions are constant values in an object-oriented environment (Delphi, .NET Framework) and
declared as defines in C/C++ (plain API, see Functions on page 622).
The string must contain only one of the two possible clock frequency parameters, depending on the
unit used (Hz, or MHz).
The frequency to use must be one of the 6 listed within the clock frequency parameters.
The value for each parameter must be separated with a '='. Example: "data_brp=1"
Each pair of parameter/value must be separated with a ','. Blank spaces are allowed but are not
necessary. Example: "f_clock_mhz=24, nom_brp=1,"
Both bit rates, or only the nominal one, must be defined within the string ( PCANTP_BR_DATA_* and
PCANTP_BR_NOM_* , or only PCANTP_BR_NOM_* ).
A valid string representing 1 Mbit/sec for both, nominal and data bit rates:
A valid string representing 1 Mbit/sec for nominal bit rate, and 2 Mbit/sec for data bit rate:
See Also: UDS_InitializeFD_2013 on page 627, class method version: InitializeFD_2013 on page 148.
103
PCAN-UDS 2.x API – User Manual
3.6.2 cantp_timestamp
Represents a timestamp in PCAN-ISO-TP 3.x API and PCAN-UDS 2.x API.
Syntax
C/C++
Pascal OO
cantp_timestamp = uint64;
C#
C++ / CLR
Visual Basic
Remarks
.NET Framework programming languages:
An alias is used to represent a flexible data rate under Microsoft .NET to originate a homogeneity between
all programming languages listed above.
Aliases are defined in the Peak.Can.IsoTp Namespace for C# and VB .NET. However, including a namespace
does not include the defined aliases.
If it is wished to work with aliases, those must be copied to the working file, right after the inclusion of the
Peak.Can.IsoTp Namespace. Otherwise, just use the native type.
C#
using System;
using Peak.Can.IsoTp;
using cantp_timestamp = System.UInt64;
Visual Basic
Imports System
Imports Peak.Can.IsoTp
Imports cantp_timestamp = System.UInt64
104
PCAN-UDS 2.x API – User Manual
3.6.3 cantp_handle
Represents currently defined and supported PCANTP handle (a.k.a. channels). These identifiers are also
used to identify PUDS channels.
Syntax
C/C++
105
PCAN-UDS 2.x API – User Manual
PCANTP_HANDLE_ISABUS1 = PCAN_ISABUS1,
PCANTP_HANDLE_ISABUS2 = PCAN_ISABUS2,
PCANTP_HANDLE_ISABUS3 = PCAN_ISABUS3,
PCANTP_HANDLE_ISABUS4 = PCAN_ISABUS4,
PCANTP_HANDLE_ISABUS5 = PCAN_ISABUS5,
PCANTP_HANDLE_ISABUS6 = PCAN_ISABUS6,
PCANTP_HANDLE_ISABUS7 = PCAN_ISABUS7,
PCANTP_HANDLE_ISABUS8 = PCAN_ISABUS8,
PCANTP_HANDLE_DNGBUS1 = PCAN_DNGBUS1,
PCANTP_HANDLE_PCIBUS1 = PCAN_PCIBUS1,
PCANTP_HANDLE_PCIBUS2 = PCAN_PCIBUS2,
PCANTP_HANDLE_PCIBUS3 = PCAN_PCIBUS3,
PCANTP_HANDLE_PCIBUS4 = PCAN_PCIBUS4,
PCANTP_HANDLE_PCIBUS5 = PCAN_PCIBUS5,
PCANTP_HANDLE_PCIBUS6 = PCAN_PCIBUS6,
PCANTP_HANDLE_PCIBUS7 = PCAN_PCIBUS7,
PCANTP_HANDLE_PCIBUS8 = PCAN_PCIBUS8,
PCANTP_HANDLE_PCIBUS9 = PCAN_PCIBUS9,
PCANTP_HANDLE_PCIBUS10 = PCAN_PCIBUS10,
PCANTP_HANDLE_PCIBUS11 = PCAN_PCIBUS11,
PCANTP_HANDLE_PCIBUS12 = PCAN_PCIBUS12,
PCANTP_HANDLE_PCIBUS13 = PCAN_PCIBUS13,
PCANTP_HANDLE_PCIBUS14 = PCAN_PCIBUS14,
PCANTP_HANDLE_PCIBUS15 = PCAN_PCIBUS15,
PCANTP_HANDLE_PCIBUS16 = PCAN_PCIBUS16,
PCANTP_HANDLE_USBBUS1 = PCAN_USBBUS1,
PCANTP_HANDLE_USBBUS2 = PCAN_USBBUS2,
PCANTP_HANDLE_USBBUS3 = PCAN_USBBUS3,
PCANTP_HANDLE_USBBUS4 = PCAN_USBBUS4,
PCANTP_HANDLE_USBBUS5 = PCAN_USBBUS5,
PCANTP_HANDLE_USBBUS6 = PCAN_USBBUS6,
PCANTP_HANDLE_USBBUS7 = PCAN_USBBUS7,
PCANTP_HANDLE_USBBUS8 = PCAN_USBBUS8,
PCANTP_HANDLE_USBBUS9 = PCAN_USBBUS9,
PCANTP_HANDLE_USBBUS10 = PCAN_USBBUS10,
PCANTP_HANDLE_USBBUS11 = PCAN_USBBUS11,
PCANTP_HANDLE_USBBUS12 = PCAN_USBBUS12,
PCANTP_HANDLE_USBBUS13 = PCAN_USBBUS13,
PCANTP_HANDLE_USBBUS14 = PCAN_USBBUS14,
PCANTP_HANDLE_USBBUS15 = PCAN_USBBUS15,
PCANTP_HANDLE_USBBUS16 = PCAN_USBBUS16,
PCANTP_HANDLE_PCCBUS1 = PCAN_PCCBUS1,
PCANTP_HANDLE_PCCBUS2 = PCAN_PCCBUS2,
PCANTP_HANDLE_LANBUS1 = PCAN_LANBUS1,
PCANTP_HANDLE_LANBUS2 = PCAN_LANBUS2,
PCANTP_HANDLE_LANBUS3 = PCAN_LANBUS3,
PCANTP_HANDLE_LANBUS4 = PCAN_LANBUS4,
106
PCAN-UDS 2.x API – User Manual
PCANTP_HANDLE_LANBUS5 = PCAN_LANBUS5,
PCANTP_HANDLE_LANBUS6 = PCAN_LANBUS6,
PCANTP_HANDLE_LANBUS7 = PCAN_LANBUS7,
PCANTP_HANDLE_LANBUS8 = PCAN_LANBUS8,
PCANTP_HANDLE_LANBUS9 = PCAN_LANBUS9,
PCANTP_HANDLE_LANBUS10 = PCAN_LANBUS10,
PCANTP_HANDLE_LANBUS11 = PCAN_LANBUS11,
PCANTP_HANDLE_LANBUS12 = PCAN_LANBUS12,
PCANTP_HANDLE_LANBUS13 = PCAN_LANBUS13,
PCANTP_HANDLE_LANBUS14 = PCAN_LANBUS14,
PCANTP_HANDLE_LANBUS15 = PCAN_LANBUS15,
PCANTP_HANDLE_LANBUS16 = PCAN_LANBUS16,
} cantp_handle;
C++ / CLR
107
PCAN-UDS 2.x API – User Manual
PCANTP_HANDLE_LANBUS1 = PCANBasic::PCAN_LANBUS1,
PCANTP_HANDLE_LANBUS2 = PCANBasic::PCAN_LANBUS2,
PCANTP_HANDLE_LANBUS3 = PCANBasic::PCAN_LANBUS3,
PCANTP_HANDLE_LANBUS4 = PCANBasic::PCAN_LANBUS4,
PCANTP_HANDLE_LANBUS5 = PCANBasic::PCAN_LANBUS5,
PCANTP_HANDLE_LANBUS6 = PCANBasic::PCAN_LANBUS6,
PCANTP_HANDLE_LANBUS7 = PCANBasic::PCAN_LANBUS7,
PCANTP_HANDLE_LANBUS8 = PCANBasic::PCAN_LANBUS8,
PCANTP_HANDLE_LANBUS9 = PCANBasic::PCAN_LANBUS9,
PCANTP_HANDLE_LANBUS10 = PCANBasic::PCAN_LANBUS10,
PCANTP_HANDLE_LANBUS11 = PCANBasic::PCAN_LANBUS11,
PCANTP_HANDLE_LANBUS12 = PCANBasic::PCAN_LANBUS12,
PCANTP_HANDLE_LANBUS13 = PCANBasic::PCAN_LANBUS13,
PCANTP_HANDLE_LANBUS14 = PCANBasic::PCAN_LANBUS14,
PCANTP_HANDLE_LANBUS15 = PCANBasic::PCAN_LANBUS15,
PCANTP_HANDLE_LANBUS16 = PCANBasic::PCAN_LANBUS16,
};
C#
108
PCAN-UDS 2.x API – User Manual
PCANTP_HANDLE_USBBUS15 = PCANBasic.PCAN_USBBUS15,
PCANTP_HANDLE_USBBUS16 = PCANBasic.PCAN_USBBUS16,
PCANTP_HANDLE_PCCBUS1 = PCANBasic.PCAN_PCCBUS1,
PCANTP_HANDLE_PCCBUS2 = PCANBasic.PCAN_PCCBUS2,
PCANTP_HANDLE_LANBUS1 = PCANBasic.PCAN_LANBUS1,
PCANTP_HANDLE_LANBUS2 = PCANBasic.PCAN_LANBUS2,
PCANTP_HANDLE_LANBUS3 = PCANBasic.PCAN_LANBUS3,
PCANTP_HANDLE_LANBUS4 = PCANBasic.PCAN_LANBUS4,
PCANTP_HANDLE_LANBUS5 = PCANBasic.PCAN_LANBUS5,
PCANTP_HANDLE_LANBUS6 = PCANBasic.PCAN_LANBUS6,
PCANTP_HANDLE_LANBUS7 = PCANBasic.PCAN_LANBUS7,
PCANTP_HANDLE_LANBUS8 = PCANBasic.PCAN_LANBUS8,
PCANTP_HANDLE_LANBUS9 = PCANBasic.PCAN_LANBUS9,
PCANTP_HANDLE_LANBUS10 = PCANBasic.PCAN_LANBUS10,
PCANTP_HANDLE_LANBUS11 = PCANBasic.PCAN_LANBUS11,
PCANTP_HANDLE_LANBUS12 = PCANBasic.PCAN_LANBUS12,
PCANTP_HANDLE_LANBUS13 = PCANBasic.PCAN_LANBUS13,
PCANTP_HANDLE_LANBUS14 = PCANBasic.PCAN_LANBUS14,
PCANTP_HANDLE_LANBUS15 = PCANBasic.PCAN_LANBUS15,
PCANTP_HANDLE_LANBUS16 = PCANBasic.PCAN_LANBUS16,
}
Pascal OO
cantp_handle = (
PCANTP_HANDLE_NONEBUS = PCAN_NONEBUS,
PCANTP_HANDLE_ISABUS1 = PCAN_ISABUS1,
PCANTP_HANDLE_ISABUS2 = PCAN_ISABUS2,
PCANTP_HANDLE_ISABUS3 = PCAN_ISABUS3,
PCANTP_HANDLE_ISABUS4 = PCAN_ISABUS4,
PCANTP_HANDLE_ISABUS5 = PCAN_ISABUS5,
PCANTP_HANDLE_ISABUS6 = PCAN_ISABUS6,
PCANTP_HANDLE_ISABUS7 = PCAN_ISABUS7,
PCANTP_HANDLE_ISABUS8 = PCAN_ISABUS8,
PCANTP_HANDLE_DNGBUS1 = PCAN_DNGBUS1,
PCANTP_HANDLE_PCIBUS1 = PCAN_PCIBUS1,
PCANTP_HANDLE_PCIBUS2 = PCAN_PCIBUS2,
PCANTP_HANDLE_PCIBUS3 = PCAN_PCIBUS3,
PCANTP_HANDLE_PCIBUS4 = PCAN_PCIBUS4,
PCANTP_HANDLE_PCIBUS5 = PCAN_PCIBUS5,
PCANTP_HANDLE_PCIBUS6 = PCAN_PCIBUS6,
PCANTP_HANDLE_PCIBUS7 = PCAN_PCIBUS7,
PCANTP_HANDLE_PCIBUS8 = PCAN_PCIBUS8,
PCANTP_HANDLE_PCIBUS9 = PCAN_PCIBUS9,
PCANTP_HANDLE_PCIBUS10 = PCAN_PCIBUS10,
PCANTP_HANDLE_PCIBUS11 = PCAN_PCIBUS11,
PCANTP_HANDLE_PCIBUS12 = PCAN_PCIBUS12,
PCANTP_HANDLE_PCIBUS13 = PCAN_PCIBUS13,
PCANTP_HANDLE_PCIBUS14 = PCAN_PCIBUS14,
PCANTP_HANDLE_PCIBUS15 = PCAN_PCIBUS15,
PCANTP_HANDLE_PCIBUS16 = PCAN_PCIBUS16,
PCANTP_HANDLE_USBBUS1 = PCAN_USBBUS1,
PCANTP_HANDLE_USBBUS2 = PCAN_USBBUS2,
PCANTP_HANDLE_USBBUS3 = PCAN_USBBUS3,
PCANTP_HANDLE_USBBUS4 = PCAN_USBBUS4,
PCANTP_HANDLE_USBBUS5 = PCAN_USBBUS5,
PCANTP_HANDLE_USBBUS6 = PCAN_USBBUS6,
PCANTP_HANDLE_USBBUS7 = PCAN_USBBUS7,
PCANTP_HANDLE_USBBUS8 = PCAN_USBBUS8,
PCANTP_HANDLE_USBBUS9 = PCAN_USBBUS9,
PCANTP_HANDLE_USBBUS10 = PCAN_USBBUS10,
PCANTP_HANDLE_USBBUS11 = PCAN_USBBUS11,
109
PCAN-UDS 2.x API – User Manual
PCANTP_HANDLE_USBBUS12 = PCAN_USBBUS12,
PCANTP_HANDLE_USBBUS13 = PCAN_USBBUS13,
PCANTP_HANDLE_USBBUS14 = PCAN_USBBUS14,
PCANTP_HANDLE_USBBUS15 = PCAN_USBBUS15,
PCANTP_HANDLE_USBBUS16 = PCAN_USBBUS16,
PCANTP_HANDLE_PCCBUS1 = PCAN_PCCBUS1,
PCANTP_HANDLE_PCCBUS2 = PCAN_PCCBUS2,
PCANTP_HANDLE_LANBUS1 = PCAN_LANBUS1,
PCANTP_HANDLE_LANBUS2 = PCAN_LANBUS2,
PCANTP_HANDLE_LANBUS3 = PCAN_LANBUS3,
PCANTP_HANDLE_LANBUS4 = PCAN_LANBUS4,
PCANTP_HANDLE_LANBUS5 = PCAN_LANBUS5,
PCANTP_HANDLE_LANBUS6 = PCAN_LANBUS6,
PCANTP_HANDLE_LANBUS7 = PCAN_LANBUS7,
PCANTP_HANDLE_LANBUS8 = PCAN_LANBUS8,
PCANTP_HANDLE_LANBUS9 = PCAN_LANBUS9,
PCANTP_HANDLE_LANBUS10 = PCAN_LANBUS10,
PCANTP_HANDLE_LANBUS11 = PCAN_LANBUS11,
PCANTP_HANDLE_LANBUS12 = PCAN_LANBUS12,
PCANTP_HANDLE_LANBUS13 = PCAN_LANBUS13,
PCANTP_HANDLE_LANBUS14 = PCAN_LANBUS14,
PCANTP_HANDLE_LANBUS15 = PCAN_LANBUS15,
PCANTP_HANDLE_LANBUS16 = PCAN_LANBUS16
);
Visual Basic
110
PCAN-UDS 2.x API – User Manual
PCANTP_HANDLE_USBBUS9 = PCANBasic.PCAN_USBBUS9
PCANTP_HANDLE_USBBUS10 = PCANBasic.PCAN_USBBUS10
PCANTP_HANDLE_USBBUS11 = PCANBasic.PCAN_USBBUS11
PCANTP_HANDLE_USBBUS12 = PCANBasic.PCAN_USBBUS12
PCANTP_HANDLE_USBBUS13 = PCANBasic.PCAN_USBBUS13
PCANTP_HANDLE_USBBUS14 = PCANBasic.PCAN_USBBUS14
PCANTP_HANDLE_USBBUS15 = PCANBasic.PCAN_USBBUS15
PCANTP_HANDLE_USBBUS16 = PCANBasic.PCAN_USBBUS16
PCANTP_HANDLE_PCCBUS1 = PCANBasic.PCAN_PCCBUS1
PCANTP_HANDLE_PCCBUS2 = PCANBasic.PCAN_PCCBUS2
PCANTP_HANDLE_LANBUS1 = PCANBasic.PCAN_LANBUS1
PCANTP_HANDLE_LANBUS2 = PCANBasic.PCAN_LANBUS2
PCANTP_HANDLE_LANBUS3 = PCANBasic.PCAN_LANBUS3
PCANTP_HANDLE_LANBUS4 = PCANBasic.PCAN_LANBUS4
PCANTP_HANDLE_LANBUS5 = PCANBasic.PCAN_LANBUS5
PCANTP_HANDLE_LANBUS6 = PCANBasic.PCAN_LANBUS6
PCANTP_HANDLE_LANBUS7 = PCANBasic.PCAN_LANBUS7
PCANTP_HANDLE_LANBUS8 = PCANBasic.PCAN_LANBUS8
PCANTP_HANDLE_LANBUS9 = PCANBasic.PCAN_LANBUS9
PCANTP_HANDLE_LANBUS10 = PCANBasic.PCAN_LANBUS10
PCANTP_HANDLE_LANBUS11 = PCANBasic.PCAN_LANBUS11
PCANTP_HANDLE_LANBUS12 = PCANBasic.PCAN_LANBUS12
PCANTP_HANDLE_LANBUS13 = PCANBasic.PCAN_LANBUS13
PCANTP_HANDLE_LANBUS14 = PCANBasic.PCAN_LANBUS14
PCANTP_HANDLE_LANBUS15 = PCANBasic.PCAN_LANBUS15
PCANTP_HANDLE_LANBUS16 = PCANBasic.PCAN_LANBUS16
End Enum
Definitions
Defines the handles for the different PCAN buses (channels) within a class. The values are used as
parameters where a cantp_handle is needed.
Default/Undefined Handle:
111
PCAN-UDS 2.x API – User Manual
112
PCAN-UDS 2.x API – User Manual
Remarks
Hardware Type and Channels
Non-Plug and Play: The hardware channels of this kind are used as registered. This means, for example, it
can register the PCANTP_HANDLE_ISABUS3 without having registered PCANTP_HANDLE_ISA1 and
PCANTP_HANDLE_ISA2 . It is a decision of each user, how to associate a PCAN-channel (logical part) and a
port/interrupt pair (physical part).
Plug and Play: For hardware handles of PCI, USB, and PC-Card, the availability of the channels is
determined by the count of hardware connected to a computer at a specific moment, in conjunction with
their internal handle. This means that having four PCAN-USB connected to a computer will let the user to
connect the channels PCANTP_HANDLE_USBBUS1 to PCANTP_HANDLE_USBBUS4 . The association of each channel
with hardware is managed internally using the handle of hardware.
3.6.4 cantp_hwtype
Represents the type of PCAN (non-Plug and Play) hardware to be initialized. According to the programming
language, this type can be a group of defined values or an enumeration. This type is used in Initialize_2013
method and UDS_Initialize_2013 function.
Syntax
C/C++
113
PCAN-UDS 2.x API – User Manual
PCANTP_HWTYPE_DNG_SJA = PCAN_TYPE_DNG_SJA,
PCANTP_HWTYPE_DNG_SJA_EPP = PCAN_TYPE_DNG_SJA_EPP,
} cantp_hwtype;
Pascal OO
cantp_hwtype = (
PCANTP_HWTYPE_ISA = UInt32(PCAN_TYPE_ISA),
PCANTP_HWTYPE_ISA_SJA = UInt32(PCAN_TYPE_ISA_SJA),
PCANTP_HWTYPE_ISA_PHYTEC = UInt32(PCAN_TYPE_ISA_PHYTEC),
PCANTP_HWTYPE_DNG = UInt32(PCAN_TYPE_DNG),
PCANTP_HWTYPE_DNG_EPP = UInt32(PCAN_TYPE_DNG_EPP),
PCANTP_HWTYPE_DNG_SJA = UInt32(PCAN_TYPE_DNG_SJA),
PCANTP_HWTYPE_DNG_SJA_EPP = UInt32(PCAN_TYPE_DNG_SJA_EPP)
);
C#
public enum cantp_hwtype : UInt32
{
PCANTP_HWTYPE_ISA = TPCANType.PCAN_TYPE_ISA,
PCANTP_HWTYPE_ISA_SJA = TPCANType.PCAN_TYPE_ISA_SJA,
PCANTP_HWTYPE_ISA_PHYTEC = TPCANType.PCAN_TYPE_ISA_PHYTEC,
PCANTP_HWTYPE_DNG = TPCANType.PCAN_TYPE_DNG,
PCANTP_HWTYPE_DNG_EPP = TPCANType.PCAN_TYPE_DNG_EPP,
PCANTP_HWTYPE_DNG_SJA = TPCANType.PCAN_TYPE_DNG_SJA,
PCANTP_HWTYPE_DNG_SJA_EPP = TPCANType.PCAN_TYPE_DNG_SJA_EPP,
}
C++ / CLR
Visual Basic
Public Enum cantp_hwtype : UInt32
PCANTP_HWTYPE_ISA = TPCANType.PCAN_TYPE_ISA
PCANTP_HWTYPE_ISA_SJA = TPCANType.PCAN_TYPE_ISA_SJA
PCANTP_HWTYPE_ISA_PHYTEC = TPCANType.PCAN_TYPE_ISA_PHYTEC
PCANTP_HWTYPE_DNG = TPCANType.PCAN_TYPE_DNG
PCANTP_HWTYPE_DNG_EPP = TPCANType.PCAN_TYPE_DNG_EPP
PCANTP_HWTYPE_DNG_SJA = TPCANType.PCAN_TYPE_DNG_SJA
PCANTP_HWTYPE_DNG_SJA_EPP = TPCANType.PCAN_TYPE_DNG_SJA_EPP
End Enum
Values
Name Value Description
PCANTP_HWTYPE_ISA 1 PCAN-ISA 82C200
PCANTP_HWTYPE_ISA_SJA 9 PCAN-ISA SJA1000
PCANTP_HWTYPE_ISA_PHYTEC 4 PHYTEC ISA
PCANTP_HWTYPE_DNG 2 PCAN-Dongle 82C200
PCANTP_HWTYPE_DNG_EPP 3 PCAN-Dongle EPP 82C200
114
PCAN-UDS 2.x API – User Manual
See also: UDS_Initialize_2013 on page 625, class method: Initialize_2013 on page 142.
3.6.5 cantp_isotp_addressing
Represents the type of target of a PCANTP or PUDS message.
Syntax
C/C++
Pascal OO
cantp_isotp_addressing = (
PCANTP_ISOTP_ADDRESSING_UNKNOWN = $00,
PCANTP_ISOTP_ADDRESSING_PHYSICAL = $01,
PCANTP_ISOTP_ADDRESSING_FUNCTIONAL = $02
);
C#
C++ / CLR
Visual Basic
Values
Name Value Description
PCANTP_ISOTP_ADDRESSING_UNKNOWN 0x00 Unknown addressing format.
PCANTP_ISOTP_ADDRESSING_PHYSICAL 0x01 Physical addressing (“peer to peer”).
PCANTP_ISOTP_ADDRESSING_FUNCTIONAL 0x02 Functional addressing (“peer to any”).
115
PCAN-UDS 2.x API – User Manual
3.6.6 cantp_baudrate
Represents a PCAN Baud rate register value for PCANTP channel or PUDS channel.
Syntax
C
Pascal OO
cantp_baudrate = (
PCANTP_BAUDRATE_1M = Uint32(PCAN_BAUD_1M),
PCANTP_BAUDRATE_800K = Uint32(PCAN_BAUD_800K),
PCANTP_BAUDRATE_500K = Uint32(PCAN_BAUD_500K),
PCANTP_BAUDRATE_250K = Uint32(PCAN_BAUD_250K),
PCANTP_BAUDRATE_125K = Uint32(PCAN_BAUD_125K),
PCANTP_BAUDRATE_100K = Uint32(PCAN_BAUD_100K),
PCANTP_BAUDRATE_95K = Uint32(PCAN_BAUD_95K),
PCANTP_BAUDRATE_83K = Uint32(PCAN_BAUD_83K),
PCANTP_BAUDRATE_50K = Uint32(PCAN_BAUD_50K),
PCANTP_BAUDRATE_47K = Uint32(PCAN_BAUD_47K),
PCANTP_BAUDRATE_33K = Uint32(PCAN_BAUD_33K),
PCANTP_BAUDRATE_20K = Uint32(PCAN_BAUD_20K),
PCANTP_BAUDRATE_10K = Uint32(PCAN_BAUD_10K),
PCANTP_BAUDRATE_5K = Uint32(PCAN_BAUD_5K)
);
116
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
117
PCAN-UDS 2.x API – User Manual
Values
Name Value Description
PCANTP_BAUDRATE_1M 20 1 Mbit/s
PCANTP_BAUDRATE_800K 22 800 kBit/s
PCANTP_BAUDRATE_500K 28 500 kBit/s
PCANTP_BAUDRATE_250K 284 250 kBit/s
PCANTP_BAUDRATE_125K 796 125 kBit/s
PCANTP_BAUDRATE_100K 17199 100 kBit/s
PCANTP_BAUDRATE_95K 49998 95,238 kBit/s
PCANTP_BAUDRATE_83K 34091 83,333 kBit/s
PCANTP_BAUDRATE_50K 18223 50 kBit/s
PCANTP_BAUDRATE_47K 5140 47,619 kBit/s
PCANTP_BAUDRATE_33K 35631 33,333 kBit/s
PCANTP_BAUDRATE_20K 21295 20 kBit/s
PCANTP_BAUDRATE_10K 26415 10 kBit/s
PCANTP_BAUDRATE_5K 32639 5 kBit/s
See also: UDS_Initialize_2013 on page 625, class method: Initialize_2013 on page 142.
3.6.7 cantp_msg
A cantp_msg message is a generic CAN related message that can be either a standard CAN message, a CAN
FD message, or an ISO-TP message. The structure uds_msg includes a cantp_msg (see uds_msg on page 21).
Syntax
C/C++
Pascal OO
cantp_msg = record
typem: cantp_msgtype;
reserved: cantp_msginfo;
can_info: cantp_can_info;
case Integer of
0:
(msgdata_any: ^cantp_msgdata;);
1:
(msgdata_can: ^cantp_msgdata_can;);
2:
(msgdata_canfd: ^cantp_msgdata_canfd;);
3:
(msgdata_isotp: ^cantp_msgdata_isotp;);
end;
118
PCAN-UDS 2.x API – User Manual
C#
C++/CLR
[StructLayout(LayoutKind::Explicit)]
public value struct cantp_msg_union_msgdata
{
[FieldOffset(0)]
cantp_msgdata *any;
[FieldOffset(0)]
cantp_msgdata_can *can;
[FieldOffset(0)]
cantp_msgdata_canfd *canfd;
[FieldOffset(0)]
cantp_msgdata_isotp *isotp;
};
119
PCAN-UDS 2.x API – User Manual
public:
[MarshalAs(UnmanagedType::U4)]
cantp_msgtype type;
cantp_msginfo reserved;
cantp_can_info can_info;
cantp_msg_union_msgdata msgdata;
};
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_msg
<MarshalAs(UnmanagedType.U4)>
Public type As cantp_msgtype
Public reserved As cantp_msginfo
Public can_info As cantp_can_info
Private _msgdata As IntPtr
Public ReadOnly Property Msgdata() As IntPtr
Get
Return _msgdata
End Get
End Property
Fields
Name Description
type Type of the message (see cantp_msgtype on page 123).
reserved PCAN-ISO-TP 3.x API reserved miscellaneous read-only information.
can_info Common CAN information (see cantp_can_info on page 124).
any Shortcut to access message data as Generic content (see cantp_msgdata on page 125).
can Shortcut to access message data as CAN content (see cantp_msgdata_can on page 126).
canfd Shortcut to access message data as CAN FD content (see cantp_msgdata_canfd on page 128).
120
PCAN-UDS 2.x API – User Manual
Name Description
isotp Shortcut to access message data as ISO-TP content (see cantp_msgdata_isotp on page 129).
3.6.8 cantp_can_msgtype
Represents the flags of a CAN or CAN FD message (must be used as flags for ex. EXTENDED|FD|BRS .) (see
field cantp_msg.can_info.can_msgtype in cantp_msg on page 118).
Syntax
C/C++
Pascal OO
cantp_can_msgtype = (
PCANTP_CAN_MSGTYPE_STANDARD = UInt32(PCAN_MESSAGE_STANDARD),
PCANTP_CAN_MSGTYPE_RTR = UInt32(PCAN_MESSAGE_RTR),
PCANTP_CAN_MSGTYPE_EXTENDED = UInt32(PCAN_MESSAGE_EXTENDED),
PCANTP_CAN_MSGTYPE_FD = UInt32(PCAN_MESSAGE_FD),
PCANTP_CAN_MSGTYPE_BRS = UInt32(PCAN_MESSAGE_BRS),
PCANTP_CAN_MSGTYPE_ESI = UInt32(PCAN_MESSAGE_ESI),
PCANTP_CAN_MSGTYPE_ERRFRAME = UInt32(PCAN_MESSAGE_ERRFRAME),
PCANTP_CAN_MSGTYPE_STATUS = UInt32(PCAN_MESSAGE_STATUS),
PCANTP_CAN_MSGTYPE_SELFRECEIVE = UInt32($C0),
PCANTP_CAN_MSGTYPE_FLAG_INFO = (UInt32(PCAN_MESSAGE_ERRFRAME)
Or UInt32(PCAN_MESSAGE_STATUS))
);
C#
121
PCAN-UDS 2.x API – User Manual
PCANTP_CAN_MSGTYPE_ERRFRAME = TPCANMessageType.PCAN_MESSAGE_ERRFRAME,
PCANTP_CAN_MSGTYPE_STATUS = TPCANMessageType.PCAN_MESSAGE_STATUS,
PCANTP_CAN_MSGTYPE_SELFRECEIVE = 0xC0,
PCANTP_CAN_MSGTYPE_FLAG_INFO = (TPCANMessageType.PCAN_MESSAGE_ERRFRAME
| TPCANMessageType.PCAN_MESSAGE_STATUS)
}
C++ / CLR
Visual Basic
Values
Name Value Description
PCANTP_CAN_MSGTYPE_STANDARD 0x00 The PCAN message is a CAN Standard Frame (11-bit identifier).
PCANTP_CAN_MSGTYPE_RTR 0x01 The PCAN message is a CAN Remote-Transfer-Request Frame.
PCANTP_CAN_MSGTYPE_EXTENDED 0x02 The PCAN message is a CAN Extended Frame (29-bit identifier).
PCANTP_CAN_MSGTYPE_FD 0x04 The PCAN message represents a FD frame in terms of CiA Specs.
PCANTP_CAN_MSGTYPE_BRS 0x08 The PCAN message represents a FD bit rate switch (CAN data at a higher bit
rate).
PCANTP_CAN_MSGTYPE_ESI 0x10 The PCAN message represents a FD error state indicator (CAN FD transmitter
was error active).
PCANTP_CAN_MSGTYPE_ERRFRAME 0x40 The PCAN message represents an error frame.
PCANTP_CAN_MSGTYPE_STATUS 0x80 The PCAN message represents a PCAN status message.
PCANTP_CAN_MSGTYPE_SELFRECEIVE 0xC0 The PCAN message represents a self-received (Tx-loopback) message.
PCANTP_CAN_MSGTYPE_FLAG_INFO 0xC0 Mask filtering error frame messages and status messages.
122
PCAN-UDS 2.x API – User Manual
3.6.9 cantp_msgtype
Represents the type of a PCANTP message (see field type in cantp_msg on page 118).
Syntax
C/C++
Pascal OO
cantp_msgtype = (
PCANTP_MSGTYPE_NONE = 0,
PCANTP_MSGTYPE_CAN = 1,
PCANTP_MSGTYPE_CANFD = 2,
PCANTP_MSGTYPE_ISOTP = 4,
PCANTP_MSGTYPE_FRAME = UInt32(PCANTP_MSGTYPE_CAN) Or UInt32(PCANTP_MSGTYPE_CANFD),
PCANTP_MSGTYPE_ANY = UInt32(PCANTP_MSGTYPE_FRAME) Or UInt32(PCANTP_MSGTYPE_ISOTP)
Or UInt32($FFFFFFFF)
);
C#
[Flags]
public enum cantp_msgtype : UInt32
{
PCANTP_MSGTYPE_NONE = 0,
PCANTP_MSGTYPE_CAN = 1,
PCANTP_MSGTYPE_CANFD = 2,
PCANTP_MSGTYPE_ISOTP = 4,
PCANTP_MSGTYPE_FRAME = PCANTP_MSGTYPE_CAN | PCANTP_MSGTYPE_CANFD,
PCANTP_MSGTYPE_ANY = PCANTP_MSGTYPE_FRAME | PCANTP_MSGTYPE_ISOTP | 0xFFFFFFFF
}
C++ / CLR
Visual Basic
<Flags()>
Public Enum cantp_msgtype As UInt32
PCANTP_MSGTYPE_NONE = 0
PCANTP_MSGTYPE_CAN = 1
PCANTP_MSGTYPE_CANFD = 2
PCANTP_MSGTYPE_ISOTP = 4
123
PCAN-UDS 2.x API – User Manual
Values
Name Value Description
PCANTP_MSGTYPE_NONE 0x00000000 Uninitialized message (data is NULL).
PCANTP_MSGTYPE_CAN 0x00000001 Standard CAN message.
PCANTP_MSGTYPE_CANFD 0x00000002 CAN message with FD support.
PCANTP_MSGTYPE_ISOTP 0x00000004 PCAN-ISO-TP message (ISO:15765).
PCANTP_MSGTYPE_FRAME 0x00000003 Frame only: unsegmented messages.
PCANTP_MSGTYPE_ANY 0xFFFFFFFF Any supported message types.
3.6.10 cantp_can_info
Represents common CAN information.
Syntax
C/C++
Pascal OO
cantp_can_info = record
can_id: UInt32;
can_msgtype: cantp_can_msgtype;
dlc: Byte;
end;
C#
C++/CLR
124
PCAN-UDS 2.x API – User Manual
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_can_info
Public can_id As UInt32
<MarshalAs(UnmanagedType.U4)>
Public can_msgtype As cantp_can_msgtype
Public dlc As Byte
End Structure
Fields
Name Description
can_id CAN identifier.
can_msgtype Type and flags of the CAN/CAN FD frame (see cantp_can_msgtype on page 121).
dlc Data Length Code of the frame.
Remarks
Specifying a non-zero dlc value when writing an ISO-TP message will override the value can_tx_dlc of its
corresponding mapping (if it exists) and the value of parameter PUDS_PARAMETER_CAN_TX_DL .
3.6.11 cantp_msgdata
Represents the content of a generic PCANTP message.
Syntax
C/C++
Pascal OO
cantp_msgdata = record
flags: cantp_msgflag;
length: UInt32;
data: ^Byte;
netstatus: cantp_netstatus;
options: ^cantp_msgoption_list;
end;
C#
125
PCAN-UDS 2.x API – User Manual
C++/CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_msgdata
<MarshalAs(UnmanagedType.U4)>
Public flags As cantp_msgflag
Public length As Uint32
Public data As IntPtr
<MarshalAs(UnmanagedType.U4)>
Public netstatus As cantp_netstatus
Public options As IntPtr
End Structure
Fields
Name Description
flags Structure specific flags (see cantp_msgflag on page 131).
Length Length of the message.
Data Data of the message.
Netstatus Network status (see cantp_netstatus on page 132).
Options Defines specific options to override global message configuration (not used with UDS_Scv*).
3.6.12 cantp_msgdata_can
Represents the content of a standard CAN message.
Syntax
C/C++
126
PCAN-UDS 2.x API – User Manual
Pascal OO
cantp_msgdata_can = record
flags: cantp_msgflag;
length: UInt32;
data: ^Byte;
netstatus: cantp_netstatus;
options: ^cantp_msgoption_list;
data_max: array [0 .. PCANTP_MAX_LENGTH_CAN_STANDARD - 1] of Byte;
end;
C#
C++/CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_msgdata_can
<MarshalAs(UnmanagedType.U4)>
Public flags As cantp_msgflag
Public length As UInt32
Public data As IntPtr
<MarshalAs(UnmanagedType.U4)>
Public netstatus As cantp_netstatus
Public options As IntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=CanTpApi.PCANTP_MAX_LENGTH_CAN_STANDARD)>
Public data_max As Byte()
End Structure
127
PCAN-UDS 2.x API – User Manual
Fields
Name Description
flags Structure specific flags (see cantp_msgflag on page 131).
length Length of the message (0..8).
data Data of the message.
netstatus Network status. (see cantp_netstatus on page 132).
options Defines specific options to override global CAN configuration (not used yet).
data_max Data of the message (data[0]..data[7]).
3.6.13 cantp_msgdata_canfd
Represents the content of a CAN FD message.
Syntax
C/C++
Pascal OO
cantp_msgdata_canfd = record
flags: cantp_msgflag;
length: UInt32;
data: ^Byte;
netstatus: cantp_netstatus;
options: ^cantp_msgoption_list;
data_max: array [0 .. PCANTP_MAX_LENGTH_CAN_FD - 1] of Byte;
end;
C#
128
PCAN-UDS 2.x API – User Manual
C++/CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_msgdata_canfd
<MarshalAs(UnmanagedType.U4)>
Public flags As cantp_msgflag
Public length As UInt32
Public data As IntPtr
<MarshalAs(UnmanagedType.U4)>
Public netstatus As cantp_netstatus
Public options As IntPtr
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=CanTpApi.PCANTP_MAX_LENGTH_CAN_FD)>
Public data_max As Byte()
End Structure
Fields
Name Description
flags Structure specific flags (see cantp_msgflag on page 131).
length Length of the message (0..64).
data Data of the message.
netstatus Network status (see cantp_netstatus on page 132).
options Defines specific options to override global CAN configuration (not used yet).
data_max Data of the message (data[0]..data[63]).
3.6.14 cantp_msgdata_isotp
Represents the content of an ISO-TP message.
Syntax
C/C++
129
PCAN-UDS 2.x API – User Manual
Pascal OO
cantp_msgdata_isotp = record
flags: cantp_msgflag;
length: UInt32;
data: ^Byte;
netstatus: cantp_netstatus;
options: ^cantp_msgoption_list;
netaddrinfo: cantp_netaddrinfo;
reserved: cantp_isotp_info;
end;
C#
C++/CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_msgdata_isotp
<MarshalAs(UnmanagedType.U4)>
Public flags As cantp_msgflag
Public length As UInt32
Public data As IntPtr
<MarshalAs(UnmanagedType.U4)>
Public netstatus As cantp_netstatus
Public options As IntPtr
Public netaddrinfo As cantp_netaddrinfo
Public reserved As cantp_isotp_info
End Structure
130
PCAN-UDS 2.x API – User Manual
Fields
Name Description
flags Structure specific flags (see cantp_msgflag on page 131).
length Length of the data.
data Data of the message.
netstatus Network status (see cantp_netstatus on page 132).
options Defines specific options to override global CAN configuration (not used in UDS_Scv* functions).
netaddrinfo PCAN-ISO-TP 3.x network address information (see cantp_netaddrinfo on page 134).
reserved Reserved PCAN-ISO-TP 3.x information.
3.6.15 cantp_msgflag
Represents the flags common to all types of cantp_msg (see field cantp_msg.msgdata.flags on page 118).
Syntax
C/C++
Pascal OO
cantp_msgflag = (
PCANTP_MSGFLAG_NONE = 0,
PCANTP_MSGFLAG_LOOPBACK = 1,
PCANTP_MSGFLAG_ISOTP_FRAME = 2
);
C#
C++ / CLR
131
PCAN-UDS 2.x API – User Manual
Visual Basic
Values
Name Value Description
PCANTP_MSGFLAG_NONE 0 No flag.
PCANTP_MSGFLAG_LOOPBACK 1 Message is the confirmation of a transmitted message.
PCANTP_MSGFLAG_ISOTP_FRAME 2 Message is a frame of a segmented ISO-TP message.
3.6.16 cantp_netstatus
Represents the network result of the communication of a PCANTP message.
Syntax
C/C++
Pascal OO
cantp_netstatus = (
PCANTP_NETSTATUS_OK = $00,
PCANTP_NETSTATUS_TIMEOUT_A = $01,
PCANTP_NETSTATUS_TIMEOUT_Bs = $02,
PCANTP_NETSTATUS_TIMEOUT_Cr = $03,
PCANTP_NETSTATUS_WRONG_SN = $04,
PCANTP_NETSTATUS_INVALID_FS = $05,
PCANTP_NETSTATUS_UNEXP_PDU = $06,
PCANTP_NETSTATUS_WFT_OVRN = $07,
PCANTP_NETSTATUS_BUFFER_OVFLW = $08,
PCANTP_NETSTATUS_ERROR = $09,
PCANTP_NETSTATUS_IGNORED = $0A,
PCANTP_NETSTATUS_TIMEOUT_As = $10,
PCANTP_NETSTATUS_TIMEOUT_Ar = $11,
PCANTP_NETSTATUS_XMT_FULL = $11,
132
PCAN-UDS 2.x API – User Manual
PCANTP_NETSTATUS_BUS_ERROR = $12,
PCANTP_NETSTATUS_NO_MEMORY = $13
);
C#
public enum cantp_netstatus : UInt32
{
PCANTP_NETSTATUS_OK = 0x00,
PCANTP_NETSTATUS_TIMEOUT_A = 0x01,
PCANTP_NETSTATUS_TIMEOUT_Bs = 0x02,
PCANTP_NETSTATUS_TIMEOUT_Cr = 0x03,
PCANTP_NETSTATUS_WRONG_SN = 0x04,
PCANTP_NETSTATUS_INVALID_FS = 0x05,
PCANTP_NETSTATUS_UNEXP_PDU = 0x06,
PCANTP_NETSTATUS_WFT_OVRN = 0x07,
PCANTP_NETSTATUS_BUFFER_OVFLW = 0x08,
PCANTP_NETSTATUS_ERROR = 0x09,
PCANTP_NETSTATUS_IGNORED = 0x0A,
PCANTP_NETSTATUS_TIMEOUT_As = 0x10,
PCANTP_NETSTATUS_TIMEOUT_Ar = 0x11,
PCANTP_NETSTATUS_XMT_FULL = 0x11,
PCANTP_NETSTATUS_BUS_ERROR = 0x12,
PCANTP_NETSTATUS_NO_MEMORY = 0x13,
}
C++ / CLR
public enum cantp_netstatus : UInt32
{
PCANTP_NETSTATUS_OK = 0x00,
PCANTP_NETSTATUS_TIMEOUT_A = 0x01,
PCANTP_NETSTATUS_TIMEOUT_Bs = 0x02,
PCANTP_NETSTATUS_TIMEOUT_Cr = 0x03,
PCANTP_NETSTATUS_WRONG_SN = 0x04,
PCANTP_NETSTATUS_INVALID_FS = 0x05,
PCANTP_NETSTATUS_UNEXP_PDU = 0x06,
PCANTP_NETSTATUS_WFT_OVRN = 0x07,
PCANTP_NETSTATUS_BUFFER_OVFLW = 0x08,
PCANTP_NETSTATUS_ERROR = 0x09,
PCANTP_NETSTATUS_IGNORED = 0x0A,
PCANTP_NETSTATUS_TIMEOUT_As = 0x10,
PCANTP_NETSTATUS_TIMEOUT_Ar = 0x11,
PCANTP_NETSTATUS_XMT_FULL = 0x11,
PCANTP_NETSTATUS_BUS_ERROR = 0x12,
PCANTP_NETSTATUS_NO_MEMORY = 0x13,
};
Visual Basic
Public Enum cantp_netstatus As UInt32
PCANTP_NETSTATUS_OK = &H0
PCANTP_NETSTATUS_TIMEOUT_A = &H1
PCANTP_NETSTATUS_TIMEOUT_Bs = &H2
PCANTP_NETSTATUS_TIMEOUT_Cr = &H3
PCANTP_NETSTATUS_WRONG_SN = &H4
PCANTP_NETSTATUS_INVALID_FS = &H5
PCANTP_NETSTATUS_UNEXP_PDU = &H6
PCANTP_NETSTATUS_WFT_OVRN = &H7
PCANTP_NETSTATUS_BUFFER_OVFLW = &H8
PCANTP_NETSTATUS_ERROR = &H9
PCANTP_NETSTATUS_IGNORED = &HA
PCANTP_NETSTATUS_TIMEOUT_As = &H10
PCANTP_NETSTATUS_TIMEOUT_Ar = &H11
133
PCAN-UDS 2.x API – User Manual
PCANTP_NETSTATUS_XMT_FULL = &H11
PCANTP_NETSTATUS_BUS_ERROR = &H12
PCANTP_NETSTATUS_NO_MEMORY = &H13
End Enum
Values
Name Value Description
PCANTP_NETSTATUS_OK 0x00 No network errors.
PCANTP_NETSTATUS_TIMEOUT_A 0x01 Timeout occurred between 2 frames transmission (sender and receiver side).
PCANTP_NETSTATUS_TIMEOUT_Bs 0x02 Sender side timeout while waiting for flow control frame.
PCANTP_NETSTATUS_TIMEOUT_Cr 0x03 Receiver side timeout while waiting for consecutive frame.
PCANTP_NETSTATUS_WRONG_SN 0x04 Unexpected sequence number.
PCANTP_NETSTATUS_INVALID_FS 0x05 Invalid or unknown FlowStatus.
PCANTP_NETSTATUS_UNEXP_PDU 0x06 Unexpected protocol data unit.
PCANTP_NETSTATUS_WFT_OVRN 0x07 Reception of flow control WAIT frame that exceeds the maximum counter defined
by PCANTP_PARAMETER_WFT_MAX.
PCANTP_NETSTATUS_BUFFER_OVFLW 0x08 Buffer on the receiver side cannot store the data length (server side only).
PCANTP_NETSTATUS_ERROR 0x09 General error.
PCANTP_NETSTATUS_IGNORED 0x0A Message was invalid and ignored.
PCANTP_NETSTATUS_TIMEOUT_As 0x10 Sender side timeout while transmitting.
PCANTP_NETSTATUS_TIMEOUT_Ar 0x11 Receiver side timeout while transmitting.
PCANTP_NETSTATUS_XMT_FULL 0x11 Transmit queue is full (failed too many times; NON PCANTP related network
results).
PCANTP_NETSTATUS_BUS_ERROR 0x12 CAN bus error (NON PCANTP related network results).
PCANTP_NETSTATUS_NO_MEMORY 0x13 Memory allocation error (NON PCANTP related network results).
3.6.17 cantp_netaddrinfo
Represents the network address information of a PCANTP message.
Syntax
C/C++
Pascal OO
cantp_netaddrinfo = record
msgtype: cantp_isotp_msgtype;
format: cantp_isotp_format;
target_type: cantp_isotp_addressing;
source_addr: UInt16;
target_addr: UInt16;
extension_addr: Byte;
end;
134
PCAN-UDS 2.x API – User Manual
C#
C++/CLR
Visual Basic
<StructLayout(LayoutKind.Sequential, Pack:=8)>
Public Structure cantp_netaddrinfo
<MarshalAs(UnmanagedType.U4)>
Public msgtype As cantp_isotp_msgtype
<MarshalAs(UnmanagedType.U4)>
Public format As cantp_isotp_format
<MarshalAs(UnmanagedType.U4)>
Public target_type As cantp_isotp_addressing
Public source_addr As UInt16
Public target_addr As UInt16
Public extension_addr As Byte
End Structure
Fields
Name Description
msgtype PCANTP message type (see cantp_isotp_msgtype on page 136).
format PCANTP format addressing (see cantp_isotp_format on page 137).
target_type PCANTP addressing/target type (see cantp_isotp_addressing on page 115).
source_addr Source address.
target_addr Target address.
extension_addr Extension address.
135
PCAN-UDS 2.x API – User Manual
3.6.18 cantp_isotp_msgtype
Represents the addressing format of a PCANTP message (see field cantp_msg.msgdata.isotp.netaddrinfo.msgtype
on page 118).
Syntax
C/C++
Pascal OO
cantp_isotp_msgtype = (
PCANTP_ISOTP_MSGTYPE_UNKNOWN = $00,
PCANTP_ISOTP_MSGTYPE_DIAGNOSTIC = $01,
PCANTP_ISOTP_MSGTYPE_REMOTE_DIAGNOSTIC = $02,
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION_RX = $10,
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION_TX = $20,
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION = ($10 Or $20),
PCANTP_ISOTP_MSGTYPE_MASK_INDICATION = $0F
);
C#
C++ / CLR
Visual Basic
136
PCAN-UDS 2.x API – User Manual
PCANTP_ISOTP_MSGTYPE_REMOTE_DIAGNOSTIC = &H2
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION_RX = &H10
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION_TX = &H20
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION = (&H10 Or &H20)
PCANTP_ISOTP_MSGTYPE_MASK_INDICATION = &HF
End Enum
Values
Name Value Description
PCANTP_ISOTP_MSGTYPE_UNKNOWN 0x00 Unknown (non-PCAN-ISO-TP) message.
PCANTP_ISOTP_MSGTYPE_DIAGNOSTIC 0x01 Diagnostic message (request or confirmation).
PCANTP_ISOTP_MSGTYPE_REMOTE_DIAGNOSTIC 0x02 Remote Diagnostic message (request or confirmation).
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION_RX 0x10 Multi-Frame message is being received.
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION_TX 0x20 Multi-Frame message is being transmitted.
PCANTP_ISOTP_MSGTYPE_FLAG_INDICATION 0x30 Multi-Frame message is being communicated (Tx or Rx).
PCANTP_ISOTP_MSGTYPE_MASK_INDICATION 0x0F Mask to remove Indication flags.
See also: cantp_msg on page 118, cantp_msgdata on page 125, cantp_msgdata_isotp on page 129, cantp_netaddrinfo
on page 134.
3.6.19 cantp_isotp_format
Represents the addressing format of a PCANTP message (see field cantp_msg.msgdata.isotp.netaddrinfo .format
on page 118).
Syntax
C/C++
Pascal OO
cantp_isotp_format = (
PCANTP_ISOTP_FORMAT_UNKNOWN = $FF,
PCANTP_ISOTP_FORMAT_NONE = $00,
PCANTP_ISOTP_FORMAT_NORMAL = $01,
PCANTP_ISOTP_FORMAT_FIXED_NORMAL = $02,
PCANTP_ISOTP_FORMAT_EXTENDED = $03,
PCANTP_ISOTP_FORMAT_MIXED = $04,
PCANTP_ISOTP_FORMAT_ENHANCED = $05
);
C#
137
PCAN-UDS 2.x API – User Manual
PCANTP_ISOTP_FORMAT_EXTENDED = 0x03,
PCANTP_ISOTP_FORMAT_MIXED = 0x04,
PCANTP_ISOTP_FORMAT_ENHANCED = 0x05,
}
C++ / CLR
public enum cantp_isotp_format : UInt32
{
PCANTP_ISOTP_FORMAT_UNKNOWN = 0xFF,
PCANTP_ISOTP_FORMAT_NONE = 0x00,
PCANTP_ISOTP_FORMAT_NORMAL = 0x01,
PCANTP_ISOTP_FORMAT_FIXED_NORMAL = 0x02,
PCANTP_ISOTP_FORMAT_EXTENDED = 0x03,
PCANTP_ISOTP_FORMAT_MIXED = 0x04,
PCANTP_ISOTP_FORMAT_ENHANCED = 0x05,
};
Visual Basic
Public Enum cantp_isotp_format As UInt32
PCANTP_ISOTP_FORMAT_UNKNOWN = &HFF
PCANTP_ISOTP_FORMAT_NONE = &H0
PCANTP_ISOTP_FORMAT_NORMAL = &H1
PCANTP_ISOTP_FORMAT_FIXED_NORMAL = &H2
PCANTP_ISOTP_FORMAT_EXTENDED = &H3
PCANTP_ISOTP_FORMAT_MIXED = &H4
PCANTP_ISOTP_FORMAT_ENHANCED = &H5
End Enum
Values
Name Value Description
PCANTP_ISOTP_FORMAT_UNKNOWN 0xFF Unknown addressing format.
PCANTP_ISOTP_FORMAT_NONE 0x00 Unsegmented CAN frame.
PCANTP_ISOTP_FORMAT_NORMAL 0x01 Normal addressing format from ISO 15765-2.
PCANTP_ISOTP_FORMAT_FIXED_NORMAL 0x02 Fixed normal addressing format from ISO 15765-2.
PCANTP_ISOTP_FORMAT_EXTENDED 0x03 Extended addressing format from ISO 15765-2.
PCANTP_ISOTP_FORMAT_MIXED 0x04 Mixed addressing format from ISO 15765-2.
PCANTP_ISOTP_FORMAT_ENHANCED 0x05 Enhanced addressing format from ISO 15765-3.
See also: cantp_msg on page 118, cantp_msgdata_isotp on page 129, cantp_netaddrinfo on page 134.
138
PCAN-UDS 2.x API – User Manual
3.7 Methods
The methods defined for the classes UDSApi and TUDSApi are divided into 6 groups of functionality. Note
that these methods are static and can be called in the name of the class, without instantiation.
Connection
Method Description
Initialize_2013 Initializes a PUDS channel based on a PCANTP handle (without CAN FD support).
InitializeFD_2013 Initializes a PUDS channel based on a PCANTP handle (including CAN FD support).
Uninitialize_2013 Uninitializes a PUDS channel.
Configuration
Method Description
SetValue_2013 Sets a configuration or information value within a PUDS channel.
AddMapping_2013 Adds a mapping between a CAN identifier and a network address information.
RemoveMappingByCanId_2013 Removes all user defined PUDS mappings corresponding to a CAN identifier.
RemoveMapping_2013 Removes a user defined PUDS mapping.
AddCanIdFilter_2013 Adds an entry to the CAN identifier white-list filtering.
RemoveCanIdFilter_2013 Removes an entry from the CAN identifier white-list filtering.
Information
Method Description
GetValue_2013 Retrieves information from a PUDS channel.
GetCanBusStatus_2013 Gets information about the internal BUS status of a PUDS channel.
GetMapping_2013 Retrieves a mapping matching the given CAN identifier and message type (11bits, 29
bits, FD, etc.).
GetMappings_2013 Retrieves all the mappings defined for a PUDS channel.
GetSessionInformation_2013 Gets current ECU session information.
StatusIsOk_2013 Checks if a PUDS status matches an expected result (default is PUDS_STATUS_OK).
GetErrorText_2013 Gets a descriptive text for an error code.
Message handling
Method Description
MsgAlloc_2013 Allocates a PUDS message based using the given configuration.
MsgFree_2013 Deallocates a PUDS message.
MsgCopy_2013 Copies a PUDS message to another buffer.
MsgMove_2013 Moves a PUDS message to another buffer (and cleans the original message structure).
Communication
Method Description
Read_2013 Reads a CAN message from the receive queue of a PUDS channel.
139
PCAN-UDS 2.x API – User Manual
Method Description
WaitForFunctionalResponses_2013 Waits for multiple messages (multiple responses from a functional
request for instance) based on a PUDS message request.
WaitForService_2013 Handles the communication workflow for a UDS service expecting a
single response.
WaitForServiceFunctional_2013 Handles the communication workflow for a UDS service expecting
multiple responses.
SvcDiagnosticSessionControl_2013 Writes to the transmit queue a request for UDS service
DiagnosticSessionControl.
SvcECUReset_2013 Writes to the transmit queue a request for UDS service ECUReset.
SvcSecurityAccess_2013 Writes to the transmit queue a request for UDS service SecurityAccess.
140
PCAN-UDS 2.x API – User Manual
Method Description
SvcReadDTCInformationRDTCSSBDTC_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRDTCSSBRN_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationReportExtended_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationReportSeverity_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRSIODTC_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationNoParam_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRDTCEDBR_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRUDMDTCBSM_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRUDMDTCSSBDTC_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRUDMDTCEDRBDN_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRDTCEDI_2020 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRWWHOBDDTCBMR_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRWWHOBDDTCWPS_2013 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcReadDTCInformationRDTCBRGI_2020 Writes to the transmit queue a request for UDS service
ReadDTCInformation.
SvcInputOutputControlByIdentifier_2013 Writes to the transmit queue a request for UDS service
InputOutputControlByIdentifier.
SvcRoutineControl_2013 Writes to the transmit queue a request for UDS service RoutineControl.
SvcTransferData_2013 Writes to the transmit queue a request for UDS service TransferData.
141
PCAN-UDS 2.x API – User Manual
Method Description
SvcAuthenticationVPOWNU_2020 Writes to the transmit queue a request for UDS service Authentication
with verifyProofOfOwnershipUnidirectional subfunction (ISO-14229-
1:2020).
SvcAuthenticationVPOWNB_2020 Writes to the transmit queue a request for UDS service Authentication
with verifyProofOfOwnershipBidirectional subfunction (ISO-14229-
1:2020).
SvcAuthenticationAC_2020 Writes to the transmit queue a request for UDS service Authentication
with authenticationConfiguration subfunction (ISO-14229-1:2020).
Method Description
GetDataServiceId_2013 Gets PUDS message data service identifier in a safe way.
SetDataServiceId_2013 Sets PUDS message data service id in a safe way.
GetDataNrc_2013 Gets PUDS message data negative response code (nrc) in a safe way.
SetDataNrc_2013 Sets PUDS message data negative response code (nrc) in a safe way.
GetDataParameter_2013 Gets PUDS message data parameter in a safe way.
SetDataParameter_2013 Sets PUDS message data parameter in a safe way.
3.7.1 Initialize_2013
Initializes a PUDS channel based on a PCANTP handle (without CAN FD support).
Overloads
Method Description
Initialize_2013(cantp_handle, cantp_baudrate) Initializes a Plug-And-Play PUDS channel based on a PCANTP handle
(without CAN FD support).
Initialize_2013(cantp_handle, cantp_baudrate, Initializes a Non-Plug-And-Play PUDS channel based on a PCANTP
cantp_hwtype, UInt32, UInt16) handle (without CAN FD support).
Syntax
Pascal OO
C#
C++ / CLR
142
PCAN-UDS 2.x API – User Manual
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
baudrate The speed for the communication (see cantp_baudrate on page 116).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
As indicated by its name, the Initialize_2013 method initiates a PUDS channel, preparing it for communication
within the CAN bus connected to it. Calls to the other methods will fail if they are used with a channel
handle, different than PCANTP_HANDLE_NONEBUS , that has not been initialized yet. Each initialized channel
should be released when it is not needed anymore.
To configure default standard ISO-TP mappings (see UDS and ISO-TP Network Addressing Information
on page 771):
• Functional request using 11 bits CAN identifier and normal addressing, from External Test
Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) to OBD functional address
( PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL )
• Physical requests and responses using 11 bits CAN identifier and normal addressing, between the
External Test Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) and standard ECU
addresses (ECU #1 to #8)
To configure PCAN-ISO-TP 3.x to filter CAN frames to increase performance (frames that do not match
a mapping or a CAN ID in the white-list filter are ignored and discarded).
The initialization process will fail if an application tries to initialize a PUDS channel that has already been
initialized within the same process.
Take into consideration that initializing a channel causes a reset of the CAN hardware. In this way errors
like BUSOFF, BUSHEAVY, and BUSLIGHT, are removed.
143
PCAN-UDS 2.x API – User Manual
Example
The following example shows the initialize and uninitialized processes for a Plug-And-Play channel
(channel 2 of a PCAN-PCI hardware).
C#
uds_status result;
144
PCAN-UDS 2.x API – User Manual
end;
See also: Uninitialize_2013 on page 148, InitializeFD_2013 on page 148, Using PCAN-UDS 2.x on page 11.
Plain function version: UDS_Initialize_2013 on page 625.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_Initialize_2013")>
Public Shared Function Initialize_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal baudrate As cantp_baudrate,
145
PCAN-UDS 2.x API – User Manual
<MarshalAs(UnmanagedType.U4)>
ByVal hw_type As cantp_hwtype,
ByVal io_port As UInt32,
ByVal interrupt As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
baudrate The speed for the communication (see cantp_baudrate on page 116).
hw_type Non-plug and play: The type of hardware (see cantp_hwtype on page 113).
io_port Non-plug and play: The I/O address for the parallel port.
interrupt Non-plug and play: Interrupt number of the parallel port.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case
of failure are:
Remarks
As indicated by its name, the Initialize_2013 method initiates a PUDS channel, preparing it for communication
within the CAN bus connected to it. Calls to the other methods will fail if they are used with a channel
handle, different than PCANTP_HANDLE_NONEBUS , that has not been initialized yet. Each initialized channel
should be released when it is not needed anymore.
• Functional request using 11 bits CAN identifier and normal addressing, from External Test
Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) to OBD functional address
( PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL ),
• Physical requests and responses using 11 bits CAN identifier and normal addressing, between the
External Test Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) and standard ECU
addresses (ECU #1 to #8)
To configure PCAN-ISO-TP 3.x to filter CAN frames to increase performance (frames that do not match
a mapping or a CAN ID in the white-list filter are ignored and discarded).
The initialization process will fail if an application tries to initialize a PUDS channel that has already been
initialized within the same process.
Take into consideration that initializing a channel causes a reset of the CAN hardware. In this way errors
like BUSOFF, BUSHEAVY, and BUSLIGHT, are removed.
146
PCAN-UDS 2.x API – User Manual
Example
The following example shows the initialize and uninitialized processes for a Non-Plug-And-Play channel
(channel 1 of the PCAN-DNG).
C#
uds_status result;
C++/CLR
uds_status result;
Visual Basic
Dim result As uds_status
Pascal OO
var
result: uds_status;
begin
147
PCAN-UDS 2.x API – User Manual
end
else
begin
MessageBox(0, 'PCAN-PCI (Ch-2) was initialized', 'Success', MB_OK);
end;
See also: Uninitialize_2013 on page 148, InitializeFD_2013 on page 148, Using PCAN-UDS 2.x on page 11.
Plain function version: UDS_Initialize_2013 on page 625.
3.7.4 InitializeFD_2013
Initializes a PUDS channel based on a PCANTP handle (including CAN FD support).
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_InitializeFD_2013")>
Public Shared Function InitializeFD_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal bitrate_fd As cantp_bitrate) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a FD capable PUDS channel (see cantp_handle on page 105).
bitrate_fd The speed for the communication (see cantp_bitrate on page 101, FD Bit Rate Parameter Definitions on
page 102).
148
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
The InitializeFD_2013 method initiates a FD capable PUDS channel, preparing it for communicate within the
CAN bus connected to it. Calls to the other methods will fail, if they are used with a channel handle, different
than PCANTP_HANDLE_NONEBUS , that has not been initialized yet. Each initialized channel should be released
when it is not needed anymore.
To configure default standard ISO-TP mappings (see UDS and ISO-TP Network Addressing Information
on page 771):
• Functional request using 11 bits CAN identifier and normal addressing, from External Test
Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) to OBD functional address
( PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL ),
• Physical requests and responses using 11 bits CAN identifier and normal addressing, between the
External Test Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) and standard ECU
addresses (ECU #1 to #8)
To configure PCAN-ISO-TP 3.x to filter CAN frames to increase performance (frames that do not match
a mapping or a CAN ID in the white-list filter are ignored and discarded).
The initialization process will fail if an application tries to initialize a PUDS channel that has already been
initialized within the same process.
Take into consideration, that initializing a channel causes a reset of the CAN hardware. In this way errors
like BUSOFF, BUSHEAVY, and BUSLIGHT, are removed.
Example
The following example shows the initialize and uninitialized processes for a Plug and Play, FD capable
channel (channel 2 of a PCAN-USB hardware).
C#
uds_status result;
if (!UDSApi.StatusIsOk_2013(result))
149
PCAN-UDS 2.x API – User Manual
C++ / CLR
uds_status result;
Visual Basic
Pascal OO
var
result: uds_status;
begin
150
PCAN-UDS 2.x API – User Manual
See also: Uninitialize_2013 on page 148, Using PCAN-UDS 2.x on page 12, cantp_bitrate on page 101, FD Bit Rate
Parameter Definitions on page 102.
Plain function version: UDS_InitializeFD_2013 on page 627.
3.7.5 Uninitialize_2013
Uninitializes a PUDS channel.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_Uninitialize_2013")>
Public Shared Function Uninitialize_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel cannot be uninitialized because it was not found in
the list of reserved channels of the calling application.
Remarks
A PUDS channel can be released using one of these possibilities:
Single-Release: Given a handle of a PUDS channel initialized before with the method Initialize_2013 . If the
given channel cannot be found, then an error is returned.
Multiple-Release: Giving the handle value PCANTP_HANDLE_NONEBUS which instructs the API to search
for all channels initialized by the calling application and release them all. This option causes no errors
if no hardware were uninitialized.
151
PCAN-UDS 2.x API – User Manual
Example
The following example shows the initialize and uninitialized processes for a Plug-And-Play channel
(channel 2 of a PCAN-PCI hardware).
C#
uds_status result;
// Release channel
result = UDSApi.Uninitialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Uninitialization failed", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-2) was released", "Success");
C++/CLR
uds_status result;
// Release channel
result = UDSApi::Uninitialize_2013(PCANTP_HANDLE_PCIBUS2);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Uninitialization failed", "Error");
else
MessageBox::Show("PCAN-PCI (Ch-2) was released", "Success");
Visual Basic
152
PCAN-UDS 2.x API – User Manual
Else
MessageBox.Show("PCAN-PCI (Ch-2) was released", "Success")
End If
Pascal OO
var
result: uds_status;
begin
// Release channel
result := TUDSApi.Uninitialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Uninitialization failed', 'Error', MB_OK);
end
else
begin
MessageBox(0, 'PCAN-PCI (Ch-2) was released', 'Success', MB_OK);
end;
end;
3.7.6 SetValue_2013
Sets a configuration or information value within a PUDS channel.
Overloads
Method Description
SetValue_2013(cantp_handle, uds_parameter, UInt32, Sets a configuration or information numeric value within a
Uint32) PUDS channel.
SetValue_2013(cantp_handle, uds_parameter, String, Sets a configuration or information string value within a
UInt32) PUDS channel.
SetValue_2013(cantp_handle, uds_parameter, Byte[], Sets a configuration or information with an array of bytes
Uint32) within a PUDS channel.
SetValue_2013(cantp_handle, uds_parameter, IntPtr, UInt32) Sets a configuration or information within a PUDS channel.
153
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SetValue_2013")>
Public Shared Function SetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
ByRef buffer As UInt32,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The buffer containing the numeric value to be set.
buffer_size The length in bytes of the given buffer.
154
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Remarks
Use the method SetValue_2013 to set configuration information or environment values of a PUDS channel.
Note: That any calls with non PCAN-UDS 2.x API parameters (i.e. uds_parameter ) will be forwarded to
PCAN-ISO-TP 3.x API or PCAN-Basic API.
More information about the parameters and values that can be set can be found in Detailed Parameters
Characteristics on page 45.
Since most of the PCAN-UDS 2.x API parameters require a numeric value (byte or integer) this is the most
common and useful override.
Example
The following example shows the use of the method SetValue_2013 on the channel PCANTP_HANDLE_PCIBUS2 to
enable debug mode.
C#
uds_status result;
UInt32 buffer;
C++/CLR
uds_status result;
UInt32 buffer;
155
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
buffer: UInt32;
begin
See also: uds_parameter on page 41, Detailed Parameters Characteristics on page 45, GetValue_2013 on page
178.
Plain function version: UDS_SetValue_2013 on page 630.
Syntax
Pascal OO
C#
156
PCAN-UDS 2.x API – User Manual
cantp_handle channel,
[MarshalAs(UnmanagedType.U4)]
uds_parameter parameter,
[MarshalAs(UnmanagedType.LPStr, SizeParamIndex =3)]
String buffer,
UInt32 buffer_size);
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SetValue_2013")>
Public Shared Function SetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
<MarshalAs(UnmanagedType.LPStr, SizeParamIndex:=3)>
ByVal buffer As String,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The buffer containing the string value to be set.
buffer_size The length in bytes of the given buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Remarks
This override is only defined for users who wishes to configure PCAN-Basic API through the PCAN-UDS
2.x API.
See also: GetValue_2013 on page 178, uds_parameter on page 41, Detailed Parameters Characteristics on page
45.
Plain function version: UDS_SetValue_2013 on page 630.
157
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SetValue_2013")>
Public Shared Function SetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=3)>
ByVal buffer As Byte(),
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The buffer containing the array value to be set.
buffer_size The length in bytes of the given buffer.
158
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Remarks
Use the method SetValue_2013 to set configuration information or environment values of a PUDS channel.
Note: That any calls with non PCAN-UDS 2.x API parameters (i.e. uds_parameter ) will be forwarded to
PCAN-ISO-TP 3.x API or PCAN-Basic API.
More information about the parameters and values that can be set can be found in Detailed Parameters
Characteristics on page 45.
Example
The following example shows the use of the method SetValue_2013 on the channel PCANTP_HANDLE_USBBUS1
to set an unlimited block size.
C#
uds_status result;
C++/CLR
uds_status result;
Visual Basic
159
PCAN-UDS 2.x API – User Manual
End If
Pascal OO
var
result: uds_status;
buffer_array: array [0 .. 0] of Byte;
begin
See also: uds_parameter on page 41, Detailed Parameters Characteristics on page 45, GetValue_2013 on page
178.
Plain function version: UDS_SetValue_2013 on page 630.
Syntax
Pascal OO
C#
C++ / CLR
160
PCAN-UDS 2.x API – User Manual
uds_parameter parameter,
IntPtr buffer,
UInt32 buffer_size);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SetValue_2013")>
Public Shared Function SetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
ByVal buffer As IntPtr,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer Pointer on the value to be set.
buffer_size The length in bytes of the given buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Remarks
Use the method SetValue_2013 to set configuration information or environment values of a PUDS channel.
Note: That any calls with non PCAN-UDS 2.x API parameters (i.e. uds_parameter ) will be forwarded to
PCAN-ISO-TP 3.x API or PCAN-Basic API.
More information about the parameters and values that can be set can be found in Detailed Parameters
Characteristics on page 45.
Example
The following example shows the use of the method SetValue_2013 on the channel PCANTP_HANDLE_USBBUS1
to change the current UDS Session Information.
Note: This only affects the API client side ONLY, no communication with any ECUs is made. If a user
wants to disable the automatic transmission of TesterPresent requests that keeps alive a non-default
diagnostic session, he/she should set the session type to the default diagnostic session
( uds_svc_param_dsc.PUDS_SVC_PARAM_DSC_DS ). It is assumed that the channel was already initialized, and
a session exists.
C#
uds_sessioninfo new_sessioninfo;
new_sessioninfo.can_msg_type = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
new_sessioninfo.session_type = (Byte)UDSApi.uds_svc_param_dsc.PUDS_SVC_PARAM_DSC_DS;
161
PCAN-UDS 2.x API – User Manual
new_sessioninfo.timeout_p2can_server_max = 1;
new_sessioninfo.timeout_enhanced_p2can_server_max = 2;
new_sessioninfo.s3_client_ms = 8;
new_sessioninfo.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
new_sessioninfo.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
new_sessioninfo.nai.source_addr =
(UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
new_sessioninfo.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
new_sessioninfo.nai.extension_addr = 0;
// free ressource
Marshal.FreeHGlobal(session_ptr);
C++/CLR
uds_sessioninfo new_sessioninfo;
new_sessioninfo.can_msg_type = PCANTP_CAN_MSGTYPE_STANDARD;
new_sessioninfo.session_type = (Byte)UDSApi::uds_svc_param_dsc::PUDS_SVC_PARAM_DSC_DS;
new_sessioninfo.timeout_p2can_server_max = 1;
new_sessioninfo.timeout_enhanced_p2can_server_max = 2;
new_sessioninfo.s3_client_ms = 8;
new_sessioninfo.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
new_sessioninfo.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
new_sessioninfo.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
new_sessioninfo.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
new_sessioninfo.nai.extension_addr = 0;
// free ressource
Marshal::FreeHGlobal(session_ptr);
Visual Basic
162
PCAN-UDS 2.x API – User Manual
new_sessioninfo.timeout_enhanced_p2can_server_max = 2
new_sessioninfo.s3_client_ms = 8
new_sessioninfo.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
new_sessioninfo.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
new_sessioninfo.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
new_sessioninfo.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
new_sessioninfo.nai.extension_addr = 0
Pascal OO
var
result: uds_status;
new_sessioninfo: uds_sessioninfo;
begin
new_sessioninfo.can_msg_type := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
new_sessioninfo.session_type := Byte(uds_svc_param_dsc.PUDS_SVC_PARAM_DSC_DS);
new_sessioninfo.timeout_p2can_server_max := 1;
new_sessioninfo.timeout_enhanced_p2can_server_max := 2;
new_sessioninfo.s3_client_ms := 8;
new_sessioninfo.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
new_sessioninfo.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
new_sessioninfo.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
new_sessioninfo.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
new_sessioninfo.nai.extension_addr := 0;
163
PCAN-UDS 2.x API – User Manual
See also: uds_parameter on page 41, Detailed Parameters Characteristics on page 45, GetValue_2013 on page
178.
Plain function version: UDS_SetValue_2013 on page 630.
3.7.11 AddMapping_2013
Adds a user-defined mapping between a CAN identifier and a network address information. Defining a
mapping enables PCANTP communication with 11BITS CAN identifier or with opened Addressing Formats
(like PCANTP_ISOTP_FORMAT_NORMAL or PCANTP_ISOTP_FORMAT_EXTENDED ).
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_AddMapping_2013")>
Public Shared Function AddMapping_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef mapping As uds_mapping) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
mapping Mapping to be added (see uds_mapping on page 25).
Remark
By default, some mappings are initialized in the PCAN-UDS 2.x API (see UDS and ISO-TP Network
Addressing Information on page 771).
164
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the given mapping is null.
PUDS_STATUS_ALREADY_INITIALIZED A mapping with the same CAN identifier already exists.
PUDS_STATUS_MAPPING_INVALID Mapping is not valid regarding UDS standard.
PUDS_STATUS_NO_MEMORY Failed to allocate memory to define mapping.
Example
The following example shows the use of the method AddMapping_2013 on the USB channel 1. It creates
mappings to communicate with custom CAN identifiers between test equipment and ECU 1 in ISO15765-2
11bits normal addressing on initialized USB channel 1:
Set CAN identifier = 0x123 and flow control id = 0x124 for request and set CAN identifier = 0x124 and
flow control id = 0x123 for response. Test equipment address corresponds to 0xF1 and ECU 1
address corresponds to 0x01. Here is a small scheme of the mapping:
Request
External test ECU 1
equipment (ID=0x01)
(ID=0xF1)
Response
C#
uds_mapping response_mapping;
response_mapping = request_mapping;
response_mapping.can_id = request_mapping.can_id_flow_ctrl;
165
PCAN-UDS 2.x API – User Manual
response_mapping.can_id_flow_ctrl = request_mapping.can_id;
response_mapping.nai.source_addr = request_mapping.nai.target_addr;
response_mapping.nai.target_addr = request_mapping.nai.source_addr;
uds_status status;
status = UDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request_mapping);
if (UDSApi.StatusIsOk_2013(status))
MessageBox.Show("Add request mapping", "Success");
else
MessageBox.Show("Failed to add request mapping", "Error");
status = UDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref response_mapping);
if (UDSApi.StatusIsOk_2013(status))
MessageBox.Show("Add response mapping", "Success");
else
MessageBox.Show("Failed to add response mapping", "Error");
C++ / CLR
uds_mapping response_mapping;
response_mapping = request_mapping;
response_mapping.can_id = request_mapping.can_id_flow_ctrl;
response_mapping.can_id_flow_ctrl = request_mapping.can_id;
response_mapping.nai.source_addr = request_mapping.nai.target_addr;
response_mapping.nai.target_addr = request_mapping.nai.source_addr;
uds_status status;
status = UDSApi::AddMapping_2013(PCANTP_HANDLE_USBBUS1, request_mapping);
if (UDSApi::StatusIsOk_2013(status))
MessageBox::Show("Add request mapping", "Success");
else
MessageBox::Show("Failed to add request mapping", "Error");
Visual Basic
166
PCAN-UDS 2.x API – User Manual
Pascal OO
var
request_mapping: uds_mapping;
response_mapping: uds_mapping;
status: uds_status;
begin
request_mapping.can_id := $123;
request_mapping.can_id_flow_ctrl := $124;
request_mapping.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.extension_addr := 0;
request_mapping.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
request_mapping.can_tx_dlc := 8;
request_mapping.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
request_mapping.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
request_mapping.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
response_mapping := request_mapping;
response_mapping.can_id := request_mapping.can_id_flow_ctrl;
response_mapping.can_id_flow_ctrl := request_mapping.can_id;
response_mapping.nai.source_addr := request_mapping.nai.target_addr;
response_mapping.nai.target_addr := request_mapping.nai.source_addr;
status := TUDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request_mapping);
if TUDSApi.StatusIsOk_2013(status) then
begin
MessageBox(0, 'Add request mapping', 'Success', MB_OK);
end
else
begin
MessageBox(0, 'Failed to add request mapping', 'Error', MB_OK);
end;
status := TUDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@response_mapping);
if TUDSApi.StatusIsOk_2013(status) then
begin
167
PCAN-UDS 2.x API – User Manual
3.7.12 RemoveMapping_2013
Removes a user defined PUDS mapping.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_RemoveMapping_2013")>
Public Shared Function RemoveMapping_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal mapping As uds_mapping) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
mapping The mapping to remove (see uds_mapping on page 25).
168
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The mapping is not a valid mapping.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping is not in the mapping list.
Example
The following example shows the use of the method RemoveMapping_2013 on the USB channel 1. It creates a
mapping then removes it.
C#
uds_status status;
status = UDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request_mapping);
if (UDSApi.StatusIsOk_2013(status))
{
C++ / CLR
169
PCAN-UDS 2.x API – User Manual
request_mapping.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
request_mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
uds_status status;
status = UDSApi::AddMapping_2013(PCANTP_HANDLE_USBBUS1, request_mapping);
if (UDSApi::StatusIsOk_2013(status))
{
Visual Basic
Pascal OO
var
request_mapping: uds_mapping;
status: uds_status;
begin
request_mapping.can_id := $123;
request_mapping.can_id_flow_ctrl := $124;
request_mapping.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.extension_addr := 0;
170
PCAN-UDS 2.x API – User Manual
request_mapping.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
request_mapping.can_tx_dlc := 8;
request_mapping.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
request_mapping.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
request_mapping.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status := TUDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request_mapping);
if TUDSApi.StatusIsOk_2013(status) then
begin
See also: uds_mapping on page 25, RemoveMappingByCanId_2013 on page 171, AddMapping_2013 on page 164.
Plain function version: UDS_RemoveMapping_2013 on page 635.
3.7.13 RemoveMappingByCanId_2013
Removes all user defined PUDS mappings corresponding to a CAN identifier.
Syntax
Pascal OO
C#
C++ / CLR
171
PCAN-UDS 2.x API – User Manual
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
UInt32 can_id);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_RemoveMappingByCanId_2013")>
Public Shared Function RemoveMappingByCanId_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal can_id As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
can_id The mapped CAN identifier to search for that identifies the mappings to remove (see predefined
uds_can_id values on page 58).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The CAN identifier to remove is not specified in a mapping.
Example
The following example shows the use of the method RemoveMappingByCanId_2013 on the USB channel 1. It
creates a mapping then removes it using its CAN identifier on initialized USB channel 1:
C#
uds_status status;
status = UDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request_mapping);
if (UDSApi.StatusIsOk_2013(status))
{
172
PCAN-UDS 2.x API – User Manual
else
{
MessageBox.Show("Failed to remove request mapping", "Error");
}
}
else
{
MessageBox.Show("Failed to add request mapping", "Error");
}
C++ / CLR
uds_status status;
status = UDSApi::AddMapping_2013(PCANTP_HANDLE_USBBUS1, request_mapping);
if (UDSApi::StatusIsOk_2013(status))
{
Visual Basic
173
PCAN-UDS 2.x API – User Manual
Pascal OO
var
request_mapping: uds_mapping;
status: uds_status;
begin
request_mapping.can_id := $123;
request_mapping.can_id_flow_ctrl := $124;
request_mapping.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.extension_addr := 0;
request_mapping.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
request_mapping.can_tx_dlc := 8;
request_mapping.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
request_mapping.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
request_mapping.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status := TUDSApi.AddMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request_mapping);
if TUDSApi.StatusIsOk_2013(status) then
begin
See also: uds_mapping on page 25, RemoveMapping_2013 on page 168, AddMapping_2013 on page 164.
Plain function version: UDS_RemoveMappingByCanId_2013 on page 634.
174
PCAN-UDS 2.x API – User Manual
3.7.14 AddCanIdFilter_2013
Adds an entry to the CAN identifier white-list filtering.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_AddCanIdFilter_2013")>
Public Shared Function AddCanIdFilter_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal can_id As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
can_id CAN identifier to add in the white-list (see predefined uds_can_id values on page 58).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_ALREADY_INITIALIZED The CAN identifier is already in the white list.
PUDS_STATUS_NO_MEMORY Memory allocation error when adding the new element in the white list.
Example
The following example shows the use of the method AddCanIdFilter_2013 the channel PCANTP_HANDLE_USBBUS1 .
It adds a filter on 0xD1 CAN identifier.
C#
175
PCAN-UDS 2.x API – User Manual
uds_status result;
result = UDSApi.AddCanIdFilter_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, 0xD1);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Error adding CAN ID filter.", "Error");
C++ / CLR
uds_status result;
result = UDSApi::AddCanIdFilter_2013(PCANTP_HANDLE_USBBUS1, 0xD1);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Error adding CAN ID filter.", "Error");
Visual Basic
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.AddCanIdFilter_2013
(cantp_handle.PCANTP_HANDLE_USBBUS1, $D1);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Error adding CAN ID filter.', 'Error', MB_OK);
end;
end;
3.7.15 RemoveCanIdFilter_2013
Removes an entry from the CAN identifier white-list filtering.
Syntax
Pascal OO
class function RemoveCanIdFilter_2013(
channel: cantp_handle;
can_iD: UInt32
): uds_status;
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_RemoveCanIdFilter_2013")]
public static extern uds_status RemoveCanIdFilter_2013(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
UInt32 can_id);
176
PCAN-UDS 2.x API – User Manual
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_RemoveCanIdFilter_2013")]
static uds_status RemoveCanIdFilter_2013(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
UInt32 can_id);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_RemoveCanIdFilter_2013")>
Public Shared Function RemoveCanIdFilter_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal can_id As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
can_id CAN identifier to remove (see predefined uds_can_id values on page 58).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of the
calling application. Or the CAN identifier is not in the white list.
Example
The following example shows the use of the method RemoveCanIdFilter_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It adds a filter on 0xD1 CAN identifier then removes it.
C#
uds_status result;
result = UDSApi.AddCanIdFilter_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, 0xD1);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Error adding CAN ID filter.", "Error");
C++ / CLR
uds_status result;
result = UDSApi::AddCanIdFilter_2013(PCANTP_HANDLE_USBBUS1, 0xD1);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Error adding CAN ID filter.", "Error");
177
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.AddCanIdFilter_2013
(cantp_handle.PCANTP_HANDLE_USBBUS1, $D1);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Error adding CAN ID filter.', 'Error', MB_OK);
end;
// Remove previously added can identifier filter
result := TUDSApi.RemoveCanIdFilter_2013
(cantp_handle.PCANTP_HANDLE_USBBUS1, $D1);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Error removing CAN ID filter.', 'Error', MB_OK);
end;
end;
3.7.16 GetValue_2013
Retrieves information from a PUDS channel.
Overloads
Method Description
GetValue_2013(cantp_handle, Retrieves information from a PUDS channel in numeric form.
uds_parameter, UInt32, UInt32)
GetValue_2013(cantp_handle, Retrieves information from a PUDS channel in text form.
uds_parameter, String, UInt32)
GetValue_2013(cantp_handle, Retrieves information from a PUDS channel in byte array form.
uds_parameter, Byte[], UInt32)
GetValue_2013(cantp_handle, Retrieves information from a PUDS channel in pointer form.
uds_parameter, IntPtr, UInt32)
178
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetValue_2013")>
Public Shared Function GetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
ByVal buffer As StringBuilder,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The buffer to return the required string value.
buffer_size The length in bytes of the given buffer.
179
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Example
The following example shows the use of the method GetValue_2013 to retrieve the version of the PCAN-UDS
API. Depending on the result, a message will be shown to the user.
C#
uds_status result;
StringBuilder buffer;
C++ / CLR
uds_status result;
StringBuilder ^buffer;
Visual Basic
180
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
buffer: array [0 .. 256] of ansichar;
begin
See also: SetValue_2013 on page 153, uds_parameter on page 41, Detailed Parameters Characteristics on page
45.
Plain function version: UDS_GetValue_2013 on page 631.
Syntax
Pascal OO
C#
C++ / CLR
181
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetValue_2013")>
Public Shared Function GetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
ByRef buffer As UInt32,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The buffer to return the required numeric value.
buffer_size The length in bytes of the given buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Example
The following example shows the use of the method GetValue_2013 on the channel PCANTP_HANDLE_USBBUS1
to retrieve the separation time value (STmin). Depending on the result, a message will be shown to the
user.
C#
uds_status result;
UInt32 buffer = 0;
C++ / CLR
uds_status result;
UInt32 buffer = 0;
182
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
buffer: UInt32;
begin
buffer := 0;
See also: SetValue_2013 on page 153, uds_parameter on page 41, Detailed Parameters Characteristics on page 45.
Plain function version: UDS_GetValue_2013 on page 631.
183
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetValue_2013")>
Public Shared Function GetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
<MarshalAs(UnmanagedType.LPArray)>
<Out> ByVal buffer As Byte(),
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The buffer containing the array value to retrieve.
buffer_size The length in bytes of the given buffer.
184
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Example
The following example shows the use of the method GetValue_2013 on the channel PCANTP_HANDLE_USBBUS1
to retrieve the separation time value (STmin). Depending on the result, a message will be shown to the
user.
C#
uds_status result;
uint buffer_size = 1;
byte[] byte_buffer = new byte[buffer_size];
C++ / CLR
uds_status result;
UInt32 buffer_size = 1;
array<Byte>^ byte_buffer = gcnew array<Byte>(buffer_size);
Visual Basic
' Get the value of the ISO-TP Separation Time (STmin) parameter
result = UDSApi.GetValue_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
uds_parameter.PUDS_PARAMETER_SEPARATION_TIME, byte_buffer, 1)
185
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
byte_buffer: array [0 .. 0] of Byte;
begin
See also: SetValue_2013 on page 153, uds_parameter on page 41, Detailed Parameters Characteristics on page
45.
Plain function version: UDS_GetValue_2013 on page 631.
Syntax
Pascal OO
C#
186
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetValue_2013")>
Public Shared Function GetValue_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.U4)>
ByVal parameter As uds_parameter,
ByVal buffer As IntPtr,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to be set (see uds_parameter on page 41).
buffer The pointer on the buffer containing the value to retrieve.
buffer_size The length in bytes of the given buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Example
The following example shows the use of the method GetValue_2013 on the channel PCANTP_HANDLE_USBBUS1
to retrieve the UDS Session Information. A console message will be written with the information retrieved.
C#
uds_status result;
uds_sessioninfo session_info = new uds_sessioninfo();
// Mapping to search
session_info.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
session_info.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr =
(UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
session_info.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
session_info.nai.extension_addr = 0;
187
PCAN-UDS 2.x API – User Manual
C++/CLR
uds_status result;
uds_sessioninfo session_info = {};
// Mapping to search
session_info.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
session_info.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
session_info.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
session_info.nai.extension_addr = 0;
188
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
session_info: uds_sessioninfo;
begin
189
PCAN-UDS 2.x API – User Manual
// Mapping to search
session_info.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
session_info.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
session_info.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
session_info.nai.extension_addr := 0;
See also: SetValue_2013 on page 153, uds_parameter on page 41, Detailed Parameters Characteristics on page
45.
Plain function version: UDS_GetValue_2013 on page 631.
3.7.21 GetCanBusStatus_2013
Gets information about the internal BUS status of a PUDS channel.
Syntax
Pascal OO
190
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetCanBusStatus_2013")>
Public Shared Function GetCanBusStatus_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_FLAG_BUS_LIGHT Indicates a bus error within the given PUDS channel. The hardware is in bus-light status.
PUDS_STATUS_FLAG_BUS_HEAVY Indicates a bus error within the given PUDS channel. The hardware is in bus-heavy status.
PUDS_STATUS_FLAG_BUS_OFF Indicates a bus error within the given PUDS channel. The hardware is in bus-off status.
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of the
calling application.
Remarks
When the hardware status is bus-off, an application cannot communicate anymore. Consider using the
PCAN-Basic property PCAN_BUSOFF_AUTORESET which instructs the API to automatically reset the CAN
controller when a bus-off state is detected.
Another way to reset errors like bus-off, bus-heavy and bus-light, is to uninitialize and initialize again the
channel used. This causes a hardware reset.
Example
The following example shows the use of the method GetCanBusStatus_2013 on the channel
PCANTP_HANDLE_PCIBUS1 . Depending on the result, a message will be shown to the user.
C#
uds_status result;
191
PCAN-UDS 2.x API – User Manual
result = UDSApi.GetCanBusStatus_2013(cantp_handle.PCANTP_HANDLE_PCIBUS1);
switch (result)
{
case uds_status.PUDS_STATUS_FLAG_BUS_LIGHT:
MessageBox.Show("PCAN-PCI (Ch-1): Handling a BUS-LIGHT status...", "Success");
break;
case uds_status.PUDS_STATUS_FLAG_BUS_HEAVY:
MessageBox.Show("PCAN-PCI (Ch-1): Handling a BUS-HEAVY status...", "Success");
break;
case uds_status.PUDS_STATUS_FLAG_BUS_OFF:
MessageBox.Show("PCAN-PCI (Ch-1): Handling a BUS-OFF status...", "Success");
break;
case uds_status.PUDS_STATUS_OK:
MessageBox.Show("PCAN-PCI (Ch-1): Status is OK", "Success");
break;
default:
// An error occurred
MessageBox.Show("Failed to retrieve status", "Error");
break;
}
C++ / CLR
uds_status result;
Visual Basic
Dim result As uds_status
192
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
begin
// Check the status of the PCI channel
result := TUDSApi.GetCanBusStatus_2013(cantp_handle.PCANTP_HANDLE_PCIBUS1);
case result of
uds_status.PUDS_STATUS_FLAG_BUS_LIGHT:
MessageBox(0, 'PCAN-PCI (Ch-1): Handling a BUS-LIGHT status...',
'Success', MB_OK);
uds_status.PUDS_STATUS_FLAG_BUS_HEAVY:
MessageBox(0, 'PCAN-PCI (Ch-1): Handling a BUS-HEAVY status...',
'Success', MB_OK);
uds_status.PUDS_STATUS_FLAG_BUS_OFF:
MessageBox(0, 'PCAN-PCI (Ch-1): Handling a BUS-OFF status...',
'Success', MB_OK);
uds_status.PUDS_STATUS_OK:
MessageBox(0, 'PCAN-PCI (Ch-1): Status is OK', 'Success', MB_OK);
else
// An error occurred
MessageBox(0, 'Failed to retrieve status', 'Error', MB_OK);
end;
end;
3.7.22 GetMapping_2013
Retrieves a mapping matching the given CAN identifier and message type (11bits, 29 bits, FD, etc.).
Syntax
Pascal OO
C#
C++ / CLR
193
PCAN-UDS 2.x API – User Manual
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_mapping %buffer,
UInt32 can_id,
cantp_can_msgtype can_msgtype);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetMapping_2013")>
Public Shared Function GetMapping_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef buffer As uds_mapping,
ByVal can_id As UInt32,
ByVal can_msgtype As cantp_can_msgtype) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
buffer Output, buffer to store the searched mapping (see uds_mapping on page 25).
can_id The CAN identifier to look for (see predefined uds_can_id values on page 58).
can_msgtype The CAN message type to look for (11bits, 29 bits, FD, etc.). See cantp_can_msgtype on page 121.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels
of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The buffer is invalid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED Indicates that no matching mapping was found in the registered mapping list.
Example
The following example shows the use of the method GetMapping_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It gets the mapping for the 0x7E0 CAN identifier then print it.
if (UDSApi.StatusIsOk_2013(result))
{
Console.WriteLine("Mapping defined for the " + result_mapping.can_id + " can identifier:");
Console.WriteLine("\t- Flow control identifier: " + result_mapping.can_id_flow_ctrl);
Console.WriteLine("\t- CAN message type: " + result_mapping.can_msgtype);
Console.WriteLine("\t- TX DLC: " + result_mapping.can_tx_dlc);
Console.WriteLine("\t- Extension address: " + result_mapping.nai.extension_addr);
Console.WriteLine("\t- Protocol: " + result_mapping.nai.protocol);
Console.WriteLine("\t- Source address: " + result_mapping.nai.source_addr);
Console.WriteLine("\t- Target address: " + result_mapping.nai.target_addr);
Console.WriteLine("\t- Target type: " + result_mapping.nai.target_type);
}
194
PCAN-UDS 2.x API – User Manual
else
{
Console.WriteLine("Error, cannot get mapping information.");
}
C++ / CLR
uds_status result;
uds_mapping result_mapping;
result = UDSApi::GetMapping_2013(PCANTP_HANDLE_USBBUS1, result_mapping,
PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1, PCANTP_CAN_MSGTYPE_STANDARD);
if (UDSApi::StatusIsOk_2013(result))
{
Console::WriteLine("Mapping defined for the " + result_mapping.can_id +
" can identifier:");
Console::WriteLine("\t- Flow control identifier: " + result_mapping.can_id_flow_ctrl);
Console::WriteLine("\t- CAN message type: {0}", (int)result_mapping.can_msgtype);
Console::WriteLine("\t- TX DLC: " + result_mapping.can_tx_dlc);
Console::WriteLine("\t- Extension address: " + result_mapping.nai.extension_addr);
Console::WriteLine("\t- Protocol: {0}", (int)result_mapping.nai.protocol);
Console::WriteLine("\t- Source address: " + result_mapping.nai.source_addr);
Console::WriteLine("\t- Target address: " + result_mapping.nai.target_addr);
Console::WriteLine("\t- Target type: {0}", (int)result_mapping.nai.target_type);
}
else
{
Console::WriteLine("Error, cannot get mapping information.");
}
Visual Basic
Dim result As uds_status
Dim result_mapping As uds_mapping
result = UDSApi.GetMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, result_mapping,
uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1,
cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD)
If UDSApi.StatusIsOk_2013(result) Then
Console.WriteLine("Mapping defined for the " + result_mapping.can_id.ToString() +
" can identifier:")
Console.WriteLine(" - Flow control identifier: " +
result_mapping.can_id_flow_ctrl.ToString())
Console.WriteLine(" - CAN message type: " + result_mapping.can_msgtype.ToString())
Console.WriteLine(" - TX DLC: " + result_mapping.can_tx_dlc.ToString())
Console.WriteLine(" - Extension address: " + result_mapping.nai.extension_addr.ToString())
Console.WriteLine(" - Protocol: " + result_mapping.nai.protocol.ToString())
Console.WriteLine(" - Source address: " + result_mapping.nai.source_addr.ToString())
Console.WriteLine(" - Target address: " + result_mapping.nai.target_addr.ToString())
Console.WriteLine(" - Target type: " + result_mapping.nai.target_type.ToString())
Else
Console.WriteLine("Error, cannot get mapping information.")
End If
Pascal OO
var
result: uds_status;
result_mapping: uds_mapping;
begin
result := TUDSApi.GetMapping_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
result_mapping,
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1),
195
PCAN-UDS 2.x API – User Manual
cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD);
if TUDSApi.StatusIsOk_2013(result) then
begin
WriteLn(format('Mapping defined for the %d can identifier:',
[Integer(result_mapping.can_id)]));
WriteLn(format(' - Flow control identifier: %d',
[Integer(result_mapping.can_id_flow_ctrl)]));
WriteLn(format(' - CAN message type: %d',
[Integer(result_mapping.can_msgtype)]));
WriteLn(format(' - TX DLC: %d', [Integer(result_mapping.can_tx_dlc)]));
WriteLn(format(' - Extension address: %d',
[Integer(result_mapping.nai.extension_addr)]));
WriteLn(format(' - Protocol: %d', [Integer(result_mapping.nai.protocol)]));
WriteLn(format(' - Source address: %d',
[Integer(result_mapping.nai.source_addr)]));
WriteLn(format(' - Target address: %d',
[Integer(result_mapping.nai.target_addr)]));
WriteLn(format(' - Target type: %d',
[Integer(result_mapping.nai.target_type)]));
end
else
begin
WriteLn('Error, cannot get mapping information.');
end;
end;
3.7.23 GetMappings_2013
Retrieves all the mappings defined for a PUDS channel.
Syntax
Pascal OO
C#
C++ / CLR
196
PCAN-UDS 2.x API – User Manual
cantp_handle channel,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 2)]
[Out] array<uds_mapping> ^buffer,
UInt16 buffer_length,
UInt16 %count);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetMappings_2013")>
Public Shared Function GetMappings_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=2)>
<Out> ByVal buffer As uds_mapping(),
ByVal buffer_length As UInt16,
ByRef count As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
buffer Output, a buffer to store an array of uds_mapping (see uds_mapping on page 25).
buffer_length The number of uds_mapping elements the buffer can store.
count Output, the actual number of elements copied in the buffer.
Remark
By default, some mappings are initialized in the PCAN-UDS 2.x API (see UDS and ISO-TP Network
Addressing Information on page 771).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_BUFFER_TOO_SMALL The given buffer is too small to store all mappings.
PUDS_STATUS_PARAM_INVALID_VALUE The buffer is invalid.
Example
The following example shows the use of the method GetMappings_2013 on PCANTP_HANDLE_USBBUS1 . It
displays all mappings added on the channel.
C#
uds_status result;
UInt16 count = 256;
uds_mapping[] mappings = new uds_mapping[256];
result = UDSApi.GetMappings_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, mappings, count, ref
count);
if (UDSApi.StatusIsOk_2013(result))
{
for (int i = 0; i < count; i++)
{
Console.WriteLine("mappings[" + i + "]:");
197
PCAN-UDS 2.x API – User Manual
C++ / CLR
uds_status result;
UInt16 count = 256;
array<uds_mapping>^ mappings = gcnew array<uds_mapping>(256);
result = UDSApi::GetMappings_2013(PCANTP_HANDLE_USBBUS1, mappings, count, count);
if (UDSApi::StatusIsOk_2013(result))
{
for (int i = 0; i < count; i++)
{
Console::WriteLine("mappings[" + i + "]:");
Console::WriteLine("\t- CAN identifier: " + mappings[i].can_id);
Console::WriteLine("\t- Flow control identifier: " +
mappings[i].can_id_flow_ctrl);
Console::WriteLine("\t- CAN message type: {0}", (int)mappings[i].can_msgtype);
Console::WriteLine("\t- TX DLC: " + mappings[i].can_tx_dlc);
Console::WriteLine("\t- Extension address: " + mappings[i].nai.extension_addr);
Console::WriteLine("\t- Protocol: {0}", (int)mappings[i].nai.protocol);
Console::WriteLine("\t- Source address: " + mappings[i].nai.source_addr);
Console::WriteLine("\t- Target address: " + mappings[i].nai.target_addr);
Console::WriteLine("\t- Target type: {0} ", (int)mappings[i].nai.target_type);
}
}
else
{
Console::WriteLine("Error, cannot get mappings.");
}
Visual Basic
198
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
i: UInt32;
count: UInt16;
mappings: array [0 .. 255] of uds_mapping;
begin
count := 256;
result := TUDSApi.GetMappings_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@mappings, count, @count);
if TUDSApi.StatusIsOk_2013(result) then
begin
for i := 0 to count - 1 do
begin
WriteLn(format('mappings[%d]:', [Integer(i)]));
WriteLn(format(' - CAN identifier: %d', [Integer(mappings[i].can_id)]));
WriteLn(format(' - Flow control identifier: %d',
[Integer(mappings[i].can_id_flow_ctrl)]));
WriteLn(format(' - CAN message type: %d',
[Integer(mappings[i].can_msgtype)]));
WriteLn(format(' - TX DLC: %d', [Integer(mappings[i].can_tx_dlc)]));
WriteLn(format(' - Extension address: %d',
[Integer(mappings[i].nai.extension_addr)]));
WriteLn(format(' - Protocol: %d', [Integer(mappings[i].nai.protocol)]));
WriteLn(format(' - Source address: %d',
[Integer(mappings[i].nai.source_addr)]));
WriteLn(format(' - Target address: %d',
[Integer(mappings[i].nai.target_addr)]));
WriteLn(format(' - Target type: %d',
[Integer(mappings[i].nai.target_type)]));
end
end
else
begin
WriteLn('Error, cannot get mappings.');
end;
end;
199
PCAN-UDS 2.x API – User Manual
3.7.24 GetSessionInformation_2013
Gets current ECU session information.
Syntax
Pascal OO
class function GetSessionInformation_2013(
channel: cantp_handle;
var session_info: uds_sessioninfo
): uds_status;
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_GetSessionInformation_2013")]
public static extern uds_status GetSessionInformation_2013(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
out uds_sessioninfo session_info);
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_GetSessionInformation_2013")]
static uds_status GetSessionInformation_2013(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_sessioninfo %session_info);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetSessionInformation_2013")>
Public Shared Function GetSessionInformation_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef session_info As uds_sessioninfo) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
session_info Input, the mapping to search for. Output, the session information filled if an ECU session exists (see
uds_sessioninfo on page 22).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application. Or the ECU session information is not initialized.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
Example
The following example shows the use of the method GetSessionInformation_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It gets the session information for a given mapping and prints it.
200
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_sessioninfo session_info;
// Mapping to search
session_info.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
session_info.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr =
(UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
session_info.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
session_info.nai.extension_addr = 0;
if (UDSApi.StatusIsOk_2013(result))
{
Console.WriteLine("Current session info:");
Console.WriteLine("\t- CAN message type: " + session_info.can_msg_type);
Console.WriteLine("\t- Extension address: " + session_info.nai.extension_addr);
Console.WriteLine("\t- Protocol: " + session_info.nai.protocol);
Console.WriteLine("\t- Source address: " + session_info.nai.source_addr);
Console.WriteLine("\t- Target address: " + session_info.nai.target_addr);
Console.WriteLine("\t- Target type: " + session_info.nai.target_type);
Console.WriteLine("\t- S3 client value: " + session_info.s3_client_ms);
Console.WriteLine("\t- Session type: " + session_info.session_type);
Console.WriteLine("\t- P2CAN server max enhanced timeout: " +
session_info.timeout_enhanced_p2can_server_max);
Console.WriteLine("\t- P2CAN server max enhanced timeout: " +
session_info.timeout_p2can_server_max);
}
else
{
Console.WriteLine("Error, cannot get session information.");
}
C++ / CLR
uds_status result;
uds_sessioninfo session_info;
// Mapping to search
session_info.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
session_info.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
session_info.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
session_info.nai.extension_addr = 0;
if (UDSApi::StatusIsOk_2013(result))
{
Console::WriteLine("Current session info:");
Console::WriteLine("\t- CAN message type: {0}", (int)session_info.can_msg_type);
Console::WriteLine("\t- Extension address: " + session_info.nai.extension_addr);
Console::WriteLine("\t- Protocol: {0}", (int)session_info.nai.protocol);
Console::WriteLine("\t- Source address: " + session_info.nai.source_addr);
Console::WriteLine("\t- Target address: " + session_info.nai.target_addr);
Console::WriteLine("\t- Target type: {0}", (int)session_info.nai.target_type);
Console::WriteLine("\t- S3 client value: " + session_info.s3_client_ms);
Console::WriteLine("\t- Session type: " + session_info.session_type);
201
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
session_info: uds_sessioninfo;
begin
// Mapping to search
session_info.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
session_info.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
session_info.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
session_info.nai.extension_addr := 0;
result := TUDSApi.GetSessionInformation_2013
(cantp_handle.PCANTP_HANDLE_USBBUS1, session_info);
202
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
WriteLn('Current session info:');
WriteLn(format(' - CAN message type: %d',
[Integer(session_info.can_msg_type)]));
WriteLn(format(' - Extension address: %d',
[Integer(session_info.nai.extension_addr)]));
WriteLn(format(' - Protocol: %d', [Integer(session_info.nai.protocol)]));
WriteLn(format(' - Source address: %d',
[Integer(session_info.nai.source_addr)]));
WriteLn(format(' - Target address: %d',
[Integer(session_info.nai.target_addr)]));
WriteLn(format(' - Target type: %d',
[Integer(session_info.nai.target_type)]));
WriteLn(format(' - S3 client value: %d',
[Integer(session_info.s3_client_ms)]));
WriteLn(format(' - Session type: %d',
[Integer(session_info.session_type)]));
WriteLn(format(' - P2CAN server max enhanced timeout: %d',
[Integer(session_info.timeout_enhanced_p2can_server_max)]));
WriteLn(format(' - P2CAN server max enhanced timeout: %d',
[Integer(session_info.timeout_p2can_server_max)]));
end
else
begin
WriteLn('Error, cannot get session information.');
end;
end;
See also: uds_sessioninfo on page 22, SetValue_2013 on page 153, SvcDiagnosticSessionControl_2013 on page 258.
Plain function version: UDS_GetSessionInformation_2013 on page 640.
3.7.25 StatusIsOk_2013
Checks if a PUDS status matches an expected result (default is PUDS_STATUS_OK ).
Overloads
Method Description
StatusIsOk_2013(uds_status) Checks if the uds_status matches PUDS_STATUS_OK in a non-strict mode.
StatusIsOk_2013(uds_status, uds_status) Checks if a uds_status matches the expected result in a non-strict mode.
203
PCAN-UDS 2.x API – User Manual
3.7.26 StatusIsOk_2013(uds_status)
Checks if the uds_status matches PUDS_STATUS_OK in a non-strict mode.
Syntax
Pascal OO
C++ / CLR
Visual Basic
Parameters
Parameter Description
status The status to analyze (see uds_status on page 32).
Returns
The return value is true if the status matches PUDS_STATUS_OK (in non-strict mode)
Remarks
When checking a uds_status , it is preferred to use UDS_StatusIsOk_2013 instead of comparing it with the ==
operator because UDS_StatusIsOk_2013 can remove information flag (in non-strict mode).
Example
The following example shows the use of the method StatusIsOk_2013 after initializing the channel
PCANTP_HANDLE_PCIBUS2 .
C#
uds_status result;
result = UDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Initialization failed", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-2) was initialized", "Success");
204
PCAN-UDS 2.x API – User Manual
C++ / CLR
uds_status result;
result = UDSApi::Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Initialization failed", "Error");
else
MessageBox::Show("PCAN-PCI (Ch-2) was initialized", "Success");
Visual Basic
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Initialization failed', 'Error', MB_OK);
end
else
begin
MessageBox(0, 'PCAN-PCI (Ch-2) was initialized', 'Success', MB_OK);
end;
end;
Syntax
Pascal OO
C#
205
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Parameters
Parameter Description
status The status to analyze (see uds_status on page 32).
status_expected The expected status (see uds_status on page 32). The default value is PUDS_STATUS_OK.
Returns
The return value is true if the status matches expected parameter (in non-strict mode).
Remarks
When checking a uds_status , it is preferred to use UDS_StatusIsOk_2013 instead of comparing it with the ==
operator because UDS_StatusIsOk_2013 can remove information flag (in non-strict mode).
Example
The following example shows the use of the method StatusIsOk_2013 after initializing the channel
PCANTP_HANDLE_PCIBUS2 .
C#
uds_status result;
result = UDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K);
if (!UDSApi.StatusIsOk_2013(result, uds_status.PUDS_STATUS_OK))
MessageBox.Show("Initialization failed", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-2) was initialized", "Success");
C++ / CLR
uds_status result;
result = UDSApi::Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K);
if (!UDSApi::StatusIsOk_2013(result, PUDS_STATUS_OK))
MessageBox::Show("Initialization failed", "Error");
else
MessageBox::Show("PCAN-PCI (Ch-2) was initialized", "Success");
Visual Basic
206
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K);
if not TUDSApi.StatusIsOk_2013(result, uds_status.PUDS_STATUS_OK) then
begin
MessageBox(0, 'Initialization failed', 'Error', MB_OK);
end
else
begin
MessageBox(0, 'PCAN-PCI (Ch-2) was initialized', 'Success', MB_OK);
end;
end;
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
207
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
status The status to analyze (see uds_status on page 32).
status_expected The expected status (see uds_status on page 32). The default value is PUDS_STATUS_OK.
strict_mode Enable strict mode (default is false). Strict mode ensures that bus or extra information are the same.
Returns
The return value is true if the status matches expected parameter.
Remarks
When checking a uds_status , it is preferred to use UDS_StatusIsOk_2013 instead of comparing it with the ==
operator because UDS_StatusIsOk_2013 can remove information flag (in non-strict mode).
Example
The following example shows the use of the method StatusIsOk_2013 after initializing the channel
PCANTP_HANDLE_PCIBUS2 .
C#
uds_status result;
result = UDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K);
if (!UDSApi.StatusIsOk_2013(result, uds_status.PUDS_STATUS_OK, false))
MessageBox.Show("Initialization failed", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-2) was initialized", "Success");
C++ / CLR
uds_status result;
result = UDSApi::Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K);
if (!UDSApi::StatusIsOk_2013(result, PUDS_STATUS_OK, false))
MessageBox::Show("Initialization failed", "Error");
else
MessageBox::Show("PCAN-PCI (Ch-2) was initialized", "Success");
Visual Basic
Dim result As uds_status
result = UDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K)
If Not UDSApi.StatusIsOk_2013(result, uds_status.PUDS_STATUS_OK, False) Then
MessageBox.Show("Initialization failed", "Error")
Else
MessageBox.Show("PCAN-PCI (Ch-2) was initialized", "Success")
End If
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.Initialize_2013(cantp_handle.PCANTP_HANDLE_PCIBUS2,
cantp_baudrate.PCANTP_BAUDRATE_500K);
if not TUDSApi.StatusIsOk_2013(result, uds_status.PUDS_STATUS_OK, false) then
begin
MessageBox(0, 'Initialization failed', 'Error', MB_OK);
end
else
208
PCAN-UDS 2.x API – User Manual
begin
MessageBox(0, 'PCAN-PCI (Ch-2) was initialized', 'Success', MB_OK);
end;
end;
3.7.29 GetErrorText_2013
Gets a descriptive text for a PUDS error code.
Syntax
Pascal OO
C#
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_GetErrorText_2013")]
static uds_status GetErrorText_2013(
[MarshalAs(UnmanagedType::U4)]
uds_status error_code,
UInt16 language,
StringBuilder ^buffer,
UInt32 buffer_size);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_GetErrorText_2013")>
Public Shared Function GetErrorText_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal error_code As uds_status,
ByVal language As UInt16,
ByVal buffer As StringBuilder,
ByVal buffer_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
error_code The uds_status error code (see uds_status on page 32).
language The current languages available for translation are: Neutral (0x00), German (0x07), English (0x09), Spanish
(0x0A), Italian (0x10) and French (0x0C).
209
PCAN-UDS 2.x API – User Manual
Parameter Description
buffer A buffer for a null-terminated char array.
buffer_size Buffer length in bytes.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the method are invalid. Check the parameter
'buffer'; it should point to a char array, big enough to allocate the text for the given error
code.
Remarks
The Primary Language IDs are codes used by Windows OS from Microsoft, to identify a human language.
The PCAN-Basic API currently supports the following languages:
Note: If the buffer is too small for the resulting text, the error 0x80008000 ( PUDS_STATUS_MASK_PCAN|
PCAN_ERROR_ILLPARAMVAL ) is returned. Even when only short texts are being currently returned, a text
within this method can have a maximum of 255 characters. For this reason, it is recommended to use
a buffer with a length of at least 256 bytes.
Example
The following example shows the use of the method GetErrorText_2013 to get the description of an error. The
language of the description's text will be the same used by the operating system (if its language is
supported; otherwise English is used).
Note: It is assumed that the channel was NOT initialized (to generate an error).
C#
C++ / CLR
210
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
error_result: uds_status;
str_msg: array [0 .. 255] of ansichar;
begin
error_result := TUDSApi.Uninitialize_2013(cantp_handle.PCANTP_HANDLE_USBBUS1);
result := TUDSApi.GetErrorText_2013(error_result, $0,
PAnsichar(@str_msg), 256);
if TUDSApi.StatusIsOk_2013(result) and not TUDSApi.StatusIsOk_2013
(error_result) then
begin
MessageBox(0, PWideChar(String(str_msg)), 'Error on uninitialized', MB_OK);
end;
end;
3.7.30 MsgAlloc_2013
Allocates a PUDS message using the given configuration.
Syntax
Pascal OO
C#
211
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_MsgAlloc_2013")>
Public Shared Function MsgAlloc_2013(
ByRef msg_buffer As uds_msg,
ByVal msg_configuration As uds_msgconfig,
ByVal msg_data_length As UInt32) As uds_status
End Function
Parameters
Parameter Description
msg_buffer A uds_msg structure buffer. It will be freed if required (see uds_msg on page 21).
msg_configuration Configuration of the message to allocate (see uds_msgconfig on page 25).
msg_data_length Size of the message data.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
The uds_msg structure is automatically initialized and allocated by the PCAN-UDS 2.x API using:
- MsgAlloc_2013 method
- Read_2013 method
- WaitFor methods
Once processed, the uds_msg structure should be released using MsgFree_2013 method.
Example
The following example shows the use of the method MsgAlloc_2013 . It allocates a ClearDiagnosticInformation
service positive response (fixed length of one byte), with a physical configuration between ECU 1 and test
equipment using in ISO15765-2 11bits normal addressing.
C#
uds_msgconfig config_physical = new uds_msgconfig();
config_physical.can_id = (UInt16)uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1;
config_physical.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config_physical.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config_physical.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config_physical.type = uds_msgtype.PUDS_MSGTYPE_USDT;
212
PCAN-UDS 2.x API – User Manual
config_physical.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config_physical.nai.target_addr =
(UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config_physical.nai.extension_addr = 0;
C++ / CLR
uds_msgconfig config_physical = {};
config_physical.can_id = PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1;
config_physical.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config_physical.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config_physical.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config_physical.type = PUDS_MSGTYPE_USDT;
config_physical.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config_physical.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config_physical.nai.extension_addr = 0;
Visual Basic
Dim config_physical As uds_msgconfig = New uds_msgconfig()
config_physical.can_id = uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1
config_physical.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD
config_physical.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config_physical.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config_physical.type = uds_msgtype.PUDS_MSGTYPE_USDT
config_physical.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config_physical.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config_physical.nai.extension_addr = 0
Pascal OO
var
config_physical: uds_msgconfig;
response_msg: uds_msg;
status: uds_status;
begin
FillChar(config_physical, sizeof(config_physical), 0);
config_physical.can_id :=
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1);
213
PCAN-UDS 2.x API – User Manual
config_physical.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config_physical.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config_physical.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config_physical.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
config_physical.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config_physical.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config_physical.nai.extension_addr := 0;
3.7.31 MsgFree_2013
Deallocates a PUDS message.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
214
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
msg_buffer An allocated uds_msg structure buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Example
The following example shows the use of the method MsgFree_2013 . Depending on the result, a message will
be shown to the user.
C#
uds_status result;
result = UDSApi.MsgFree_2013(ref msg);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Free message error", "Error");
else
MessageBox.Show("Message released", "Success");
C++ / CLR
uds_status result;
result = UDSApi::MsgFree_2013(msg);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Free message error", "Error");
else
MessageBox::Show("Message released", "Success");
Visual Basic
Dim result As uds_status
result = UDSApi.MsgFree_2013(msg)
If Not UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Free message error", "Error")
Else
MessageBox.Show("Message released", "Success")
End If
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.MsgFree_2013(msg);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Free message error', 'Error', MB_OK);
end
else
begin
MessageBox(0, 'Message released', 'Success', MB_OK);
end;
end;
215
PCAN-UDS 2.x API – User Manual
3.7.32 MsgCopy_2013
Copies a PUDS message to another buffer.
Syntax
Pascal OO
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_MsgCopy_2013")]
public static extern uds_status MsgCopy_2013(
out uds_msg msg_buffer_dst,
[In]ref uds_msg msg_buffer_src
);
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_MsgCopy_2013")]
static uds_status MsgCopy_2013(
uds_msg %msg_buffer_dst,
[In] uds_msg %msg_buffer_src
);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_MsgCopy_2013")>
Public Shared Function MsgCopy_2013(
ByRef msg_buffer_dst As uds_msg,
ByRef msg_buffer_src As uds_msg) As uds_status
End Function
Parameters
Parameter Description
msg_buffer_dst A uds_msg structure buffer to store the copied message.
msg_buffer_src The uds_msg structure to copy.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
When a message is copied, a new buffer is allocated. Once processed, user has to release the source and
the destination messages (see MsgFree_2013 on page 214).
216
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the method MsgCopy_2013 . Depending on the result, a message will
be shown to the user.
C#
C++ / CLR
Visual Basic
Pascal OO
var
destination: uds_msg;
result: uds_status;
begin
FillChar(destination, sizeof(destination), 0);
result := TUDSApi.MsgCopy_2013(destination, @source);
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Message copied', 'Success', MB_OK);
end
else
begin
MessageBox(0, 'Copy error', 'Error', MB_OK);
end;
end;
217
PCAN-UDS 2.x API – User Manual
3.7.33 MsgMove_2013
Moves a PUDS message to another buffer (and cleans the original message structure).
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_MsgMove_2013")>
Public Shared Function MsgMove_2013(
ByRef msg_buffer_dst As uds_msg,
ByRef msg_buffer_src As uds_msg) As uds_status
End Function
Parameters
Parameter Description
msg_buffer_dst A uds_msg structure buffer to store the message.
msg_buffer_src The uds_msg structure buffer used as the source (will be cleaned).
Remarks
When a message is moved, the source buffer is cleaned: once processed, user only has to release the
destination message (see MsgFree_2013 on page 214).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Example
The following example shows the use of the method MsgMove_2013 . Depending on the result, a message
will be shown to the user.
218
PCAN-UDS 2.x API – User Manual
C#
uds_msg destination = new uds_msg();
uds_status result = UDSApi.MsgMove_2013(out destination, ref source);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Move error", "Error");
else
MessageBox.Show("Message moved", "Success");
C++ / CLR
uds_msg destination = {};
uds_status result = UDSApi::MsgMove_2013(destination, source);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Move error", "Error");
else
MessageBox::Show("Message moved", "Success");
Visual Basic
Dim destination As uds_msg = New uds_msg()
Dim result As uds_status = UDSApi.MsgMove_2013(destination, source)
If UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Message moved", "Success")
Else
MessageBox.Show("Move error", "Error")
End If
Pascal OO
var
destination: uds_msg;
result: uds_status;
begin
FillChar(destination, sizeof(destination), 0);
result := TUDSApi.MsgMove_2013(destination, source);
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Message moved', 'Success', MB_OK);
end
else
begin
MessageBox(0, 'Move error', 'Error', MB_OK);
end;
end;
3.7.34 Read_2013
Reads a CAN UDS message from the receive queue of a PUDS channel.
Overloads
Method Description
Read_2013(cantp_handle, uds_msg) Reads a CAN UDS message from the receive queue of a PUDS channel.
219
PCAN-UDS 2.x API – User Manual
Read_2013(cantp_handle, uds_msg, Reads a CAN UDS response (matching the request message) from the receive
uds_msg) queue of a PUDS channel.
Read_2013(cantp_handle, uds_msg, Reads a CAN UDS response (matching the request message) and its timestamp
uds_msg, cantp_timestamp) from the receive queue of a PUDS channel.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
out_msg_buffer A uds_msg buffer to store the received message (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
220
PCAN-UDS 2.x API – User Manual
Remarks
In addition to checking uds_status code, the cantp_netstatus should be checked as it contains the network
status of the message (see field msg.msgdata.any->netstatus in uds_msg on page 21).
In case of ISO-TP message, the message type contained in the message cantp_netaddrinfo which indicates
if the message is a complete ISO-TP message (without pending message flag) should be checked too
(see field msg.msgdata.isotp->netaddrinfo in uds_msg on page 21).
The message structure is automatically allocated and initialized in Read_2013 method. So once the
message processed, the structure must be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the method Read_2013 on the channel PCANTP_HANDLE_USBBUS1 .
Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel was already initialized. This example is basic, the preferred way
to read UDS messages is Using Events (see on page 778).
C#
uds_status result;
uds_msg msg = new uds_msg();
bool stop = false;
do
{
// Read the first message in the queue
result = UDSApi.Read_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, out msg);
if (UDSApi.StatusIsOk_2013(result))
{
MessageBox.Show("A message was received", "Success");
C++ / CLR
uds_status result;
uds_msg msg = {};
bool stop = false;
do
{
// Read the first message in the queue
221
PCAN-UDS 2.x API – User Manual
result = UDSApi::MsgFree_2013(msg);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Message free error", "Error");
}
else
{
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Here can be decided if the loop has must terminated
// stop = HandleReadError(result);
}
} while (!stop);
Visual Basic
Do
result = UDSApi.MsgFree_2013(msg)
If Not UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Message free error", "Error")
End If
Else
Pascal OO
var
result: uds_status;
msg: uds_msg;
stop: bool;
begin
FillChar(msg, sizeof(msg), 0);
stop := false;
repeat
222
PCAN-UDS 2.x API – User Manual
result := TUDSApi.MsgFree_2013(msg);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Message free error', 'Error', MB_OK);
end;
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
See also: Write_2013 on page 229, uds_msg on page 21, UUDT Read/Write Example on page 776.
Plain function version: UDS_Read_2013 on page 649.
Syntax
Pascal OO
C#
C++ / CLR
223
PCAN-UDS 2.x API – User Manual
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
out_msg_buffer A uds_msg buffer to store the received message (see uds_msg on page 21).
in_msg_request Optional, request message which contains the network address information to filter in order to read the
response (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
In addition to checking uds_status code, the cantp_netstatus should be checked as it contains the network
status of the message (see field msg.msgdata.any->netstatus in uds_msg on page 21).
In case of ISO-TP message, the message type contained in the message cantp_netaddrinfo which indicates
if the message is a complete ISO-TP message (no pending message flag) should be checked too (see
field msg.msgdata.isotp->netaddrinfo in uds_msg on page 21).
The message structure is automatically allocated and initialized in Read_2013 method. So once the
message processed, the structure must be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the method Read_2013 on the channel PCANTP_HANDLE_USBBUS1 .
Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel was already initialized, and a request message has been sent.
C#
uds_status result;
uds_msg msg = new uds_msg();
bool stop = false;
do
{
// Read the first message in the queue
result = UDSApi.Read_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, out msg, ref request_msg);
if (UDSApi.StatusIsOk_2013(result))
{
MessageBox.Show("A message was received", "Success");
224
PCAN-UDS 2.x API – User Manual
}
else
{
// Here can be decided if the loop must be terminated
// stop = HandleReadError(result);
}
} while (!stop);
C++ / CLR
uds_status result;
uds_msg msg = {};
bool stop = false;
do
{
// Read the first message in the queue
result = UDSApi::Read_2013(PCANTP_HANDLE_USBBUS1, msg, request_msg);
if (UDSApi::StatusIsOk_2013(result))
{
MessageBox::Show("A message was received", "Success");
result = UDSApi::MsgFree_2013(msg);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Message free error", "Error");
}
else
{
// Here can be decided if the loop has must terminated
// stop = HandleReadError(result);
}
} while (!stop);
Visual Basic
Dim result As uds_status
Dim msg As uds_msg = New uds_msg()
Dim stop_loop As Boolean = False
Do
Pascal OO
var
result: uds_status;
msg: uds_msg;
225
PCAN-UDS 2.x API – User Manual
stop_loop: bool;
begin
FillChar(msg, sizeof(msg), 0);
stop_loop := false;
repeat
// Read the first message in the queue
result := TUDSApi.Read_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, msg,
@request_msg);
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'A message was received', 'Success', MB_OK);
result := TUDSApi.MsgFree_2013(msg);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Message free error', 'Error', MB_OK);
end;
end
else
begin
// Here can be decided if the loop has must terminated
// stop_loop := HandleReadError(result);
end;
until stop_loop;
end;
See also: Write_2013 on page 229, uds_msg on page 21, UUDT Read/Write Example on page 776.
Plain function version: UDS_Read_2013 on page 649.
Syntax
Pascal OO
C#
C++ / CLR
226
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_Read_2013")>
Public Shared Function Read_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef out_msg_buffer As uds_msg,
ByRef in_msg_request As uds_msg,
ByRef out_timestamp As cantp_timestamp) As uds_status
End Function
Parameters
Parameter Description
Channel The handle of a PUDS channel (see cantp_handle on page 105).
out_msg_buffer A uds_msg buffer to store the received message (see uds_msg on page 21).
in_msg_request Optional, request message which contains the network address information to filter in order to read the
response (see uds_msg on page 21).
out_timestamp A cantp_timestamp structure buffer to get the reception time of the message. If this value is not desired,
this parameter should be passed as NULL (see cantp_timestamp on page 104).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
In addition to checking uds_status code, the cantp_netstatus should be checked as it contains the network
status of the message (see field msg.msgdata.any->netstatus in uds_msg on page 21).
In case of ISO-TP message, the message type contained in the message cantp_netaddrinfo which indicates
if the message is a complete ISO-TP message (no pending message flag) should be checked too (see
field msg.msgdata.isotp->netaddrinfo in uds_msg on page 21).
Specifying the value of NULL for the parameter out_timestamp causes reading a message without
timestamp when the reception time is not desired.
The message structure is automatically allocated and initialized in Read_2013 method. So once the
message processed, the structure must be uninitialized (see MsgFree_2013 on page 214).
Example
The following example shows the use of the method Read_2013 on the channel PCANTP_HANDLE_USBBUS1 .
Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel was already initialized, and a request message has been sent.
C#
227
PCAN-UDS 2.x API – User Manual
uds_status result;
uds_msg msg = new uds_msg();
bool stop = false;
cantp_timestamp timestamp;
do
{
// Read the first message in the queue
C++ / CLR
uds_status result;
uds_msg msg = {};
bool stop = false;
cantp_timestamp timestamp;
do
{
// Read the first message in the queue
Visual Basic
228
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
msg: uds_msg;
stop_loop: bool;
timestamp: cantp_timestamp;
begin
FillChar(msg, sizeof(msg), 0);
stop_loop := false;
repeat
See also: Write_2013 on page 229, uds_msg on page 21, UUDT Read/Write Example on page 776.
Plain function version: UDS_Read_2013 on page 649.
3.7.38 Write_2013
Transmits a PUDS message using a connected PUDS channel.
Syntax
Pascal OO
C#
229
PCAN-UDS 2.x API – User Manual
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
ref uds_msg msg_buffer);
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_Write_2013")>
Public Shared Function Write_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef msg_buffer As uds_msg) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_buffer A uds_msg containing the message to be sent (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The message is not a valid PUDS message.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the reception
queue, the user must read a response for his previous request before or clear the
reception queues with Reset_2013 (see Reset_2013 on page 234).
PUDS_STATUS_PARAM_INVALID_TYPE The message type is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping is unknown.
Remarks
The Write_2013 method does not actually send the UDS message, the transmission is asynchronous. Should
a message fail to be transmitted, it will be added to the reception queue with a specific network error code
in the msg.msgdata.isotp->netaddrinfo field of the uds_msg .
Note: To transmit a standard UDS service request, it is recommended to use the corresponding API
Service method starting with Svc (like SvcDiagnosticSessionControl_2013 ).
Example
The following example shows the use of the method Write_2013 on the channel PCANTP_HANDLE_USBBUS1 . It
adds to the transmit queue a UDS request then waits until a confirmation message is received. Depending
on the result, a message will be shown to the user.
Note: It is assumed that the channel was already initialized, mapping, message configuration and
receive event were configured, the content of the data field is not initialized in the example.
C#
230
PCAN-UDS 2.x API – User Manual
uds_status result;
uds_msg request_msg = new uds_msg();
uds_msg loopback_msg = new uds_msg();
bool wait_result;
C++ / CLR
uds_status result;
uds_msg request_msg = {};
uds_msg loopback_msg = {};
bool wait_result;
231
PCAN-UDS 2.x API – User Manual
wait_result = receive_event.WaitOne(5000);
if (wait_result)
{
result = UDSApi::Read_2013(PCANTP_HANDLE_USBBUS1, loopback_msg);
if (UDSApi::StatusIsOk_2013(result))
{
MessageBox::Show(String::Format(
"Read = {0}, type={1}, netstatus={2}", (int)result,
(int)loopback_msg.type,
(int)loopback_msg.msg.msgdata.any->netstatus), "Read");
UDSApi::MsgFree_2013(loopback_msg);
}
else
{
MessageBox::Show(String::Format("Read error: {0}", (int)result),
"Error");
}
}
UDSApi::MsgFree_2013(request_msg);
}
else
{
MessageBox::Show(String::Format("Write error: {0}", (int)result), "Error");
}
}
Visual Basic
Pascal OO
232
PCAN-UDS 2.x API – User Manual
var
result: uds_status;
request_msg: uds_msg;
loopback_msg: uds_msg;
wait_result: UInt32;
begin
FillChar(request_msg, sizeof(request_msg), 0);
FillChar(loopback_msg, sizeof(loopback_msg), 0);
See also: Read_2013 on page 219, UUDT Read/Write Example on page 776.
Plain function version: UDS_Write_2013 on page 650.
233
PCAN-UDS 2.x API – User Manual
3.7.39 Reset_2013
Resets the receive and transmit queues of a PUDS channel.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_Reset_2013")>
Public Shared Function Reset_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized channels of the
calling application.
Remarks
Calling this method ONLY clear the queues of a channel. A reset of the CAN controller does not take place.
Example
The following example shows the use of the method Reset_2013 on the channel PCANTP_HANDLE_PCIBUS1 .
Depending on the result, a message will be shown to the user.
234
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
result = UDSApi.Reset_2013(cantp_handle.PCANTP_HANDLE_PCIBUS1);
if (!UDSApi.StatusIsOk_2013(result))
MessageBox.Show("An error occurred", "Error");
else
MessageBox.Show("PCAN-PCI (Ch-1) was reset", "Success");
C++ / CLR
uds_status result;
result = UDSApi::Reset_2013(PCANTP_HANDLE_PCIBUS1);
if (!UDSApi::StatusIsOk_2013(result))
MessageBox::Show("An error occurred", "Error");
else
MessageBox::Show("PCAN-PCI (Ch-1) was reset", "Success");
Visual Basic
result = UDSApi.Reset_2013(cantp_handle.PCANTP_HANDLE_PCIBUS1)
If Not UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("An error occurred", "Error")
Else
MessageBox.Show("PCAN-PCI (Ch-1) was reset", "Success")
End If
Pascal OO
var
result: uds_status;
begin
result := TUDSApi.Reset_2013(cantp_handle.PCANTP_HANDLE_PCIBUS1);
if not TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end
else
begin
MessageBox(0, 'PCAN-PCI (Ch-1) was reset', 'Success', MB_OK);
end;
end;
3.7.40 WaitForSingleMessage_2013
Waits for a message (a response or a transmit confirmation) based on a PUDS message request.
Syntax
Pascal OO
235
PCAN-UDS 2.x API – User Manual
is_waiting_for_tx: Boolean;
timeout: UInt32;
timeout_enhanced: UInt32;
var out_msg_response: uds_msg
): uds_status;
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_WaitForSingleMessage_2013")>
Public Shared Function WaitForSingleMessage_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal is_waiting_for_tx As Boolean,
ByVal timeout As UInt32,
ByVal timeout_enhanced As UInt32,
ByRef out_msg_response As uds_msg) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A uds_msg buffer containing the PUDS message request that was previously sent (see uds_msg on
page 21).
is_waiting_for_tx States whether the message to wait for is a transmit confirmation or not.
timeout Maximum time to wait (in milliseconds) for a message indication corresponding to the message
request. Note: A zero value means unlimited time.
timeout_enhanced Maximum time to wait (in milliseconds) for a message to be complete if server (ECU) ask more time.
out_msg_response A uds_msg buffer to store the PUDS response message (see uds_msg on page 21).
236
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION Timeout while waiting for request confirmation (request message
loopback).
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE Timeout while waiting for response message.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
The criteria to identify if a response matches the message request is based only on the network addressing
information and the UDS service identifier: if the same service is requested multiple times with different
parameters (like service ReadDataByIdentifier with different Data IDs), the user will have to ensure that the
extra content matches the original request.
The timeout parameter is ignored once a message indication matching the request is received (i.e. the first
frame of the message), the timeout enhanced is then used.
The parameters of WaitFor*_2013 methods have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the method WaitForSingleMessage_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It writes a UDS message on the CAN Bus and waits for the confirmation of the
transmission. Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel and the mapping were already initialized.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg confirmation = new uds_msg();
// Prepare an 11bit CAN ID, physically addressed UDS message containing 4 Bytes of data
uds_msgconfig config = new uds_msgconfig();
config.can_id = (UInt16)uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1;
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
237
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
{
// Wait for the transmit confirmation
result = UDSApi.WaitForSingleMessage_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref
request, true, 10, 100, out confirmation);
if (UDSApi.StatusIsOk_2013(result))
{
MessageBox.Show("Message was transmitted.", "Success");
UDSApi.MsgFree_2013(ref confirmation);
}
else
{
// An error occurred
MessageBox.Show("Error occurred while waiting for transmit confirmation.",
"Error");
}
UDSApi.MsgFree_2013(ref request);
}
else
{
// An error occurred
MessageBox.Show("An error occurred", "Error");
}
}
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg confirmation = {};
// Prepare an 11bit CAN ID, physically addressed UDS message containing 4 Bytes of data
uds_msgconfig config = {};
config.can_id = PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
238
PCAN-UDS 2.x API – User Manual
{
// An error occurred
MessageBox::Show("Error occurred while waiting for transmit confirmation.",
"Error");
}
UDSApi::MsgFree_2013(request);
}
else
{
// An error occurred
MessageBox::Show("An error occurred", "Error");
}
}
Visual Basic
' Prepare an 11bit CAN ID, physically addressed UDS message containing 4 Bytes of data
Dim config As uds_msgconfig = New uds_msgconfig()
config.can_id = uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD
config.nai.extension_addr = 0
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
confirmation: uds_msg;
config: uds_msgconfig;
239
PCAN-UDS 2.x API – User Manual
begin
FillChar(request, sizeof(request), 0);
FillChar(confirmation, sizeof(confirmation), 0);
// Prepare an 11bit CAN ID, physically addressed UDS message containing 4 Bytes of data
FillChar(config, sizeof(config), 0);
config.can_id :=
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1);
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := 0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
240
PCAN-UDS 2.x API – User Manual
3.7.41 WaitForFunctionalResponses_2013
Waits for multiple messages (multiple responses from a functional request for instance) based on a PUDS
message request.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_WaitForFunctionalResponses_2013")>
Public Shared Function WaitForFunctionalResponses_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef msg_request As uds_msg,
ByVal timeout As UInt32,
ByVal timeout_enhanced As UInt32,
241
PCAN-UDS 2.x API – User Manual
<MarshalAs(UnmanagedType.U1)>
ByVal wait_until_timeout As Boolean,
ByVal max_msg_count As UInt32,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
<Out> ByVal out_msg_responses As uds_msg(),
ByRef out_msg_count As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A uds_msg containing the PUDS message request that was previously sent (see uds_msg on page
21).
timeout Maximum time to wait (in milliseconds) for a message indication corresponding to the message
request. Note: A zero value means unlimited time.
timeout_enhanced Maximum time to wait (in milliseconds) for a message to be complete if server/ECU ask more time.
wait_until_timeout If false the method is interrupted if out_msg_count reaches max_msg_count.
max_msg_count Size of the responses buffer array (maximum messages that can be received).
out_msg_responses A uds_msg buffer array to store the PUDS response message (see uds_msg on page 21).
out_msg_count Output, number of read messages.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_NO_MESSAGE Indicates that no matching message was received in the given time.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_SERVICE_RX_OVERFLOW Service received more messages than input buffer expected.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the
buffer before reusing it (see MsgFree_2013 on page 214).
Remarks
The criteria to identify if a response matches the message request is based only on the network addressing
information and the UDS service identifier: if the same service is requested multiple times with different
parameters (like service ReadDataByIdentifier with different data identifiers), the user will have to ensure
that the extra content matches the original request.
The timeout parameter is ignored once a message indication matching the request is received (i.e. the first
frame of the message), the timeout enhanced is then used.
The parameters of WaitFor*_2013 methods have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the method WaitForFunctionalResponses_2013 on the channel
PCANTP_HANDLE_ USBBUS1 . It writes a PUDS functional request on the CAN Bus, waits for the confirmation of
the transmission, and then waits to receive responses from ECUs until a timeout occurs. Depending on the
result, a message will be shown to the user.
242
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg confirmation = new uds_msg();
UInt32 response_array_length = 5;
uds_msg[] response_array = new uds_msg[5];
UInt32 count;
243
PCAN-UDS 2.x API – User Manual
UDSApi.MsgFree_2013(ref request);
}
else
{
// An error occurred
MessageBox.Show("An error occurred", "Error");
}
}
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg confirmation = {};
UInt32 response_array_length = 5;
array<uds_msg>^ response_array = gcnew array<uds_msg>(5);
UInt32 count;
244
PCAN-UDS 2.x API – User Manual
Visual Basic
245
PCAN-UDS 2.x API – User Manual
UDSApi.MsgFree_2013(response_array(i))
Next
Else
MessageBox.Show("No response was received", "Error")
End If
UDSApi.MsgFree_2013(confirmation)
Else
' An error occurred
MessageBox.Show("Error occurred while waiting for transmit confirmation.", "Error")
End If
UDSApi.MsgFree_2013(request)
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
confirmation: uds_msg;
response_array_length: UInt32;
response_array: array [0 .. 4] of uds_msg;
count: UInt32;
config: uds_msgconfig;
i: UInt32;
begin
response_array_length := 5;
FillChar(request, sizeof(request), 0);
FillChar(confirmation, sizeof(confirmation), 0);
FillChar(response_array, sizeof(uds_msg) * response_array_length, 0);
246
PCAN-UDS 2.x API – User Manual
begin
See also: uds_msg on page 21, WaitForSingleMessage_2013 on page 235, WaitForService_2013 on page 248,
WaitForServiceFunctional_2013 on page 252.
Plain function version: UDS_WaitForFunctionalResponses_2013 on page 655.
247
PCAN-UDS 2.x API – User Manual
3.7.42 WaitForService_2013
Handles the communication workflow for a UDS service expecting a single response. The method waits
for a transmit confirmation then for a message response. Even if the
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is set, the method will still wait.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_WaitForService_2013")>
Public Shared Function WaitForService_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef msg_request As uds_msg,
ByRef out_msg_response As uds_msg,
ByRef out_msg_request_confirmation As uds_msg) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A uds_msg containing the PUDS request message that was previously sent (see
uds_msg on page 21).
out_msg_response A uds_msg buffer to store the PUDS response message (see uds_msg on page 21).
out_msg_request_confirmation A uds_msg buffer to store the PUDS request confirmation message also known as
loopback message (see uds_msg on page 21).
248
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION Timeout while waiting for request confirmation (request message
loopback).
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE Timeout while waiting for response message.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_NO_MESSAGE Indicates that no matching message was received in the given time.
PUDS_STATUS_NETWORK_ERROR A network error occurred.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
The WaitForService_2013 method is a utility method that calls other PCAN-UDS 2.x API methods to simplify
UDS communication workflow
1. The method gets the defined timeouts (global API request and response timeouts and timeouts
defined by the current session information with the ECU),
2. Waits for the confirmation of request’s transmission,
3. On success, waits for the response.
4. If a negative response code is received stating that the ECU requires extended timing
( PUDS_NRC_EXTENDED_TIMING , 0x78), the method switches to the enhanced timeout (enhanced
P2CAN server max timeout, see uds_sessioninfo on page 22) and waits for another response.
5. Fill the output message with response data.
Even if the PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is set in the PUDS request, the method will still
wait for an eventual Negative Response. If no error message is received the method will return
PUDS_STATUS_NO_MESSAGE , although in this case it must not be considered as an error. Moreover, if a
negative response code PUDS_NRC_EXTENDED_TIMING is received the
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is ignored as stated in ISO-14229-1.
The parameters of WaitFor*_2013 methods have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the method WaitForService_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted (service ECUReset), and the
WaitForService_2013 method is called to get the response. Depending on the result, a message will be shown
to the user.
Note: It is assumed that the channel and the mapping were already initialized.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
config.can_id = (UInt16)uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1;
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
249
PCAN-UDS 2.x API – User Manual
config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response {};
uds_msgconfig config = {};
config.can_id = PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
250
PCAN-UDS 2.x API – User Manual
}
UDSApi::MsgFree_2013(request);
}
else
{
MessageBox::Show("An error occurred, while sending the request.", "Error");
}
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
config.can_id = uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD
config.nai.extension_addr = &H0
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
FillChar(config, sizeof(config), 0);
config.can_id :=
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1);
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
251
PCAN-UDS 2.x API – User Manual
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
3.7.43 WaitForServiceFunctional_2013
Handles the communication workflow for a UDS service requested with functional addressing, i.e. multiple
responses can be expected. The method waits for a transmit confirmation then for responses.
Syntax
Pascal OO
C#
252
PCAN-UDS 2.x API – User Manual
cantp_handle channel,
ref uds_msg msg_request,
UInt32 max_msg_count,
[MarshalAs(UnmanagedType.U1)]
bool wait_until_timeout,
[MarshalAs(UnmanagedType.LPArray,SizeParamIndex=2)]
[Out] uds_msg[] out_msg_responses,
out UInt32 out_msg_count,
out uds_msg out_msg_request_confirmation);
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_WaitForServiceFunctional_2013")>
Public Shared Function WaitForServiceFunctional_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByRef msg_request As uds_msg,
ByVal max_msg_count As UInt32,
<MarshalAs(UnmanagedType.U1)>
ByVal wait_until_timeout As Boolean,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=2)>
<Out> ByVal out_msg_responses As uds_msg(),
ByRef out_msg_count As UInt32) As uds_status,
ByRef out_msg_request_confirmation As uds_msg
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A uds_msg containing the PUDS request message that was previously sent (see uds_msg on page
21).
max_msg_count Size of the responses buffer array (maximum messages that can be received).
wait_until_timeout If false, the method is interrupted if out_msg_count reaches max_msg_count.
out_msg_responses A uds_msg buffer array to store the PUDS response message (see uds_msg on page 21).
out_msg_count Output, number of read messages.
out_msg_request_confirmation A uds_msg buffer to store the PUDS request confirmation message also known as loopback
message (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
253
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_OVERFLOW Output responses buffer is too small.
PUDS_STATUS_SERVICE_TX_ERROR An error occurred while transmitting the request.
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION Timeout while waiting for request confirmation (request message
loopback).
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_NO_MESSAGE Indicates that no matching message was received in the given time.
PUDS_STATUS_NETWORK_ERROR A network error occurred.
PUDS_STATUS_SERVICE_RX_OVERFLOW Service received more messages than input buffer expected.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
The WaitForServiceFunctional_2013 method is a utility function that calls other PCAN-UDS 2.x API methods to
simplify UDS communication workflow when requests involve functional addressing:
1. The method gets the defined timeouts (global API request and response timeouts and timeouts
defined by the current session information with the ECU),
2. Waits for the confirmation of request’s transmission,
3. On success, it waits for the responses.
4. The method fills the output messages array with received responses.
The parameters of WaitFor*_2013 methods have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the method WaitForServiceFunctional_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS functional service request is transmitted (service ECUReset), and the
WaitForServiceFunctional_2013 method is called to get the responses. Depending on the result, a message will
be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
UInt32 response_array_length = 5;
uds_msg[] response_array = new uds_msg[5];
UInt32 count = 0;
uds_msgconfig config = new uds_msgconfig();
254
PCAN-UDS 2.x API – User Manual
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
UInt32 response_array_length = 5;
array<uds_msg>^ response_array = gcnew array<uds_msg>(5);
UInt32 count = 0;
uds_msgconfig config = {};
255
PCAN-UDS 2.x API – User Manual
{
if (count > 0)
{
MessageBox::Show("Responses were received", "Success");
for (int i = 0; i < count; i++)
{
UDSApi::MsgFree_2013(response_array[i]);
}
}
else
{
MessageBox::Show("No response was received", "Error");
}
UDSApi::MsgFree_2013(request_confirmation);
}
else
{
MessageBox::Show("An error occurred", "Error");
}
UDSApi::MsgFree_2013(request);
}
else
{
MessageBox::Show("An error occurred, while sending the request.", "Error");
}
Visual Basic
256
PCAN-UDS 2.x API – User Manual
Else
MessageBox.Show("An error occurred", "Error")
End If
UDSApi.MsgFree_2013(request)
Else
MessageBox.Show("An error occurred, while sending the request.", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response_array_length: UInt32;
response_array: array [0 .. 4] of uds_msg;
count: UInt32;
config: uds_msgconfig;
i: UInt32;
begin
response_array_length := 5;
count := 0;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response_array, sizeof(uds_msg) * response_array_length, 0);
257
PCAN-UDS 2.x API – User Manual
3.7.44 SvcDiagnosticSessionControl_2013
Writes a UDS request according to the DiagnosticSessionControl service’s specifications. The
DiagnosticSessionControl service is used to enable different diagnostic sessions in the server.
Syntax
Pascal OO
C#
C++ / CLR
258
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcDiagnosticSessionControl_2013")>
Public Shared Function SvcDiagnosticSessionControl_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal session_type As uds_svc_param_dsc) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
session_type Subfunction parameter: type of the session (see uds_svc_param_dsc on page 71).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcDiagnosticSessionControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
259
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
260
PCAN-UDS 2.x API – User Manual
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
261
PCAN-UDS 2.x API – User Manual
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.45 SvcECUReset_2013
Writes a UDS request according to the ECUReset service’s specifications. The ECUReset service is used by
the client to request a server (ECU) reset.
Syntax
Pascal OO
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcECUReset_2013")]
public static extern uds_status SvcECUReset_2013(
[MarshalAs(UnmanagedType.U4)]
262
PCAN-UDS 2.x API – User Manual
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request,
[MarshalAs(UnmanagedType.U1)]
uds_svc_param_er reset_type);
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcECUReset_2013")]
static uds_status SvcECUReset_2013(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request,
[MarshalAs(UnmanagedType::U1)]
uds_svc_param_er reset_type);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcECUReset_2013")>
Public Shared Function SvcECUReset_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal reset_type As uds_svc_param_er) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
reset_type Subfunction parameter: type of reset (see uds_svc_param_er on page 72).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
263
PCAN-UDS 2.x API – User Manual
After receiving a positive response to UDS request ECUReset with the help of function
UDS_WaitForService_2013 , the API will revert the session information of that ECU to the default diagnostic
session.
Example
The following example shows the use of the service method SvcECUReset_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
264
PCAN-UDS 2.x API – User Manual
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
265
PCAN-UDS 2.x API – User Manual
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
266
PCAN-UDS 2.x API – User Manual
3.7.46 SvcSecurityAccess_2013
Writes a UDS request according to the SecurityAccess service’s specifications. SecurityAccess service
provides a mean to access data and/or diagnostic services which have restricted access for security,
emissions, or safety reasons.
Overloads
Method Description
SvcSecurityAccess_2013(cantp_handle, Writes to the transmit queue a request for UDS service SecurityAccess.
uds_msgconfig, uds_msg, Byte) Without optional data.
SvcSecurityAccess_2013(cantp_handle, Writes to the transmit queue a request for UDS service SecurityAccess.
uds_msgconfig, uds_msg, Byte, Byte[], UInt32)
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
267
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
security_access_type Subfunction parameter: type of SecurityAccess (see SecurityAccess Type Definitions on page
766).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcSecurityAccess_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
268
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request, out
response, out request_confirmation);
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
269
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
270
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, SecurityAccess Type Definitions on page 766.
Plain function version: UDS_SvcSecurityAccess_2013 on page 665.
Syntax
Pascal OO
C#
C++ / CLR
271
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcSecurityAccess_2013")>
Public Shared Function SvcSecurityAccess_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal security_access_type As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal security_access_data As Byte(),
ByVal security_access_data_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
Channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
security_access_type Subfunction parameter: type of SecurityAccess (see SecurityAccess Type Definitions on page 766)
security_access_data If Requesting Seed, buffer is the optional data to transmit to a server/ECU (like identification). If
Sending Key, data holds the value generated by the security algorithm corresponding to a specific
“seed” value.
security_access_data_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
272
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcSecurityAccess_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
273
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
data: array [0 .. 0] of Byte;
request: uds_msg;
274
PCAN-UDS 2.x API – User Manual
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, SecurityAccess Type Definitions on page 766.
Plain function version: UDS_SvcSecurityAccess_2013 on page 665.
275
PCAN-UDS 2.x API – User Manual
3.7.49 SvcCommunicationControl_2013
Writes a UDS request according to the CommunicationControl service’s specifications.
CommunicationControl service's purpose is to switch on/off the transmission and/or the reception of
certain messages of (a) server(s)/ECU(s).
Overloads
Method Description
SvcCommunicationControl_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_cc, CommunicationControl.
Byte)
SvcCommunicationControl_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_cc, CommunicationControl with node identification number optional data.
Byte, UInt16)
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
276
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
control_type Subfunction parameter: type of CommunicationControl (see uds_svc_param_cc on page 74).
communication_type A bit-code value to reference the kind of communication to be controlled (see
CommunicationControl Communication Type Definitions on page 767).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcCommunicationControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
277
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
278
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
279
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, CommunicationControl Communication Type Definitions on page
767.
Plain function version: UDS_SvcCommunicationControl_2013 on page 667.
Syntax
Pascal OO
C#
280
PCAN-UDS 2.x API – User Manual
uds_msgconfig request_config,
out uds_msg out_msg_request,
[MarshalAs(UnmanagedType.U1)]
uds_svc_param_cc control_type,
Byte communication_type,
UInt16 node_identification_number);
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcCommunicationControl_2013")>
Public Shared Function SvcCommunicationControl_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal control_type As uds_svc_param_cc,
ByVal communication_type As Byte,
ByVal node_identification_number As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
control_type Subfunction parameter: type of CommunicationControl (see uds_svc_param_cc on page 74).
communication_type A bit-code value to reference the kind of communication to be controlled (see CommunicationControl
Communication Type Definitions on page 767).
node_identification_number A two bytes value, identify a node on a sub-network, only used with
PUDS_SVC_PARAM_CC_ERXDTXWEAI or PUDS_SVC_PARAM_CC_ERXTXWEAI control type).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
281
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcCommunicationControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
282
PCAN-UDS 2.x API – User Manual
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
283
PCAN-UDS 2.x API – User Manual
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
284
PCAN-UDS 2.x API – User Manual
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, CommunicationControl Communication Type Definitions on page
767.
Plain function version: UDS_SvcCommunicationControl_2013 on page 667.
3.7.52 SvcTesterPresent_2013
Writes a UDS request according to the TesterPresent service’s specifications. TesterPresent service
indicates to the server(s)/ECU(s) that a client is still connected to the vehicle and that certain diagnostic
services and/or communications that have been previously activated are to remain active.
Overloads
Method Description
SvcTesterPresent_2013(cantp_handle, Writes to the transmit queue a request for UDS service TesterPresent
uds_msgconfig, uds_msg) (with zero subfunction parameter).
SvcTesterPresent_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_tp) TesterPresent.
Syntax
Pascal OO
C#
C++ / CLR
285
PCAN-UDS 2.x API – User Manual
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcTesterPresent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
286
PCAN-UDS 2.x API – User Manual
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
287
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
288
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
289
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcTesterPresent_2013")>
Public Shared Function SvcTesterPresent_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal testerpresent_type As uds_svc_param_tp) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
testerpresent_type Tester present type, no Subfunction parameter by default (see uds_svc_param_tp on page 75).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
290
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcTesterPresent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
291
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
292
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.55 SvcSecuredDataTransmission_2013
Writes a UDS request according to the SecuredDataTransmission service’s specifications(ISO-14229-
1:2013). SecuredDataTransmission service's purpose is to transmit data that are protected against attacks
from third parties, which could endanger data security.
Syntax
Pascal OO
293
PCAN-UDS 2.x API – User Manual
security_data_request_record: PByte;
security_data_request_record_size: UInt32
): uds_status;
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcSecuredDataTransmission_2013")>
Public Shared Function SvcSecuredDataTransmission_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal security_data_request_record As Byte(),
ByVal security_data_request_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
security_data_request_record Buffer containing the data as processed by the Security Sub-Layer (See ISO-15764).
security_data_request_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
294
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
When using SecuredDataTransmission service, user may need to construct a security_data_request_record that
is equal to another UDS service request definition. That is why UDS_Svc* functions can be called with
PUDS_ONLY_PREPARE_REQUEST as channel identifier (instead of using cantp_handle ): it prepares the uds_msg
structure without sending it.
Example
The following example shows the use of the service method SvcSecuredDataTransmission_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
295
PCAN-UDS 2.x API – User Manual
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
296
PCAN-UDS 2.x API – User Manual
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
buffer: array [0 .. 3] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
buffer[0] := $F0;
buffer[1] := $A1;
buffer[2] := $B2;
buffer[3] := $C3;
297
PCAN-UDS 2.x API – User Manual
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.56 SvcSecuredDataTransmission_2020
Writes a UDS request according to the SecuredDataTransmission service’s specifications (ISO-14229-
1:2020). SecuredDataTransmission service's purpose is to transmit data that are protected against attacks
from third parties, which could endanger data security.
Syntax
Pascal OO
C#
298
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcSecuredDataTransmission_2020")>
Public Shared Function SvcSecuredDataTransmission_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal administrative_parameter As UInt16,
ByVal signature_encryption_calculation As Byte,
ByVal anti_replay_counter As UInt16,
ByVal internal_service_identifier As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal service_specific_parameters As Byte(),
ByVal service_specific_parameters_size As UInt32,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=10)>
ByVal signature_mac As Byte(),
ByVal signature_size As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
administrative_parameter Security features used in the message (see SecuredDataTransmission Administrative
Parameter Flags Definitions on page 768)
signature_encryption_calculation Signature or encryption algorithm identifier.
anti_replay_counter Anti-replay counter value.
internal_service_identifier Internal message service request identifier (see uds_service on page 53).
service_specific_parameters Buffer that contains internal message service request data.
service_specific_parameters_size Internal message service request data size (in bytes).
signature_mac Buffer that contains signature used to verify the message.
signature_size Size in bytes of the signature.
299
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
When using SecuredDataTransmission service, user may need to construct a security_data_request_record that
is equal to another UDS service request definition. That is why UDS_Svc* functions can be called with
PUDS_ONLY_PREPARE_REQUEST as channel identifier (instead of using cantp_handle ): it prepares the uds_msg
structure without sending it.
Example
The following example shows the use of the service method SvcSecuredDataTransmission_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
UInt16 administrative_parameter;
Byte signature_encryption_calculation;
UInt16 anti_replay_counter;
Byte internal_service_identifier;
Byte[] service_specific_parameters = new Byte[4];
UInt32 service_specific_parameters_size;
Byte[] signature_mac = new Byte[6];
UInt16 signature_size;
300
PCAN-UDS 2.x API – User Manual
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
UInt16 administrative_parameter;
Byte signature_encryption_calculation;
UInt16 anti_replay_counter;
Byte internal_service_identifier;
array<Byte>^ service_specific_parameters = gcnew array<Byte>(4);
UInt32 service_specific_parameters_size;
array<Byte>^ signature_mac = gcnew array<Byte>(6);
UInt16 signature_size;
301
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = (UInt16)uds_address::PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing::PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype::PUDS_MSGTYPE_USDT;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
Dim administrative_parameter As UInt16
Dim signature_encryption_calculation As Byte
Dim anti_replay_counter As UInt16
Dim internal_service_identifier As Byte
Dim service_specific_parameters() As Byte = New Byte(4) {}
Dim service_specific_parameters_size As UInt32
Dim signature_mac() As Byte = New Byte(6) {}
Dim signature_size As UInt16
302
PCAN-UDS 2.x API – User Manual
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
administrative_parameter: UInt16;
signature_encryption_calculation: Byte;
anti_replay_counter: UInt16;
internal_service_identifier: Byte;
service_specific_parameters: array [0 .. 3] of Byte;
service_specific_parameters_size: UInt32;
signature_mac: array [0 .. 5] of Byte;
signature_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
303
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(&request);
TUDSApi.MsgFree_2013(&response);
TUDSApi.MsgFree_2013(&request_confirmation);
end;
304
PCAN-UDS 2.x API – User Manual
3.7.57 SvcControlDTCSetting_2013
Writes a UDS request according to the ControlDTCSetting service’s specifications. ControlDTCSetting
service shall be used by a client to stop or resume the setting of diagnostic trouble codes (DTCs) in the
server(s)/ECU(s).
Overloads
Method Description
SvcControlDTCSetting_2013(cantp_handle, uds_msgconfig, Writes to the transmit queue a request for UDS service
uds_msg, uds_svc_param_cdtcs) ControlDTCSetting, without DTC settings control
options.
SvcControlDTCSetting_2013(cantp_handle, uds_msgconfig, Writes to the transmit queue a request for UDS service
uds_msg, uds_svc_param_cdtcs, Byte[], UInt32) ControlDTCSetting.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
305
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_setting_type Subfunction parameter (see uds_svc_param_cdtcs on page 76).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcControlDTCSetting_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
306
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request, out
response, out request_confirmation);
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
307
PCAN-UDS 2.x API – User Manual
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
308
PCAN-UDS 2.x API – User Manual
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
C++ / CLR
309
PCAN-UDS 2.x API – User Manual
[MarshalAs(UnmanagedType::U1)]
uds_svc_param_cdtcs dtc_setting_type,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 5)]
array<Byte> ^dtc_setting_control_option_record,
UInt32 dtc_setting_control_option_record_size);
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_setting_type Subfunction parameter (see uds_svc_param_cdtcs on page 76).
dtc_setting_control_option_record This parameter record is user-optional and transmits data to a server (ECU) when
controlling the DTC setting. It can contain a list of DTCs to be turned on or off.
dtc_setting_control_option_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
310
PCAN-UDS 2.x API – User Manual
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcControlDTCSetting_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
311
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
312
PCAN-UDS 2.x API – User Manual
UDSApi.MsgFree_2013(request)
UDSApi.MsgFree_2013(response)
UDSApi.MsgFree_2013(request_confirmation)
Pascal OO
var
result: uds_status;
buffer: array [0 .. 3] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
buffer[0] := $F0;
buffer[1] := $A1;
buffer[2] := $B2;
buffer[3] := $C3;
// Free structures
TUDSApi.MsgFree_2013(request);
313
PCAN-UDS 2.x API – User Manual
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.60 SvcResponseOnEvent_2013
Writes a UDS request according to the ResponseOnEvent service’s specifications. The ResponseOnEvent
service requests a server (ECU) to start or stop the transmission of responses on a specified event.
Overloads
Method Description
SvcResponseOnEvent_2013(cantp_handle, uds_msgconfig, Writes to the transmit queue a request for UDS service
uds_msg, uds_svc_param_roe, bool, byte) ResponseOnEvent, without service to respond to record
and event type record.
SvcResponseOnEvent_2013(cantp_handle, uds_msgconfig, Writes to the transmit queue a request for UDS service
uds_msg, uds_svc_param_roe, bool, byte, byte[], UInt32) ResponseOnEvent.
SvcResponseOnEvent_2013(cantp_handle, uds_msgconfig, Writes to the transmit queue a request for UDS service
uds_msg, uds_svc_param_roe, bool, byte, byte[], UInt32, ResponseOnEvent.
byte[], UInt32)
Syntax
Pascal OO
C#
314
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
event_type Subfunction parameter: event type (see uds_svc_param_roe on page 77).
store_event Storage State (true to store event, false to do not store event).
event_window_time Specify a window for the event logic to be active in the server/ECU (see ResponseOnEvent
Service Definitions on page 767).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
315
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcResponseOnEvent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
316
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
317
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, ResponseOnEvent Service Definitions on page 767.
Plain function version: UDS_SvcResponseOnEvent_2013 on page 678.
Syntax
Pascal OO
318
PCAN-UDS 2.x API – User Manual
event_type: uds_svc_param_roe;
store_event: Boolean;
event_window_time: Byte;
event_type_record: PByte;
event_type_record_size: UInt32
): uds_status; overload;
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
event_type Subfunction parameter: event type (see uds_svc_param_roe on page 77).
store_event Storage State (true to store event, false to do not store event).
event_window_time Specify a window for the event logic to be active in the server/ECU (see ResponseOnEvent
Service Definitions on page 767).
event_type_record Additional parameters for the specified event type.
event_type_record_size Size in bytes of the event type Record (see ResponseOnEvent Service Definitions on page
767).
319
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcResponseOnEvent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
320
PCAN-UDS 2.x API – User Manual
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
321
PCAN-UDS 2.x API – User Manual
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
event_type_record: array [0 .. 1] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
322
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, ResponseOnEvent Service Definitions on page 767.
Plain function version: UDS_SvcResponseOnEvent_2013 on page 678.
Syntax
Pascal OO
C#
323
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcResponseOnEvent_2013")>
Public Shared Function SvcResponseOnEvent_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal event_type As uds_svc_param_roe,
<MarshalAs(UnmanagedType.I1)>
ByVal store_event As Boolean,
ByVal event_window_time As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal event_type_record As Byte(),
ByVal event_type_record_size As UInt32,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=9)>
ByVal service_to_respond_to_record As Byte(),
ByVal service_to_respond_to_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
event_type Subfunction parameter: event type (see uds_svc_param_roe on page 77).
store_event Storage State (true to store event, false to do not store event).
event_window_time Specify a window for the event logic to be active in the server/ECU (see ResponseOnEvent
Service Definitions on page 767).
event_type_record Additional parameters for the specified event type.
event_type_record_size Size in bytes of the event type Record (see ResponseOnEvent Service Definitions on page
767).
service_to_respond_to_record Service parameters, with first byte as service identifier (see
uds_svc_param_roe_recommended_service_id on page 78).
324
PCAN-UDS 2.x API – User Manual
Parameter Description
service_to_respond_to_record_size Size in bytes of the service to respond to record.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcResponseOnEvent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
325
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
326
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
event_type_record: array [0 .. 1] of Byte;
service_to_respond_to_record: array [0 .. 1] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
327
PCAN-UDS 2.x API – User Manual
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, ResponseOnEvent Service Definitions on page 767.
Plain function version: UDS_SvcResponseOnEvent_2013 on page 678.
3.7.64 SvcLinkControl_2013
Writes a UDS request according to the LinkControl service’s specifications. The LinkControl service is used
to control the communication link baud rate between the client and the server(s)/ECU(s) for the exchange
of diagnostic data.
Overloads
Method Description
SvcLinkControl_2013(cantp_handle, Writes to the transmit queue a request for UDS service LinkControl
uds_msgconfig, uds_msg, uds_svc_param_lc, (without PUDS_SVC_PARAM_LC_VBTWSBR parameter).
uds_svc_param_lc_baudrate_identifier)
SvcLinkControl_2013(cantp_handle, Writes to the transmit queue a request for UDS service LinkControl
uds_msgconfig, uds_msg, uds_svc_param_lc, with PUDS_SVC_PARAM_LC_VBTWSBR parameter and link baud
uds_svc_param_lc_baudrate_identifier, UInt32) rate parameter.
328
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
link_control_type Subfunction parameter: Link Control type (see uds_svc_param_lc on page 79).
baudrate_identifier Defined baud rate identifier (see uds_svc_param_lc_baudrate_identifier on page 80,
except PUDS_SVC_PARAM_LC_VBTWSBR).
329
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcLinkControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
330
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
331
PCAN-UDS 2.x API – User Manual
UDSApi.uds_svc_param_lc_baudrate_identifier.PUDS_SVC_PARAM_LC_BAUDRATE_CAN_250K)
If UDSApi.StatusIsOk_2013(result) Then
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, request, response,
request_confirmation)
End If
If UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Response was received", "Success")
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
332
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
C++ / CLR
333
PCAN-UDS 2.x API – User Manual
[MarshalAs(UnmanagedType::U1)]
uds_svc_param_lc_baudrate_identifier baudrate_identifier,
UInt32 link_baudrate);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcLinkControl_2013")>
Public Shared Function SvcLinkControl_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal link_control_type As uds_svc_param_lc,
<MarshalAs(UnmanagedType.U1)>
ByVal baudrate_identifier As uds_svc_param_lc_baudrate_identifier,
ByVal link_baudrate As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
link_control_type Subfunction parameter: Link Control type (see uds_svc_param_lc on page 79).
baudrate_identifier Defined baud rate identifier (see uds_svc_param_lc_baudrate_identifier on page 80).
link_baudrate Used only with PUDS_SVC_PARAM_LC_VBTWSBR parameter: a three-byte value baud rate (baud rate
High, Middle and Low Bytes).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcLinkControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
334
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
335
PCAN-UDS 2.x API – User Manual
else
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
336
PCAN-UDS 2.x API – User Manual
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1);
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.67 SvcReadDataByIdentifier_2013
Writes a UDS request according to the ReadDataByIdentifier service’s specifications. The
ReadDataByIdentifier service allows the client to request data record values from the server (ECU)
identified by one or more data identifiers.
Syntax
Pascal OO
337
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDataByIdentifier_2013")>
Public Shared Function SvcReadDataByIdentifier_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.U2, SizeParamIndex:=4)>
ByVal data_identifier As uds_svc_param_di(),
ByVal data_identifier_length As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
data_identifier Buffer containing a list of two-byte data identifiers (see uds_svc_param_di on page 82).
data_identifier_length Number of elements in the buffer (size in UInt16 of the buffer).
338
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDataByIdentifier_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
339
PCAN-UDS 2.x API – User Manual
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
340
PCAN-UDS 2.x API – User Manual
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
buffer: array [0 .. 1] of uds_svc_param_di;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
341
PCAN-UDS 2.x API – User Manual
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.68 SvcReadMemoryByAddress_2013
Writes a UDS request according to the ReadMemoryByAddress service’s specifications. The
ReadMemoryByAddress service allows the client to request memory data from the server (ECU) via a
provided starting address and to specify the size of memory to be read.
Syntax
Pascal OO
C#
C++ / CLR
342
PCAN-UDS 2.x API – User Manual
uds_msgconfig request_config,
uds_msg %out_msg_request,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 4)]
array<Byte> ^memory_address_buffer,
Byte memory_address_size,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 6)]
array<Byte> ^memory_size_buffer,
Byte memory_size_size);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadMemoryByAddress_2013")>
Public Shared Function SvcReadMemoryByAddress_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal memory_address_buffer As Byte(),
ByVal memory_address_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=6)>
ByVal memory_size_buffer As Byte(),
ByVal memory_size_size As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
memory_address_buffer Starting address of server (ECU) memory from which data is to be retrieved.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size_buffer Number of bytes to be read starting at the address specified by memory address.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
343
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcReadMemoryByAddress_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] memory_address_buffer = new Byte[10];
Byte[] memory_size_buffer = new Byte[10];
Byte memory_address_size = 10;
Byte memory_size_size = 3;
uds_msgconfig config = new uds_msgconfig();
// Fill data
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[i] = (Byte)(Convert.ToByte('A') + i);
memory_size_buffer[i] = (Byte)(Convert.ToByte('1') + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ memory_address_buffer = gcnew array<Byte>(10);
array<Byte>^ memory_size_buffer = gcnew array<Byte>(10);
344
PCAN-UDS 2.x API – User Manual
// Fill data
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[i] = 'A' + i;
memory_size_buffer[i] = '1' + i;
}
// Sends a physical ReadMemoryByAddress message
result = UDSApi::SvcReadMemoryByAddress_2013(PCANTP_HANDLE_USBBUS1, config, request,
memory_address_buffer, memory_address_size, memory_size_buffer, memory_size_size);
if (UDSApi::StatusIsOk_2013(result))
result = UDSApi::WaitForService_2013(PCANTP_HANDLE_USBBUS1, request, response,
request_confirmation);
if (UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Response was received", "Success");
else
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
345
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
memory_address_buffer: array [0 .. 9] of Byte;
memory_size_buffer: array [0 .. 9] of Byte;
memory_address_size: Byte;
memory_size_size: Byte;
i: UInt32;
begin
memory_address_size := 10;
memory_size_size := 3;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill data
for i := 0 to memory_address_size - 1 do
begin
346
PCAN-UDS 2.x API – User Manual
memory_address_buffer[i] := $41 + i;
memory_size_buffer[i] := $31 + i;
end;
// Sends a physical ReadMemoryByAddress message
result := TUDSApi.SvcReadMemoryByAddress_2013
(cantp_handle.PCANTP_HANDLE_USBBUS1, config, request, @memory_address_buffer,
memory_address_size, @memory_size_buffer, memory_size_size);
if TUDSApi.StatusIsOk_2013(result) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.69 SvcReadScalingDataByIdentifier_2013
Writes a UDS request according to the ReadScalingDataByIdentifier service’s specifications. The
ReadScalingDataByIdentifier service allows the client to request scaling data record information from the
server (ECU) identified by a data identifier.
Syntax
Pascal OO
C#
347
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadScalingDataByIdentifier_2013")>
Public Shared Function SvcReadScalingDataByIdentifier_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U2)>
ByVal data_identifier As uds_svc_param_di) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
data_identifier A two-byte Data Identifier (see uds_svc_param_di on page 82).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadScalingDataByIdentifier_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
348
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
349
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
350
PCAN-UDS 2.x API – User Manual
config.can_id :=
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1);
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.70 SvcReadDataByPeriodicIdentifier_2013
Writes a UDS request according to the ReadDataByPeriodicIdentifier service’s specifications. The
ReadDataByPeriodicIdentifier service allows the client to request the periodic transmission of data record
values from the server (ECU) identified by one or more periodic data identifier.
Syntax
Pascal OO
351
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDataByPeriodicIdentifier_2013")>
Public Shared Function SvcReadDataByPeriodicIdentifier_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal transmission_mode As uds_svc_param_rdbpi,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal periodic_data_identifier As Byte(),
ByVal periodic_data_identifier_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 25).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
transmission_mode Transmission rate mode (see uds_svc_param_rdbpi on page 86).
periodic_data_identifier Buffer containing a list of periodic data identifiers (see uds_svc_param_di on page 82).
periodic_data_identifier_size Number of elements in the buffer (size in bytes of the buffer).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
352
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDataByPeriodicIdentifier_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] periodic_data_identifier = new Byte[10];
UInt16 periodic_data_identifier_size = 10;
uds_msgconfig config = new uds_msgconfig();
// Fill Data
for (int i = 0; i < periodic_data_identifier_size; i++)
{
periodic_data_identifier[i] = (Byte)(Convert.ToByte('A') + i);
}
353
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ periodic_data_identifier = gcnew array<Byte>(10);
UInt16 periodic_data_identifier_size = 10;
uds_msgconfig config = {};
// Fill Data
for (int i = 0; i < periodic_data_identifier_size; i++)
{
periodic_data_identifier[i] = 'A' + i;
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
354
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
periodic_data_identifier: array [0 .. 9] of Byte;
periodic_data_identifier_size: UInt16;
i: UInt32;
begin
periodic_data_identifier_size := 10;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
355
PCAN-UDS 2.x API – User Manual
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Fill Data
for i := 0 to periodic_data_identifier_size - 1 do
begin
periodic_data_identifier[i] := $41 + i;
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.71 SvcDynamicallyDefineDataIdentifierDBID_2013
Writes a UDS request according to the DynamicallyDefineDataIdentifier service’s specifications. The
DynamicallyDefineDataIdentifier service allows the client to dynamically define in a server (ECU) a data
identifier that can be read via the ReadDataByIdentifier service later. The define by identifier subfunction
specifies that the definition of the dynamic data identifier shall occur via a data identifier reference.
Syntax
Pascal OO
class function SvcDynamicallyDefineDataIdentifierDBID_2013(
channel: cantp_handle;
request_config: uds_msgconfig;
var out_msg_request: uds_msg;
dynamically_defined_data_identifier: uds_svc_param_di;
source_data_identifier: PUInt16;
356
PCAN-UDS 2.x API – User Manual
memory_size: PByte;
position_in_source_data_record: PByte;
number_of_elements: UInt32
): uds_status;
C#
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcDynamicallyDefineDataIdentifierDBID_2013")]
static uds_status SvcDynamicallyDefineDataIdentifierDBID_2013(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request,
[MarshalAs(UnmanagedType::U2)]
uds_svc_param_di dynamically_defined_data_identifier,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 7)]
array<UInt16> ^source_data_identifier,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 7)]
array<Byte> ^memory_size,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 7)]
array<Byte> ^position_in_source_data_record,
UInt32 number_of_elements);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcDynamicallyDefineDataIdentifierDBID_2013")>
Public Shared Function SvcDynamicallyDefineDataIdentifierDBID_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U2)>
ByVal dynamically_defined_data_identifier As uds_svc_param_di,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal source_data_identifier As UInt16(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal memory_size As Byte(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal position_in_source_data_record As Byte(),
ByVal number_of_elements As UInt32) As uds_status
End Function
357
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dynamically_defined_data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
source_data_identifier Buffer containing the sources of information to be included into the dynamic data record.
memory_size Buffer containing the total numbers of bytes from the source data record address.
position_in_source_data_record Buffer containing the starting byte positions of the excerpt of the source data record.
number_of_elements Number of source_data_identifier/position_in_source_data_record/memory_size triplet.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The total buffer length is too big. The resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcDynamicallyDefineDataIdentifierDBID_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
UInt16[] source_data_identifier = new UInt16[10];
Byte[] memory_size = new Byte[10];
Byte[] position_in_source_data_record = new Byte[10];
UInt16 number_of_elements = 10;
uds_msgconfig config = new uds_msgconfig();
358
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr = 0x0;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Fill Data
for (int i = 0; i < number_of_elements; i++)
{
source_data_identifier[i] = (Byte)(((0xF0 + i) << 8) + ('A' + i));
memory_size[i] = (Byte)(i + 1);
position_in_source_data_record[i] = (Byte)(100 + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<UInt16>^ source_data_identifier = gcnew array<UInt16>(10);
array<Byte>^ memory_size = gcnew array<Byte>(10);
array<Byte>^ position_in_source_data_record = gcnew array<Byte>(10);
UInt16 number_of_elements = 10;
uds_msgconfig config = {};
// Fill Data
for (int i = 0; i < number_of_elements; i++)
{
source_data_identifier[i] = (((0xF0 + i) << 8) + ('A' + i));
memory_size[i] = (i + 1);
position_in_source_data_record[i] = (100 + i);
}
359
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
360
PCAN-UDS 2.x API – User Manual
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
memory_size: array [0 .. 9] of Byte;
position_in_source_data_record: array [0 .. 9] of Byte;
source_data_identifier: array [0 .. 9] of UInt16;
number_of_elements: UInt16;
i: UInt32;
begin
number_of_elements := 10;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill Data
for i := 0 to number_of_elements - 1 do
begin
source_data_identifier[i] := ((($F0 + i) Shl 8) + ($41 + i));
memory_size[i] := (i + 1);
position_in_source_data_record[i] := (100 + i);
end;
361
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.72 SvcDynamicallyDefineDataIdentifierDBMA_2013
Writes a UDS request according to the DynamicallyDefineDataIdentifier service’s specifications. The
DynamicallyDefineDataIdentifier service allows the client to dynamically define in a server (ECU) a data
identifier that can be read via the ReadDataByIdentifier service later. Defined by the memory address
subfunction, this specifies that the definition of the dynamic data identifier shall occur via an address
reference.
Syntax
Pascal OO
C#
362
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcDynamicallyDefineDataIdentifierDBMA_2013")>
Public Shared Function SvcDynamicallyDefineDataIdentifierDBMA_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U2)>
ByVal dynamically_defined_data_identifier As uds_svc_param_di,
ByVal memory_address_size As Byte,
ByVal memory_size_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal memory_address_buffer As Byte(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal Memory_size_buffer As Byte(),
ByVal number_of_elements As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dynamically_defined_data_identifier A two-byte Data Identifier (see uds_svc_param_di on page 82).
memory_address_size Size in bytes of the memory address items in the memory address buffer (max.: 0xF).
memory_size_size Size in bytes of the memory size items in the memory size buffer (max.: 0xF).
memory_address_buffer Buffer containing the memory address buffers must be an array of 'buffers length' entries
which contains 'memory address length' bytes (size is 'buffers length * memory address
length' bytes).
Memory_size_buffer Buffer containing the memory size buffers must be an array of 'buffers length' entries which
contains 'memory size length' bytes (size is 'buffers length * memory size length' bytes).
number_of_elements Number of memory address/memory_size couple.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
363
PCAN-UDS 2.x API – User Manual
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcDynamicallyDefineDataIdentifierDBMA_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
UInt16 number_of_elements = 3;
Byte[] memory_address_buffer = new Byte[15];
Byte[] memory_size_buffer = new Byte[9];
Byte memory_address_size = 5;
Byte memory_size_size = 3;
uds_msgconfig config = new uds_msgconfig();
// Fill data
for (int j = 0; j < number_of_elements; j++)
{
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[memory_address_size * j + i] = (Byte)((10 * j) + i + 1);
}
for (int i = 0; i < memory_size_size; i++)
{
memory_size_buffer[memory_size_size * j + i] = (Byte)(100 + (10 * j) + i + 1);
}
}
364
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
UInt16 number_of_elements = 3;
array<Byte>^ memory_address_buffer = gcnew array<Byte>(15);
array<Byte>^ memory_size_buffer = gcnew array<Byte>(9);
Byte memory_address_size = 5;
Byte memory_size_size = 3;
uds_msgconfig config = {};
// Fill data
for (int j = 0; j < number_of_elements; j++)
{
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[memory_address_size * j + i] = ((10 * j) + i + 1);
}
for (int i = 0; i < memory_size_size; i++)
{
memory_size_buffer[memory_size_size * j + i] = (100 + (10 * j) + i + 1);
}
}
365
PCAN-UDS 2.x API – User Manual
if (UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Response was received", "Success");
else
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
366
PCAN-UDS 2.x API – User Manual
UDSApi.MsgFree_2013(request)
UDSApi.MsgFree_2013(response)
UDSApi.MsgFree_2013(request_confirmation)
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
memory_address_buffer: array [0 .. 14] of Byte;
memory_size_buffer: array [0 .. 8] of Byte;
number_of_elements: UInt16;
memory_address_size: Byte;
memory_size_size: Byte;
i: UInt32;
j: UInt32;
begin
number_of_elements := 3;
memory_address_size := 5;
memory_size_size := 3;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill data
for j := 0 to number_of_elements - 1 do
begin
for i := 0 to memory_address_size - 1 do
begin
memory_address_buffer[memory_address_size * j + i] := ((10 * j) + i + 1);
end;
for i := 0 to memory_size_size - 1 do
begin
memory_size_buffer[memory_size_size * j + i] := (100 + (10 * j) + i + 1);
end;
end;
367
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.73 SvcDynamicallyDefineDataIdentifierCDDDI_2013
Writes a UDS request according to the Dynamically Defined Data Identifier service’s specifications. The
Clear Dynamically Defined Data Identifier subfunction shall be used to clear the specified dynamic data
identifier.
Syntax
Pascal OO
C#
C++ / CLR
368
PCAN-UDS 2.x API – User Manual
uds_msg %out_msg_request,
[MarshalAs(UnmanagedType::U2)]
uds_svc_param_di dynamically_defined_data_identifier);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcDynamicallyDefineDataIdentifierCDDDI_2013")>
Public Shared Function SvcDynamicallyDefineDataIdentifierCDDDI_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U2)>
ByVal dynamically_defined_data_identifier As uds_svc_param_di) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dynamically_defined_data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcDynamicallyDefineDataIdentifierCDDDI_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
369
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
370
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
371
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.74 SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013
Writes a UDS request according to the Clear all Dynamically Defined Data Identifier service’s specifications.
The Clear Dynamically Defined Data Identifier subfunction (without data identifier parameter) shall be used
to clear all the specified dynamic data identifier in the server.
Syntax
Pascal OO
372
PCAN-UDS 2.x API – User Manual
C#
[DllImport("PCAN-UDS.dll", EntryPoint =
"UDS_SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013")]
public static extern uds_status SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request);
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint =
"UDS_SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013")]
static uds_status SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request);
Visual Basic
<DllImport("PCAN-UDS.dll",
EntryPoint:="UDS_SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013")>
Public Shared Function SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
373
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
WaitForService_2013 method is called to get the response. Depending on the result, a message will be shown
to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
374
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
375
PCAN-UDS 2.x API – User Manual
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
376
PCAN-UDS 2.x API – User Manual
3.7.75 SvcWriteDataByIdentifier_2013
Writes a UDS request according to the WriteDataByIdentifier service’s specifications. The
WriteDataByIdentifier service allows the client to write information into the server (ECU) at an internal
location specified by the provided data identifier.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcWriteDataByIdentifier_2013")>
Public Shared Function SvcWriteDataByIdentifier_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U2)>
ByVal data_identifier As uds_svc_param_di,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal data_record As Byte(),
ByVal data_record_size As UInt32) As uds_status
End Function
377
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
data_record Buffer containing the data to write.
data_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcWriteDataByIdentifier_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] data_record = new Byte[10];
UInt16 data_record_size = 10;
uds_msgconfig config = new uds_msgconfig();
378
PCAN-UDS 2.x API – User Manual
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Fill Data
for (int i = 0; i < data_record_size; i++)
{
data_record[i] = (Byte)(Convert.ToByte('A') + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ data_record = gcnew array<Byte>(10);
UInt16 data_record_size = 10;
uds_msgconfig config = {};
// Fill Data
for (int i = 0; i < data_record_size; i++)
{
data_record[i] = 'A' + i;
}
379
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim data_record(10) As Byte
Dim data_record_size As UInt16 = 10
Dim config As uds_msgconfig = New uds_msgconfig()
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
data_record: array [0 .. 9] of Byte;
data_record_size: UInt16;
380
PCAN-UDS 2.x API – User Manual
i: UInt32;
begin
data_record_size := 10;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill Data
for i := 0 to data_record_size - 1 do
begin
data_record[i] := ($41 + i);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
381
PCAN-UDS 2.x API – User Manual
3.7.76 SvcWriteMemoryByAddress_2013
Writes a UDS request according to the WriteMemoryByAddress service’s specifications. The
WriteMemoryByAddress service allows the client to write information into the server (ECU) at one or more
contiguous memory locations.
Syntax
Pascal OO
C#
C++ / CLR
382
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcWriteMemoryByAddress_2013")>
Public Shared Function SvcWriteMemoryByAddress_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal memory_address_buffer As Byte(),
ByVal memory_address_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=6)>
ByVal memory_size_buffer As Byte(),
ByVal memory_size_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal data_record As Byte(),
ByVal data_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
memory_address_buffer Starting address buffer of server (ECU) memory to which data is to be written.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size_buffer Number of bytes to be written starting at the address specified by memory address.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
data_record Buffer containing the data to write.
data_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
383
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcWriteMemoryByAddress_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] data_record = new Byte[50];
Byte[] memory_address_buffer = new Byte[50];
Byte[] memory_size_buffer = new Byte[50];
UInt16 data_record_size = 50;
Byte memory_address_size = 5;
Byte memory_size_size = 3;
uds_msgconfig config = new uds_msgconfig();
// Fill Data
for (int i = 0; i < data_record_size; i++)
{
data_record[i] = (Byte)(i + 1);
memory_address_buffer[i] = (Byte)(Convert.ToByte('A') + i);
memory_size_buffer[i] = (Byte)(10 + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
384
PCAN-UDS 2.x API – User Manual
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ data_record = gcnew array<Byte>(50);
array<Byte>^ memory_address_buffer = gcnew array<Byte>(50);
array<Byte>^ memory_size_buffer = gcnew array<Byte>(50);
UInt16 data_record_size = 50;
Byte memory_address_size = 5;
Byte memory_size_size = 3;
uds_msgconfig config = {};
// Fill Data
for (int i = 0; i < data_record_size; i++)
{
data_record[i] = (i + 1);
memory_address_buffer[i] = 'A' + i;
memory_size_buffer[i] = (10 + i);
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
385
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
data_record: array [0 .. 49] of Byte;
memory_address_buffer: array [0 .. 49] of Byte;
memory_size_buffer: array [0 .. 49] of Byte;
data_record_size: UInt16;
memory_address_size: Byte;
memory_size_size: Byte;
i: UInt32;
begin
data_record_size := 50;
memory_address_size := 5;
memory_size_size := 3;
FillChar(request, sizeof(request), 0);
386
PCAN-UDS 2.x API – User Manual
// Fill Data
for i := 0 to data_record_size - 1 do
begin
data_record[i] := (i + 1);
memory_address_buffer[i] := ($41 + i);
memory_size_buffer[i] := (10 + i);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
387
PCAN-UDS 2.x API – User Manual
3.7.77 SvcClearDiagnosticInformation_2013
Writes a UDS request according to the ClearDiagnosticInformation service’s specifications. The
ClearDiagnosticInformation service is used by the client to clear diagnostic information in one server's
(ECU) or multiple servers’ (ECUs) memory.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcClearDiagnosticInformation_2013")>
Public Shared Function SvcClearDiagnosticInformation_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal group_of_dtc As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
group_of_dtc A three-byte value indicating the group of DTCs (e.g. powertrain, body, chassis) or the particular DTC
to be cleared (see ClearDiagnosticInformation Group of DTC Definitions on page 768).
388
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcClearDiagnosticInformation_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
389
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
390
PCAN-UDS 2.x API – User Manual
If UDSApi.StatusIsOk_2013(result) Then
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, request, response,
request_confirmation)
End If
If UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Response was received", "Success")
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
391
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, ClearDiagnosticInformation Group of DTC Definitions on page
768, SvcClearDiagnosticInformation_2020 on page 392.
Plain function version: UDS_SvcClearDiagnosticInformation_2013 on page 701.
3.7.78 SvcClearDiagnosticInformation_2020
Writes a UDS request according to the ClearDiagnosticInformation service’s specifications with memory
selection parameter (ISO-14229-1:2020). The ClearDiagnosticInformation service is used by the client to
clear diagnostic information in one server's or multiple servers’ memory.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcClearDiagnosticInformation_2020")>
Public Shared Function SvcClearDiagnosticInformation_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
392
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
group_of_dtc A three-byte value indicating the group of DTCs (e.g. powertrain, body, chassis) or the particular DTC
to be cleared (see ClearDiagnosticInformation Group of DTC Definitions on page 768).
memory_selection User defined DTC memory.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcClearDiagnosticInformation_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
393
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
394
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
395
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, ClearDiagnosticInformation Group of DTC Definitions on page
768, SvcClearDiagnosticInformation_2013 on page 388.
Plain function version: UDS_SvcClearDiagnosticInformation_2020 on page 703.
3.7.79 SvcReadDTCInformation_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information.
Syntax
Pascal OO
C#
396
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformation_2013")>
Public Shared Function SvcReadDTCInformation_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal PUDS_SVC_PARAM_RDTCI_Type As uds_svc_param_rdtci,
ByVal dtc_status_mask As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RNODTCBSM,
PUDS_SVC_PARAM_RDTCI_RDTCBSM,
PUDS_SVC_PARAM_RDTCI_RMMDTCBSM,
PUDS_SVC_PARAM_RDTCI_RNOMMDTCBSM,
PUDS_SVC_PARAM_RDTCI_RNOOBDDTCBSM,
PUDS_SVC_PARAM_RDTCI_ROBDDTCBSM.
See also uds_svc_param_rdtci on page 88.
dtc_status_mask Contains eight DTC status bits.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
397
PCAN-UDS 2.x API – User Manual
Remarks
This method creates a new message using a given message configuration and set the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once
processed, this request message should be released (see MsgFree_2013 on page 214).
Only the following subfunctions are allowed:
o reportNumberOfDTCByStatusMask,
o reportDTCByStatusMask,
o reportMirrorMemoryDTCByStatusMask,
o reportNumberOfMirrorMemoryDTCByStatusMask,
o reportNumberOfEmissionsRelatedOBDDTCByStatusMask,
o reportEmissionsRelatedOBDDTCByStatusMask.
Example
The following example shows the use of the service method SvcReadDTCInformation_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
398
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
399
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
400
PCAN-UDS 2.x API – User Manual
3.7.80 SvcReadDTCInformationRDTCSSBDTC_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCSnapshotRecordByDTCNumber ( PUDS_SVC_PARAM_RDTCI_RDTCSSBDTC ) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRDTCSSBDTC_2013")>
Public Shared Function SvcReadDTCInformationRDTCSSBDTC_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_mask As UInt32,
ByVal dtc_snapshot_record_number As Byte) As uds_status
End Function
401
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code (DTC).
dtc_snapshot_record_number The number of the specific DTCSnapshot data records.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRDTCSSBDTC_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
402
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request, out
response, out request_confirmation);
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
403
PCAN-UDS 2.x API – User Manual
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
404
PCAN-UDS 2.x API – User Manual
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.81 SvcReadDTCInformationRDTCSSBRN_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCSnapshotByRecordNumber ( PUDS_SVC_PARAM_RDTCI_RDTCSSBRN ) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRDTCSSBRN_2013")>
Public Shared Function SvcReadDTCInformationRDTCSSBRN_2013(
405
PCAN-UDS 2.x API – User Manual
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_snapshot_record_number As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_snapshot_record_number The number of the specific DTCSnapshot data records.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRDTCSSBRN_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
406
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
407
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
408
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.82 SvcReadDTCInformationReportExtended_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. Only
reportDTCExtendedDataRecordByDTCNumber and
reportMirrorMemoryDTCExtendedDataRecordByDTCNumber subfunctions are allowed.
Syntax
Pascal OO
C#
409
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationReportExtended_2013")>
Public Shared Function SvcReadDTCInformationReportExtended_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal PUDS_SVC_PARAM_RDTCI_Type As uds_svc_param_rdtci,
ByVal dtc_mask As UInt32,
ByVal dtc_extended_data_record_number As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RDTCEDRBDN,
PUDS_SVC_PARAM_RDTCI_RMMDEDRBDN.
See also uds_svc_param_rdtci on page 88.
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code.
dtc_extended_data_record_number The number of the specific DTCExtendedData record requested.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
410
PCAN-UDS 2.x API – User Manual
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationReportExtended_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
411
PCAN-UDS 2.x API – User Manual
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
412
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
413
PCAN-UDS 2.x API – User Manual
3.7.83 SvcReadDTCInformationReportSeverity_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. Only
reportNumberOfDTCBySeverityMaskRecord and reportDTCSeverityInformation subfunctions are allowed.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationReportSeverity_2013")>
Public Shared Function SvcReadDTCInformationReportSeverity_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal PUDS_SVC_PARAM_RDTCI_Type As uds_svc_param_rdtci,
ByVal dtc_severity_mask As Byte,
ByVal dtc_status_mask As Byte) As uds_status
End Function
414
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RNODTCBSMR,
PUDS_SVC_PARAM_RDTCI_RDTCBSMR
See also uds_svc_param_rdtci on page 88.
dtc_severity_mask A mask of eight (8) DTC severity bits (see uds_svc_param_rdtci_dtcsvm on page 91).
dtc_status_mask A mask of eight (8) DTC status bits.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationReportSeverity_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
415
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
416
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
417
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, uds_svc_param_rdtci on page 88, uds_svc_param_rdtci_dtcsvm on page 91.
Plain function version: UDS_SvcReadDTCInformationReportSeverity_2013 on page 712.
3.7.84 SvcReadDTCInformationRSIODTC_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportSeverityInformationOfDTC ( PUDS_SVC_PARAM_RDTCI_RSIODTC ) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
418
PCAN-UDS 2.x API – User Manual
uds_msgconfig request_config,
uds_msg %out_msg_request,
UInt32 dtc_mask);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRSIODTC_2013")>
Public Shared Function SvcReadDTCInformationRSIODTC_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_mask As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_mask A unique identification number for a specific diagnostic trouble code.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRSIODTC_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
419
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
420
PCAN-UDS 2.x API – User Manual
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Dim result As uds_status
Dim request As uds_msg = New uds_msg()
Dim request_confirmation As uds_msg = New uds_msg()
Dim response As uds_msg = New uds_msg()
Dim config As uds_msgconfig = New uds_msgconfig()
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
421
PCAN-UDS 2.x API – User Manual
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.85 SvcReadDTCInformationNoParam_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. Only theses
following subfunctions are allowed:
- reportSupportedDTC
- reportFirstTestFailedDTC
- reportFirstConfirmedDTC
- reportMostRecentTestFailedDTC
- reportMostRecentConfirmedDTC
- reportDTCFaultDetectionCounter
- reportDTCWithPermanentStatus
- reportDTCSnapshotIdentification
Syntax
Pascal OO
422
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationNoParam_2013")>
Public Shared Function SvcReadDTCInformationNoParam_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal PUDS_SVC_PARAM_RDTCI_Type As uds_svc_param_rdtci) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RFTFDTC,
PUDS_SVC_PARAM_RDTCI_RFCDTC,
PUDS_SVC_PARAM_RDTCI_RMRTFDTC,
PUDS_SVC_PARAM_RDTCI_RMRCDTC,
PUDS_SVC_PARAM_RDTCI_RSUPDTC,
PUDS_SVC_PARAM_RDTCI_RDTCWPS,
PUDS_SVC_PARAM_RDTCI_RDTCSSI.
See also uds_svc_param_rdtci on page 88.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
423
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationNoParam_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
424
PCAN-UDS 2.x API – User Manual
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
425
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
426
PCAN-UDS 2.x API – User Manual
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.86 SvcReadDTCInformationRDTCEDBR_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCExtDataRecordByRecordNumber ( PUDS_SVC_PARAM_RDTCI_RDTCEDBR ) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRDTCEDBR_2013")>
Public Shared Function SvcReadDTCInformationRDTCEDBR_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_extended_data_record_number As Byte) As uds_status
End Function
427
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_extended_data_record_number DTC extended data record number.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRDTCEDBR_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
Byte dtc_extended_data_record_number = 0x12;
428
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request, out
response, out request_confirmation);
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
Byte dtc_extended_data_record_number = 0x12;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
429
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr = &H0
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
dtc_extended_data_record_number: Byte;
begin
dtc_extended_data_record_number := $12;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
430
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.87 SvcReadDTCInformationRUDMDTCBSM_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportUserDefMemoryDTCByStatusMask (PUDS_SVC_PARAM_RDTCI_RUDMDTCBSM) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
431
PCAN-UDS 2.x API – User Manual
uds_msg %out_msg_request,
Byte dtc_status_mask,
Byte memory_selection);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRUDMDTCBSM_2013")>
Public Shared Function SvcReadDTCInformationRUDMDTCBSM_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_status_mask As Byte,
ByVal memory_selection As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_status_mask A mask of eight (8) DTC status bits.
memory_selection Memory selection.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRUDMDTCBSM_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
432
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
Byte dtc_status_mask = 0x12;
Byte memory_selection = 0x34;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
Byte dtc_status_mask = 0x12;
Byte memory_selection = 0x34;
433
PCAN-UDS 2.x API – User Manual
response, request_confirmation);
if (UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Response was received", "Success");
else
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
dtc_status_mask: Byte;
memory_selection: Byte;
begin
434
PCAN-UDS 2.x API – User Manual
dtc_status_mask := $12;
memory_selection := $34;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
435
PCAN-UDS 2.x API – User Manual
3.7.88 SvcReadDTCInformationRUDMDTCSSBDTC_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportUserDefMemoryDTCSnapshotRecordByDTCNumber
(PUDS_SVC_PARAM_RDTCI_RUDMDTCSSBDTC) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRUDMDTCSSBDTC_2013")>
Public Shared Function SvcReadDTCInformationRUDMDTCSSBDTC_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_mask As UInt32,
ByVal user_def_dtc_snapshot_record_number As Byte,
ByVal memory_selection As Byte) As uds_status
End Function
436
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code.
user_def_dtc_snapshot_record_number User DTC snapshot record number.
memory_selection Memory selection.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRUDMDTCSSBDTC_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
WaitForService_2013 method is called to get the response. Depending on the result, a message will be shown
to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
UInt32 dtc_mask = 0x12345678;
Byte user_def_dtc_snapshot_record_number = 0x9A;
Byte memory_selection = 0xBC;
437
PCAN-UDS 2.x API – User Manual
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
UInt32 dtc_mask = 0x12345678;
Byte user_def_dtc_snapshot_record_number = 0x9A;
Byte memory_selection = 0xBC;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
438
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
dtc_mask: UInt32;
user_def_dtc_snapshot_record_number: Byte;
memory_selection: Byte;
begin
dtc_mask := $12345678;
user_def_dtc_snapshot_record_number := $9A;
memory_selection := $BC;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
439
PCAN-UDS 2.x API – User Manual
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1);
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.89 SvcReadDTCInformationRUDMDTCEDRBDN_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportUserDefMemoryDTCExtDataRecordByDTCNumber
(PUDS_SVC_PARAM_RDTCI_RUDMDTCEDRBDN) is implicit.
Syntax
Pascal OO
440
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRUDMDTCEDRBDN_2013")>
Public Shared Function SvcReadDTCInformationRUDMDTCEDRBDN_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_mask As UInt32,
ByVal dtc_extended_data_record_number As Byte,
ByVal memory_selection As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code.
dtc_extended_data_record_number DTC extened data record number.
memory_selection Memory selection.
441
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRUDMDTCEDRBDN_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
WaitForService_2013 method is called to get the response. Depending on the result, a message will be shown
to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
UInt32 dtc_mask = 0x12345678;
Byte dtc_extended_data_record_number = 0x9A;
Byte memory_selection = 0xBC;
442
PCAN-UDS 2.x API – User Manual
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
UInt32 dtc_mask = 0x12345678;
Byte dtc_extended_data_record_number = 0x9A;
Byte memory_selection = 0xBC;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
443
PCAN-UDS 2.x API – User Manual
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
dtc_mask: UInt32;
dtc_extended_data_record_number: Byte;
memory_selection: Byte;
begin
dtc_mask := $12345678;
dtc_extended_data_record_number := $9A;
memory_selection := $BC;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
444
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.90 SvcReadDTCInformationRDTCEDI_2020
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportSupportedDTCExtDataRecord (PUDS_SVC_PARAM_RDTCI_RDTCEDI) is implicit.
Syntax
Pascal OO
C#
C++ / CLR
445
PCAN-UDS 2.x API – User Manual
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request,
Byte dtc_extended_data_record_number);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRDTCEDI_2020")>
Public Shared Function SvcReadDTCInformationRDTCEDI_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal dtc_extended_data_record_number As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
dtc_extended_data_record_number DTC extended data record number.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRDTCEDI_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
446
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
Byte dtc_extended_data_record_number = 0x12;
447
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
dtc_extended_data_record_number: Byte;
begin
dtc_extended_data_record_number := $12;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
448
PCAN-UDS 2.x API – User Manual
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.91 SvcReadDTCInformationRWWHOBDDTCBMR_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportWWHOBDDTCByMaskRecord ( PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCBMR ) is implicit.
Syntax
Pascal OO
449
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRWWHOBDDTCBMR_2013")>
Public Shared Function SvcReadDTCInformationRWWHOBDDTCBMR_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal functional_group_identifier As Byte,
ByVal dtc_status_mask As Byte,
ByVal dtc_severity_mask As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
functional_group_identifier Functional group identifier.
dtc_status_mask A mask of eight (8) DTC status bits.
dtc_severity_mask A mask of eight (8) DTC severity bits (see uds_svc_param_rdtci_dtcsvm on page 91).
450
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRWWHOBDDTCBMR_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
WaitForService_2013 method is called to get the response. Depending on the result, a message will be shown
to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
Byte functional_group_identifier = 0x12;
Byte dtc_status_mask = 0x34;
Byte dtc_severity_mask = 0x78;
451
PCAN-UDS 2.x API – User Manual
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
Byte functional_group_identifier = 0x12;
Byte dtc_status_mask = 0x34;
Byte dtc_severity_mask = 0x78;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
452
PCAN-UDS 2.x API – User Manual
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
functional_group_identifier: Byte;
dtc_status_mask: Byte;
dtc_severity_mask: Byte;
begin
functional_group_identifier := $12;
dtc_status_mask := $34;
dtc_severity_mask := $78;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
453
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.92 SvcReadDTCInformationRWWHOBDDTCWPS_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportWWHOBDDTCWithPermanentStatus (PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCWPS) is implicit.
Syntax
Pascal OO
C#
454
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRWWHOBDDTCWPS_2013")>
Public Shared Function SvcReadDTCInformationRWWHOBDDTCWPS_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal functional_group_identifier As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
functional_group_identifier Functional group identifier.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRWWHOBDDTCWPS_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
455
PCAN-UDS 2.x API – User Manual
WaitForService_2013 method is called to get the response. Depending on the result, a message will be shown
to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
Byte functional_group_identifier = 0x12;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
Byte functional_group_identifier = 0x12;
456
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
functional_group_identifier: Byte;
457
PCAN-UDS 2.x API – User Manual
begin
functional_group_identifier := $12;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
458
PCAN-UDS 2.x API – User Manual
3.7.93 SvcReadDTCInformationRDTCBRGI_2020
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCInformationByDTCReadinessGroupIdentifier (PUDS_SVC_PARAM_RDTCI_RDTCBRGI) is
implicit.
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcReadDTCInformationRDTCBRGI_2020")>
Public Shared Function SvcReadDTCInformationRDTCBRGI_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal functional_group_identifier As Byte,
ByVal dtc_readiness_group_identifier As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
459
PCAN-UDS 2.x API – User Manual
Parameter Description
functional_group_identifier Functional group identifier.
dtc_readiness_group_identifier DTC readiness group identifier.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcReadDTCInformationRDTCBRGI_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
Byte functional_group_identifier = 0x12;
Byte dtc_readiness_group_identifier = 0x34;
460
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
Byte functional_group_identifier = 0x12;
Byte dtc_readiness_group_identifier = 0x34;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
461
PCAN-UDS 2.x API – User Manual
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
functional_group_identifier: Byte;
dtc_readiness_group_identifier: Byte;
begin
functional_group_identifier := $12;
dtc_readiness_group_identifier := $34;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
462
PCAN-UDS 2.x API – User Manual
if (TUDSApi.StatusIsOk_2013(result)) then
begin
result := TUDSApi.WaitForService_2013(PCANTP_HANDLE_USBBUS1, @request,
&response, @request_confirmation);
end;
if (TUDSApi.StatusIsOk_2013(result)) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.94 SvcInputOutputControlByIdentifier_2013
Writes a UDS request according to the InputOutputControlByIdentifier service’s specifications. The
InputOutputControlByIdentifier service is used by the client to substitute a value for an input signal, internal
server (ECU) method and/or control an output (actuator) of an electronic system.
Overloads
Method Description
SvcInputOutputControlByIdentifier_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_di, byte[], InputOutputControlByIdentifier, without control enable mask.
UInt32)
SvcInputOutputControlByIdentifier_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_di, byte[], InputOutputControlByIdentifier, with control enable mask.
UInt32, byte[], UInt32)
3.7.95 SvcInputOutputControlByIdentifier_2013(cantp_handle,
uds_msgconfig, uds_msg, uds_svc_param_di, byte[], UInt32)
Writes a UDS request according to the InputOutputControlByIdentifier service’s specifications (without
control enable mask). The InputOutputControlByIdentifier service is used by the client to substitute a value
for an input signal, internal server (ECU) method and/or control an output (actuator) of an electronic
system.
Syntax
Pascal OO
463
PCAN-UDS 2.x API – User Manual
control_option_record: PByte;
control_option_record_size: UInt32
): uds_status; overload;
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
control_option_record First byte can be used as either an input output control parameter that describes how the
server (ECU) shall control its inputs or outputs (see uds_svc_param_iocbi on page 92), or as
an additional control state byte.
control_option_record_size Size in bytes of the control option record buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
464
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcInputOutputControlByIdentifier_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] control_option_record = new Byte[10];
UInt16 control_option_record_size = 10;
uds_msgconfig config = new uds_msgconfig();
// Fill Data
for (int i = 0; i < control_option_record_size; i++)
{
control_option_record[i] = (Byte)(Convert.ToByte('A') + i);
}
465
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ control_option_record = gcnew array<Byte>(10);
UInt16 control_option_record_size = 10;
uds_msgconfig config = {};
// Fill Data
for (int i = 0; i < control_option_record_size; i++)
{
control_option_record[i] = 'A' + i;
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
466
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
control_option_record: array [0 .. 9] of Byte;
control_option_record_size: UInt16;
i: UInt32;
begin
control_option_record_size := 10;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
467
PCAN-UDS 2.x API – User Manual
UInt32(uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1);
config.can_msgtype := cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Fill Data
for i := 0 to control_option_record_size - 1 do
begin
control_option_record[i] := ($41 + i);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
468
PCAN-UDS 2.x API – User Manual
3.7.96 SvcInputOutputControlByIdentifier_2013(cantp_handle,
uds_msgconfig, uds_msg, uds_svc_param_di, byte[], UInt32,
byte[], UInt32)
Writes a UDS request according to the InputOutputControlByIdentifier service’s specifications. The
InputOutputControlByIdentifier service is used by the client to substitute a value for an input signal, internal
server (ECU) method and/or control an output (actuator) of an electronic system.
Syntax
Pascal OO
C#
C++ / CLR
469
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcInputOutputControlByIdentifier_2013")>
Public Shared Function SvcInputOutputControlByIdentifier_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U2)>
ByVal data_identifier As uds_svc_param_di,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal control_option_record As Byte(),
ByVal control_option_record_size As UInt32,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal control_enable_mask_record As Byte(),
ByVal control_enable_mask_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
control_option_record First byte can be used as either an input output control parameter that describes how the
server (ECU) shall control its inputs or outputs (see uds_svc_param_iocbi on page 92), or as
an additional control state byte.
control_option_record_size Size in bytes of the control option record buffer.
control_enable_mask_record The control enable mask shall only be supported when the input output control parameter is
used and the data identifier to be controlled consists of more than one parameter (i.e. the data
identifier is bit-mapped or packed by definition). There shall be one bit in the control enable
mask corresponding to each individual parameter defined within the data identifier.
control_enable_mask_record_size Size in bytes of the control enable mask record buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
470
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcInputOutputControlByIdentifier_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013
method is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] control_option_record = new Byte[10];
Byte[] control_enable_mask_record = new Byte[10];
UInt16 control_option_record_size = 10;
UInt16 control_enable_mask_record_size = 5;
uds_msgconfig config = new uds_msgconfig();
// Fill Data
for (int i = 0; i < control_option_record_size; i++)
{
control_option_record[i] = (Byte)(Convert.ToByte('A') + i);
control_enable_mask_record[i] = (Byte)(10 + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
471
PCAN-UDS 2.x API – User Manual
// Fill Data
for (int i = 0; i < control_option_record_size; i++)
{
control_option_record[i] = 'A' + i;
control_enable_mask_record[i] = (10 + i);
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
472
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
control_option_record: array [0 .. 9] of Byte;
control_enable_mask_record: array [0 .. 9] of Byte;
control_option_record_size: UInt16;
control_enable_mask_record_size: UInt16;
i: UInt32;
begin
control_option_record_size := 10;
control_enable_mask_record_size := 5;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
473
PCAN-UDS 2.x API – User Manual
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Fill Data
for i := 0 to control_option_record_size - 1 do
begin
control_option_record[i] := ($41 + i);
control_enable_mask_record[i] := (10 + i);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.97 SvcRoutineControl_2013
Writes a UDS request according to the RoutineControl service’s specifications. The RoutineControl service
is used by the client to start/stop a routine and request routine results.
Overloads
Method Description
SvcRoutineControl_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rc, RoutineControl, without routine control options.
uds_svc_param_rc_rid)
SvcRoutineControl_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rc, RoutineControl, with routine control options (only with start and
uds_svc_param_rc_rid, byte[], UInt32) stop routine subfunctions).
474
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
routine_control_type Subfunction parameter: routine control type (see uds_svc_param_rc on page 93).
routine_identifier Server local routine identifier (see uds_svc_param_rc_rid on page 94).
475
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRoutineControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
476
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
477
PCAN-UDS 2.x API – User Manual
If UDSApi.StatusIsOk_2013(result) Then
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, request, response,
request_confirmation)
End If
If UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Response was received", "Success")
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
478
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, uds_svc_param_rc on page 93, uds_svc_param_rc_rid on page 94.
Plain function version: UDS_SvcRoutineControl_2013 on page 734.
Syntax
Pascal OO
C#
C++ / CLR
479
PCAN-UDS 2.x API – User Manual
[MarshalAs(UnmanagedType::U2)]
uds_svc_param_rc_rid routine_identifier,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 6)]
array<Byte> ^routine_control_option_record,
UInt32 routine_control_option_record_size);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcRoutineControl_2013")>
Public Shared Function SvcRoutineControl_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal routine_control_type As uds_svc_param_rc,
<MarshalAs(UnmanagedType.U2)>
ByVal routine_identifier As uds_svc_param_rc_rid,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=6)>
ByVal routine_control_option_record As Byte(),
ByVal routine_control_option_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
routine_control_type Subfunction parameter: routine control type (see uds_svc_param_rc on page 93).
routine_identifier Server local routine identifier (see uds_svc_param_rc_rid on page 94).
routine_control_option_record Buffer containing the routine control options (only with start and stop routine
subfunctions).
routine_control_option_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
480
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcRoutineControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] routine_control_option_record = new Byte[10];
UInt16 routine_control_option_record_size = 10;
uds_msgconfig config = new uds_msgconfig();
// Fill data
for (int i = 0; i < routine_control_option_record_size; i++)
{
routine_control_option_record[i] = (Byte)(Convert.ToByte('A') + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ routine_control_option_record = gcnew array<Byte>(10);
UInt16 routine_control_option_record_size = 10;
uds_msgconfig config = {};
481
PCAN-UDS 2.x API – User Manual
// Fill data
for (int i = 0; i < routine_control_option_record_size; i++)
{
routine_control_option_record[i] = 'A' + i;
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
482
PCAN-UDS 2.x API – User Manual
routine_control_option_record_size)
If UDSApi.StatusIsOk_2013(result) Then
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, request, response,
request_confirmation)
End If
If UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Response was received", "Success")
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
routine_control_option_record: array [0 .. 9] of Byte;
routine_control_option_record_size: UInt16;
i: UInt32;
begin
routine_control_option_record_size := 10;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill data
for i := 0 to routine_control_option_record_size - 1 do
begin
routine_control_option_record[i] := ($41 + i);
end;
483
PCAN-UDS 2.x API – User Manual
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
See also: WaitForService_2013 on page 248, uds_svc_param_rc on page 93, uds_svc_param_rc_rid on page 94.
Plain function version: UDS_SvcRoutineControl_2013 on page 734.
3.7.100 SvcRequestDownload_2013
Writes a UDS request according to the RequestDownload service’s specifications. The RequestDownload
service is used by the client to initiate a data transfer from the client to the server/ECU (download).
Syntax
Pascal OO
C#
484
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcRequestDownload_2013")>
Public Shared Function SvcRequestDownload_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal compression_method As Byte,
ByVal encrypting_method As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=6)>
ByVal memory_address As Byte(),
ByVal memory_address_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal memory_size As Byte(),
ByVal memory_size_size As Byte) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
memory_address Starting address of server (ECU) memory to which data is to be written.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size Used by the server (ECU) to compare the uncompressed memory size with the total amount of
data transferred during the TransferData service.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
485
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestDownload_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] memory_address_buffer = new Byte[8];
Byte[] memory_size_buffer = new Byte[8];
Byte memory_address_size = 8;
Byte memory_size_size = 8;
uds_msgconfig config = new uds_msgconfig();
// Fill data
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[i] = (Byte)(Convert.ToByte('A') + i);
memory_size_buffer[i] = (Byte)(10 + i);
}
486
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ memory_address_buffer = gcnew array<Byte>(8);
array<Byte>^ memory_size_buffer = gcnew array<Byte>(8);
Byte memory_address_size = 8;
Byte memory_size_size = 8;
uds_msgconfig config = {};
// Fill data
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[i] = 'A' + i;
memory_size_buffer[i] = (10 + i);
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
487
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
memory_address_buffer: array [0 .. 7] of Byte;
memory_size_buffer: array [0 .. 7] of Byte;
memory_address_size: Byte;
memory_size_size: Byte;
i: UInt32;
begin
488
PCAN-UDS 2.x API – User Manual
memory_address_size := 8;
memory_size_size := 8;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill data
for i := 0 to memory_address_size - 1 do
begin
memory_address_buffer[i] := ($41 + i);
memory_size_buffer[i] := (10 + i);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
489
PCAN-UDS 2.x API – User Manual
3.7.101 SvcRequestUpload_2013
Writes a UDS request according to the RequestUpload service’s specifications. The RequestUpload service
is used by the client to initiate a data transfer from the server/ECU to the client (upload).
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcRequestUpload_2013")>
Public Shared Function SvcRequestUpload_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
490
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no compression
method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting method
is used.
memory_address Starting address of server (ECU) memory from which data is to be retrieved.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size Used by the server (ECU) to compare the uncompressed memory size with the total amount of data
transferred during the TransferData service.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestUpload_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
491
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] memory_address_buffer = new Byte[4];
Byte[] memory_size_buffer = new Byte[4];
Byte memory_address_size = 4;
Byte memory_size_size = 4;
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ memory_address_buffer = gcnew array<Byte>(4);
array<Byte>^ memory_size_buffer = gcnew array<Byte>(4);
Byte memory_address_size = 4;
Byte memory_size_size = 4;
uds_msgconfig config = {};
492
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
493
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
memory_address_buffer: array [0 .. 3] of Byte;
memory_size_buffer: array [0 .. 3] of Byte;
memory_address_size: Byte;
memory_size_size: Byte;
begin
memory_address_size := 4;
memory_size_size := 4;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
494
PCAN-UDS 2.x API – User Manual
3.7.102 SvcTransferData_2013
Writes a UDS request according to the TransferData service’s specifications. The TransferData service is
used by the client to transfer data either from the client to the server/ECU (download) or from the
server/ECU to the client (upload).
Overloads
Method Description
SvcTransferData_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte) TransferData, without transfer request parameter.
SvcTransferData_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte, byte[], UInt32) TransferData, with transfer request parameter.
Syntax
Pascal OO
C#
public static uds_status SvcTransferData_2013(
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request,
byte block_sequence_counter);
C++ / CLR
Visual Basic
495
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
block_sequence_counter The block_sequence_counter parameter value starts at 0x01 with the first TransferData
request that follows the RequestDownload (0x34) or RequestUpload (0x35) service. Its
value is incremented by 1 for each subsequent TransferData request. At the value of
0xFF, the block_sequence_counter rolls over and starts at 0x0 with the next
TransferData request message.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcTransferData_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
496
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
497
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr = &H0
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
498
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcTransferData_2013")]
public static extern uds_status SvcTransferData_2013(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request,
byte block_sequence_counter,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)]
byte[] transfer_request_parameter_record,
UInt32 transfer_request_parameter_record_size);
C++ / CLR
499
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcTransferData_2013")>
Public Shared Function SvcTransferData_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal block_sequence_counter As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal transfer_request_parameter_record As Byte(),
ByVal transfer_request_parameter_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
block_sequence_counter The block_sequence_counter parameter value starts at 0x01 with the first TransferData
request that follows the RequestDownload (0x34) or RequestUpload (0x35) service. Its
value is incremented by 1 for each subsequent TransferData request. At the value of
0xFF, the block_sequence_counter rolls over and starts at 0x0 with the next
TransferData request message.
transfer_request_parameter_record Buffer containing the required transfer parameters.
transfer_request_parameter_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
500
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcTransferData_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] record = new Byte[50];
Byte record_size = 50;
uds_msgconfig config = new uds_msgconfig();
// Fill data
for (int i = 0; i < record_size; i++)
{
record[i] = (Byte)(Convert.ToByte('A') + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ record = gcnew array<Byte>(50);
Byte record_size = 50;
uds_msgconfig config = {};
501
PCAN-UDS 2.x API – User Manual
config.can_id = PUDS_CAN_ID_ISO_15765_4_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Fill data
for (int i = 0; i < record_size; i++)
{
record[i] = 'A' + i;
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
502
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
param_record: array [0 .. 49] of Byte;
record_size: Byte;
i: UInt32;
begin
record_size := 50;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill data
for i := 0 to record_size - 1 do
begin
param_record[i] := ($41 + i);
end;
503
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.105 SvcRequestTransferExit_2013
Writes a UDS request according to the RequestTransferExit service’s specifications. The
RequestTransferExit service is used by the client to terminate a data transfer between the client and
server/ECU (upload or download).
Overloads
Method Description
SvcRequestTransferExit_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg) RequestTransferExit, wihtout transfer request parameter.
SvcRequestTransferExit_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], Uint32) RequestTransferExit, wiht transfer request parameter.
Syntax
Pascal OO
C#
504
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestTransferExit_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
505
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
506
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
507
PCAN-UDS 2.x API – User Manual
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
508
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcRequestTransferExit_2013")>
Public Shared Function SvcRequestTransferExit_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal transfer_request_parameter_record As Byte(),
ByVal transfer_request_parameter_record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
transfer_request_parameter_record Buffer containing the required transfer parameters.
transfer_request_parameter_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
509
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcRequestTransferExit_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
Byte[] transfer_request_parameter_record = new Byte[20];
Byte transfer_request_parameter_record_size = 20;
uds_msgconfig config = new uds_msgconfig();
// Fill data
for (int i = 0; i < transfer_request_parameter_record_size; i++)
{
transfer_request_parameter_record[i] = (Byte)(Convert.ToByte('A') + i);
}
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
array<Byte>^ transfer_request_parameter_record = gcnew array<Byte>(20);
Byte transfer_request_parameter_record_size = 20;
uds_msgconfig config = {};
510
PCAN-UDS 2.x API – User Manual
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Fill data
for (int i = 0; i < transfer_request_parameter_record_size; i++)
{
transfer_request_parameter_record[i] = 'A' + i;
}
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
511
PCAN-UDS 2.x API – User Manual
request_confirmation)
End If
If UDSApi.StatusIsOk_2013(result) Then
MessageBox.Show("Response was received", "Success")
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
transfer_request_parameter_record: array [0 .. 19] of Byte;
transfer_request_parameter_record_size: Byte;
i: UInt32;
begin
transfer_request_parameter_record_size := 20;
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Fill data
for i := 0 to transfer_request_parameter_record_size - 1 do
begin
transfer_request_parameter_record[i] := ($41 + i);
end;
512
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.108 SvcAccessTimingParameter_2013
Writes a UDS request according to the AccessTimingParameter service’s specifications.
Syntax
Pascal OO
C#
C++ / CLR
513
PCAN-UDS 2.x API – User Manual
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAccessTimingParameter_2013")>
Public Shared Function SvcAccessTimingParameter_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal access_type As uds_svc_param_atp,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal request_record As Byte(),
ByVal record_size As UInt32) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
access_type Access type (see uds_svc_param_atp on page 95).
request_record Timing parameter request record.
record_size Size in bytes of the request record.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcAccessTimingParameter_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
514
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
515
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request_record: array [0 .. 1] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
516
PCAN-UDS 2.x API – User Manual
response: uds_msg;
config: uds_msgconfig;
record_size: UInt32;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
517
PCAN-UDS 2.x API – User Manual
3.7.109 SvcRequestFileTransfer_2013
Writes a UDS request according to the SvcRequestFileTransfer service’s specifications.
Overloads
Method Description
SvcRequestFileTransfer_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rft_moop, RequestFileTransfer. Use with a mode of operation which does
UInt16, string) not require file compressed or uncompressed sizes, nor
compression or encrypting methods.
SvcRequestFileTransfer_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rft_moop, RequestFileTransfer. Use with a mode of operation which does
UInt16, string, byte, byte) not require file compressed or uncompressed sizes.
SvcRequestFileTransfer_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rft_moop, RequestFileTransfer.
UInt16, string, byte, byte, byte, byte[], byte[])
SvcRequestFileTransfer_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rft_moop, RequestFileTransfer. Use with a mode of operation which does
UInt16, byte[]) not require file compressed or uncompressed sizes, nor
compression or encrypting methods.
SvcRequestFileTransfer_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, out uds_msg, RequestFileTransfer. Use with a mode of operation which does
uds_svc_param_rft_moop, UInt16, byte[], byte, byte) not require file compressed or uncompressed sizes.
SvcRequestFileTransfer_2013(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, uds_svc_param_rft_moop, RequestFileTransfer.
UInt16, byte[], byte, byte, byte, byte[], byte[])
Syntax
Pascal OO
C#
518
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size File path and name string length.
file_path_and_name File path and name string.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
519
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
520
PCAN-UDS 2.x API – User Manual
request_confirmation);
if (UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Response was received", "Success");
else
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
file_name: PAnsichar;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
521
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
522
PCAN-UDS 2.x API – User Manual
mode_of_operation: uds_svc_param_rft_moop;
file_path_and_name_size: UInt16;
file_path_and_name: PAnsiChar;
compression_method: Byte;
encrypting_method: Byte
): uds_status; overload;
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size File path and name string length.
file_path_and_name File path and name string.
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
523
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
524
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
525
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
file_name: PAnsichar;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
526
PCAN-UDS 2.x API – User Manual
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcRequestFileTransfer_2013")]
public static extern uds_status SvcRequestFileTransfer_2013(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request,
[MarshalAs(UnmanagedType.U1)]
uds_svc_param_rft_moop mode_of_operation,
UInt16 file_path_and_name_size,
[MarshalAs(UnmanagedType.LPStr, SizeParamIndex = 4)]
string file_path_and_name,
byte compression_method,
byte encrypting_method,
byte file_size_parameter_size,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 8)]
527
PCAN-UDS 2.x API – User Manual
byte[] file_size_uncompressed,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 8)]
byte[] file_size_compressed);
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcRequestFileTransfer_2013")]
static uds_status SvcRequestFileTransfer_2013(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request,
[MarshalAs(UnmanagedType::U1)]
uds_svc_param_rft_moop mode_of_operation,
UInt16 file_path_and_name_size,
[MarshalAs(UnmanagedType::LPStr, SizeParamIndex = 4)]
String ^file_path_and_name,
Byte compression_method,
Byte encrypting_method,
Byte file_size_parameter_size,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 8)]
array<Byte> ^file_size_uncompressed,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 8)]
array<Byte> ^file_size_compressed);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcRequestFileTransfer_2013")>
Public Shared Function SvcRequestFileTransfer_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal mode_of_operation As uds_svc_param_rft_moop,
ByVal file_path_and_name_size As UInt16,
<MarshalAs(UnmanagedType.LPStr, SizeParamIndex:=4)>
ByVal file_path_and_name As String,
ByVal compression_method As Byte,
ByVal encrypting_method As Byte,
ByVal file_size_parameter_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal file_size_uncompressed As Byte(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal file_size_compressed As Byte()) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size File path and name string length.
file_path_and_name File path and name string.
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
file_size_parameter_size File size parameter length in byte
file_size_uncompressed Uncompressed file size.
528
PCAN-UDS 2.x API – User Manual
Parameter Description
file_size_compressed Compressed file size.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
529
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
530
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr = &H0
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
file_size_uncompressed: array [0 .. 1] of Byte;
file_size_compressed: array [0 .. 1] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
file_name: PAnsichar;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
531
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
532
PCAN-UDS 2.x API – User Manual
uds_svc_param_rft_moop mode_of_operation,
UInt16 file_path_and_name_size,
byte[] file_path_and_name);
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size File path and name string length.
file_path_and_name File path and name string.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
533
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
534
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
535
PCAN-UDS 2.x API – User Manual
response: uds_msg;
config: uds_msgconfig;
file_name: System.TArray<Byte>;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
result := TUDSApi.SvcRequestFileTransfer_2013
(cantp_handle.PCANTP_HANDLE_USBBUS1, config, request,
uds_svc_param_rft_moop.PUDS_SVC_PARAM_RFT_MOOP_DELFILE, 8,
PByte(file_name));
if TUDSApi.StatusIsOk_2013(result) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if TUDSApi.StatusIsOk_2013(result) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
536
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
537
PCAN-UDS 2.x API – User Manual
Parameter Description
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size File path and name string length.
file_path_and_name File path and name string.
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
538
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
539
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
file_name: System.TArray<Byte>;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
540
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
541
PCAN-UDS 2.x API – User Manual
uds_msgconfig request_config,
out uds_msg out_msg_request,
[MarshalAs(UnmanagedType.U1)]
uds_svc_param_rft_moop mode_of_operation,
UInt16 file_path_and_name_size,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)]
byte[] file_path_and_name,
byte compression_method,
byte encrypting_method,
byte file_size_parameter_size,
IntPtr file_size_uncompressed,
IntPtr file_size_compressed);
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcRequestFileTransfer_2013")>
Public Shared Function SvcRequestFileTransfer_2013(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.U1)>
ByVal mode_of_operation As uds_svc_param_rft_moop,
ByVal file_path_and_name_size As UInt16,
<MarshalAs(UnmanagedType.LPStr, SizeParamIndex:=4)>
ByVal file_path_and_name As String,
ByVal compression_method As Byte,
ByVal encrypting_method As Byte,
ByVal file_size_parameter_size As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal file_size_uncompressed As Byte(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=8)>
ByVal file_size_compressed As Byte()) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
542
PCAN-UDS 2.x API – User Manual
Parameter Description
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size File path and name string length.
file_path_and_name File path and name string.
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
file_size_parameter_size File size parameter length in byte
file_size_uncompressed Uncompressed file size.
file_size_compressed Compressed file size.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
Example
The following example shows the use of the service method SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
543
PCAN-UDS 2.x API – User Manual
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++ / CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
544
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
file_size_uncompressed: array [0 .. 1] of Byte;
file_size_compressed: array [0 .. 1] of Byte;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
file_name: System.TArray<Byte>;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
545
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.116 SvcAuthenticationDA_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction deAuthenticate is implicit.
Syntax
Pascal OO
class function SvcAuthenticationDA_2020(
channel: cantp_handle;
request_config: uds_msgconfig;
var out_msg_request: uds_msg
): uds_status;
546
PCAN-UDS 2.x API – User Manual
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcAuthenticationDA_2020")]
public static extern uds_status SvcAuthenticationDA_2020(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request);
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcAuthenticationDA_2020")]
static uds_status SvcAuthenticationDA_2020(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationDA_2020")>
Public Shared Function SvcAuthenticationDA_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
547
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcAuthenticationDA_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
548
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
549
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.117 SvcAuthenticationVCU_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyCertificateUnidirectional is implicit.
Overloads
Method Description
SvcAuthenticationVCU_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, Byte, byte[], UInt16, byte[], Authentication with verifyCertificateUnidirectional subfunction
UInt16) (ISO-14229-1:2020).
SvcAuthenticationVCU_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, Byte, byte[], UInt16) Authentication with verifyCertificateUnidirectional subfunction,
without challenge client buffer (ISO-14229-1:2020).
550
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcAuthenticationVCU_2020")]
static uds_status SvcAuthenticationVCU_2020(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request,
Byte communication_configuration,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 5)]
array<Byte> ^certificate_client,
UInt16 certificate_client_size,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 7)]
array<Byte> ^challenge_client,
UInt16 challenge_client_size);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationVCU_2020")>
Public S
hared Function SvcAuthenticationVCU_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
551
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
communication_configuration Configuration information about communication.
certificate_client Buffer containing the certificate of the client.
certificate_client_size Size in bytes of the certificate buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVCU_2020(cantp_handle,
uds_msgconfig, uds_msg, Byte, byte[], UInt16, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical
service request is transmitted, and the WaitForService_2013 method is called to get the response. Depending
on the result, a message will be shown to the user.
552
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
553
PCAN-UDS 2.x API – User Manual
UInt16 certificate_client_size = 2;
array<Byte>^ challenge_client = { 0x56, 0x78 };
UInt16 challenge_client_size = 2;
result = UDSApi::SvcAuthenticationVCU_2020(cantp_handle::PCANTP_HANDLE_USBBUS1, config,
request, communication_configuration, certificate_client, certificate_client_size,
challenge_client, challenge_client_size);
if (UDSApi::StatusIsOk_2013(result))
result = UDSApi::WaitForService_2013(cantp_handle::PCANTP_HANDLE_USBBUS1, request,
response, request_confirmation);
if (UDSApi::StatusIsOk_2013(result))
MessageBox::Show("Response was received", "Success");
else
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
554
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
communication_configuration: Byte;
certificate_client: array [0 .. 1] of Byte;
certificate_client_size: UInt16;
challenge_client: array [0 .. 1] of Byte;
challenge_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
// Free structures
555
PCAN-UDS 2.x API – User Manual
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
556
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
communication_configuration Configuration information about communication.
certificate_client Buffer containing the certificate of the client.
certificate_client_size Size in bytes of the certificate buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVCU_2020(cantp_handle,
uds_msgconfig, uds_msg, Byte, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service
request is transmitted, and the WaitForService_2013 method is called to get the response. Depending on the
result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
557
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
558
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
communication_configuration: Byte;
certificate_client: array [0 .. 1] of Byte;
certificate_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
559
PCAN-UDS 2.x API – User Manual
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.120 SvcAuthenticationVCB_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyCertificateBidirectional is implicit.
Syntax
Pascal OO
560
PCAN-UDS 2.x API – User Manual
challenge_client: PByte;
challenge_client_size: UInt16
): uds_status;
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationVCB_2020")>
Public Shared Function SvcAuthenticationVCB_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal communication_configuration As Byte,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal certificate_client As Byte(),
ByVal certificate_client_size As UInt16,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal challenge_client As Byte(),
ByVal challenge_client_size As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
communication_configuration Configuration information about communication.
certificate_client Buffer containing the certificate of the client.
561
PCAN-UDS 2.x API – User Manual
Parameter Description
certificate_client_size Size in bytes of the certificate buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVCB_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
562
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
563
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
communication_configuration: Byte;
certificate_client: array [0 .. 1] of Byte;
certificate_client_size: UInt16;
challenge_client: array [0 .. 1] of Byte;
challenge_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
564
PCAN-UDS 2.x API – User Manual
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
565
PCAN-UDS 2.x API – User Manual
3.7.121 SvcAuthenticationPOWN_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction proofOfOwnership is implicit.
Overloads
Method Description
SvcAuthenticationPOWN_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], UInt16, byte[], Authentication with proofOfOwnership subfunction (ISO-14229-
UInt16) 1:2020).
SvcAuthenticationPOWN_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], UInt16) Authentication with proofOfOwnership subfunction, without
ephemeral public key (ISO-14229-1:2020).
Plain function version: UDS_SvcAuthenticationPOWN_2020 on page 755.
Syntax
Pascal OO
C#
C++ / CLR
566
PCAN-UDS 2.x API – User Manual
UInt16 proof_of_ownership_client_size,
[MarshalAs(UnmanagedType::LPArray, SizeParamIndex = 6)]
array<Byte> ^ephemeral_public_key_client,
UInt16 ephemeral_public_key_client_size);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationPOWN_2020")>
Public Shared Function SvcAuthenticationPOWN_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal proof_of_ownership_client As Byte(),
proof_of_ownership_client_size As UInt16,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=6)>
ByVal ephemeral_public_key_client As Byte(),
ephemeral_public_key_client_size As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
ephemeral_public_key_client Buffer containing the ephemeral public key of the client.
ephemeral_public_key_client_size Size in bytes of the ephemeral public key buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
567
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service method SvcAuthenticationPOWN_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], UInt16, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical
service request is transmitted, and the WaitForService_2013 method is called to get the response. Depending
on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
568
PCAN-UDS 2.x API – User Manual
config.nai.source_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
569
PCAN-UDS 2.x API – User Manual
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
proof_of_ownership_client: array [0 .. 1] of Byte;
proof_of_ownership_client_size: UInt16;
ephemeral_public_key_client: array [0 .. 1] of Byte;
ephemeral_public_key_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
570
PCAN-UDS 2.x API – User Manual
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
571
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationPOWN_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request
is transmitted, and the WaitForService_2013 method is called to get the response. Depending on the result, a
message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
572
PCAN-UDS 2.x API – User Manual
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
573
PCAN-UDS 2.x API – User Manual
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
proof_of_ownership_client: array [0 .. 1] of Byte;
proof_of_ownership_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
574
PCAN-UDS 2.x API – User Manual
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.124 SvcAuthenticationRCFA_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction requestChallengeForAuthentication is implicit.
Syntax
Pascal OO
575
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationRCFA_2020")>
Public Shared Function SvcAuthenticationRCFA_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
ByVal communication_configuration As Byte,
ByVal algorithm_indicator As Byte()) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
communication_configuration Configuration information about communication.
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
576
PCAN-UDS 2.x API – User Manual
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter(see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationRCFA_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
577
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
578
PCAN-UDS 2.x API – User Manual
Else
' An error occurred
MessageBox.Show("An error occurred", "Error")
End If
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
communication_configuration: Byte;
algorithm_indicator: array [0 .. 15] of Byte;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
579
PCAN-UDS 2.x API – User Manual
if (TUDSApi.StatusIsOk_2013(result)) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if (TUDSApi.StatusIsOk_2013(result)) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.125 SvcAuthenticationVPOWNU_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyProofOfOwnershipUnidirectional is implicit.
Overloads
Method Description
SvcAuthenticationVPOWNU_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], byte[], UInt16, Authentication with verifyProofOfOwnershipUnidirectional
byte[], UInt16, byte[], UInt16) subfunction (ISO-14229-1:2020).
SvcAuthenticationVPOWNU_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], byte[], UInt16, Authentication with verifyProofOfOwnershipUnidirectional
byte[], UInt16) subfunction, without additional parameters (ISO-14229-1:2020).
SvcAuthenticationVPOWNU_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], byte[], UInt16) Authentication with verifyProofOfOwnershipUnidirectional
subfunction, without additional parameters, without challenge
client buffer (ISO-14229-1:2020).
Syntax
Pascal OO
580
PCAN-UDS 2.x API – User Manual
algorithm_indicator: PByte;
proof_of_ownership_client: PByte;
proof_of_ownership_client_size: UInt16;
challenge_client: PByte;
challenge_client_size: UInt16;
additional_parameter: PByte;
additional_parameter_size: UInt16
): uds_status; overload;
C#
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationVPOWNU_2020")>
Public Shared Function SvcAuthenticationVPOWNU_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal algorithm_indicator As Byte(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal proof_of_ownership_client As Byte(),
ByVal proof_of_ownership_client_size As UInt16,
581
PCAN-UDS 2.x API – User Manual
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal challenge_client As Byte(),
ByVal challenge_client_size As UInt16,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=9)>
ByVal additional_parameter As Byte(),
ByVal additional_parameter_size As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
additional_parameter Buffer containing additional parameters.
additional_parameter_size Size in bytes of the additional parameter buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVPOWNU_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], byte[], UInt16, byte[], UInt16, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A
UDS physical service request is transmitted, and the WaitForService_2013 method is called to get the response.
Depending on the result, a message will be shown to the user.
582
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
583
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
584
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
algorithm_indicator: array [0 .. 15] of Byte;
proof_of_ownership_client: array [0 .. 1] of Byte;
proof_of_ownership_client_size: UInt16;
challenge_client: array [0 .. 1] of Byte;
challenge_client_size: UInt16;
additional_parameter: array [0 .. 1] of Byte;
additional_parameter_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
585
PCAN-UDS 2.x API – User Manual
algorithm_indicator[14] := $0E;
algorithm_indicator[15] := $0F;
proof_of_ownership_client[0] := $12;
proof_of_ownership_client[1] := $34;
proof_of_ownership_client_size := 2;
challenge_client[0] := $56;
challenge_client[1] := $78;
challenge_client_size := 2;
additional_parameter[0] := $9A;
additional_parameter[1] := $BC;
additional_parameter_size := 2;
result := TUDSApi.SvcAuthenticationVPOWNU_2020
(cantp_handle.PCANTP_HANDLE_USBBUS1, config, request,
PByte(@algorithm_indicator), PByte(@proof_of_ownership_client),
proof_of_ownership_client_size, PByte(@challenge_client),
challenge_client_size, PByte(@additional_parameter),
additional_parameter_size);
if (TUDSApi.StatusIsOk_2013(result)) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if (TUDSApi.StatusIsOk_2013(result)) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
586
PCAN-UDS 2.x API – User Manual
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
587
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter(see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVPOWNU_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], byte[], UInt16, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical
service request is transmitted, and the WaitForService_2013 method is called to get the response. Depending
on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
588
PCAN-UDS 2.x API – User Manual
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
589
PCAN-UDS 2.x API – User Manual
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
590
PCAN-UDS 2.x API – User Manual
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
591
PCAN-UDS 2.x API – User Manual
Syntax
Pascal OO
C#
C++ / CLR
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
592
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVPOWNU_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service
request is transmitted, and the WaitForService_2013 method is called to get the response. Depending on the
result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
593
PCAN-UDS 2.x API – User Manual
if (UDSApi.StatusIsOk_2013(result))
result = UDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1, ref request, out
response, out request_confirmation);
if (UDSApi.StatusIsOk_2013(result))
MessageBox.Show("Response was received", "Success");
else
// An error occurred
MessageBox.Show("An error occurred", "Error");
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
594
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
algorithm_indicator: array [0 .. 15] of Byte;
proof_of_ownership_client: array [0 .. 1] of Byte;
proof_of_ownership_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
595
PCAN-UDS 2.x API – User Manual
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
596
PCAN-UDS 2.x API – User Manual
3.7.129 SvcAuthenticationVPOWNB_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyProofOfOwnershipBidirectional is implicit.
Overloads
Method Description
SvcAuthenticationVPOWNB_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], byte[], UInt16, Authentication with verifyProofOfOwnershipBidirectional
byte[], UInt16, byte[], UInt16) subfunction (ISO-14229-1:2020).
SvcAuthenticationVPOWNB_2020(cantp_handle, Writes to the transmit queue a request for UDS service
uds_msgconfig, uds_msg, byte[], byte[], UInt16, Authentication with verifyProofOfOwnershipBidirectional
byte[], UInt16) subfunction, without additional parameters (ISO-14229-1:2020).
Plain function version: UDS_SvcAuthenticationVPOWNB_2020 on page 761.
Syntax
Pascal OO
C#
597
PCAN-UDS 2.x API – User Manual
C++ / CLR
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationVPOWNB_2020")>
Public Shared Function SvcAuthenticationVPOWNB_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=4)>
ByVal algorithm_indicator As Byte(),
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=5)>
ByVal proof_of_ownership_client As Byte(),
ByVal proof_of_ownership_client_size As UInt16,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=7)>
ByVal challenge_client As Byte(),
ByVal challenge_client_size As UInt16,
<MarshalAs(UnmanagedType.LPArray, SizeParamIndex:=9)>
ByVal additional_parameter As Byte(),
ByVal additional_parameter_size As UInt16) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator.
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
additional_parameter Buffer containing additional parameters.
additional_parameter Size in bytes of the additional parameter buffer.
598
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVPOWNB_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], byte[], UInt16, byte[], UInt16, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A
UDS physical service request is transmitted, and the WaitForService_2013 method is called to get the response.
Depending on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
599
PCAN-UDS 2.x API – User Manual
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
// Free structures
600
PCAN-UDS 2.x API – User Manual
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
algorithm_indicator: array [0 .. 15] of Byte;
proof_of_ownership_client: array [0 .. 1] of Byte;
proof_of_ownership_client_size: UInt16;
challenge_client: array [0 .. 1] of Byte;
601
PCAN-UDS 2.x API – User Manual
challenge_client_size: UInt16;
additional_parameter: array [0 .. 1] of Byte;
additional_parameter_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
602
PCAN-UDS 2.x API – User Manual
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
Syntax
Pascal OO
C#
C++ / CLR
603
PCAN-UDS 2.x API – User Manual
UInt16 proof_of_ownership_client_size,
array<Byte> ^challenge_client,
UInt16 challenge_client_size);
Visual Basic
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator.
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationVPOWNB_2020(cantp_handle,
uds_msgconfig, uds_msg, byte[], byte[], UInt16, byte[], UInt16) on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical
604
PCAN-UDS 2.x API – User Manual
service request is transmitted, and the WaitForService_2013 method is called to get the response. Depending
on the result, a message will be shown to the user.
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
605
PCAN-UDS 2.x API – User Manual
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
606
PCAN-UDS 2.x API – User Manual
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
algorithm_indicator: array [0 .. 15] of Byte;
proof_of_ownership_client: array [0 .. 1] of Byte;
proof_of_ownership_client_size: UInt16;
challenge_client: array [0 .. 1] of Byte;
challenge_client_size: UInt16;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
607
PCAN-UDS 2.x API – User Manual
proof_of_ownership_client_size := 2;
challenge_client[0] := $56;
challenge_client[1] := $78;
challenge_client_size := 2;
result := TUDSApi.SvcAuthenticationVPOWNB_2020
(cantp_handle.PCANTP_HANDLE_USBBUS1, config, request,
PByte(@algorithm_indicator), PByte(@proof_of_ownership_client),
proof_of_ownership_client_size, PByte(@challenge_client),
challenge_client_size);
if (TUDSApi.StatusIsOk_2013(result)) then
begin
result := TUDSApi.WaitForService_2013(cantp_handle.PCANTP_HANDLE_USBBUS1,
@request, response, @request_confirmation);
end;
if (TUDSApi.StatusIsOk_2013(result)) then
begin
MessageBox(0, 'Response was received', 'Success', MB_OK);
end
else
begin
// An error occurred
MessageBox(0, 'An error occurred', 'Error', MB_OK);
end;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.132 SvcAuthenticationAC_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction authenticationConfiguration is implicit.
Syntax
Pascal OO
class function SvcAuthenticationAC_2020(
channel: cantp_handle;
request_config: uds_msgconfig;
var out_msg_request: uds_msg
): uds_status;
C#
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcAuthenticationAC_2020")]
public static extern uds_status SvcAuthenticationAC_2020(
[MarshalAs(UnmanagedType.U4)]
cantp_handle channel,
uds_msgconfig request_config,
out uds_msg out_msg_request);
608
PCAN-UDS 2.x API – User Manual
C++ / CLR
[DllImport("PCAN-UDS.dll", EntryPoint = "UDS_SvcAuthenticationAC_2020")]
static uds_status SvcAuthenticationAC_2020(
[MarshalAs(UnmanagedType::U4)]
cantp_handle channel,
uds_msgconfig request_config,
uds_msg %out_msg_request);
Visual Basic
<DllImport("PCAN-UDS.dll", EntryPoint:="UDS_SvcAuthenticationAC_2020")>
Public Shared Function SvcAuthenticationAC_2020(
<MarshalAs(UnmanagedType.U4)>
ByVal channel As cantp_handle,
ByVal request_config As uds_msgconfig,
ByRef out_msg_request As uds_msg) As uds_status
End Function
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the method (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with Reset_2013 (see Reset_2013 on
page 234).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see MsgFree_2013 on page 214).
Remarks
This method creates a new message using a given message configuration and set the given data according
to the service’s specifications. It then writes the message to the transmit queue. Once processed, this
request message should be released (see MsgFree_2013 on page 214).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service method SvcAuthenticationAC_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the WaitForService_2013 method
is called to get the response. Depending on the result, a message will be shown to the user.
609
PCAN-UDS 2.x API – User Manual
C#
uds_status result;
uds_msg request = new uds_msg();
uds_msg request_confirmation = new uds_msg();
uds_msg response = new uds_msg();
uds_msgconfig config = new uds_msgconfig();
// Free structures
UDSApi.MsgFree_2013(ref request);
UDSApi.MsgFree_2013(ref response);
UDSApi.MsgFree_2013(ref request_confirmation);
C++/CLR
uds_status result;
uds_msg request = {};
uds_msg request_confirmation = {};
uds_msg response = {};
uds_msgconfig config = {};
610
PCAN-UDS 2.x API – User Manual
// An error occurred
MessageBox::Show("An error occurred", "Error");
// Free structures
UDSApi::MsgFree_2013(request);
UDSApi::MsgFree_2013(response);
UDSApi::MsgFree_2013(request_confirmation);
Visual Basic
Pascal OO
var
result: uds_status;
request: uds_msg;
request_confirmation: uds_msg;
response: uds_msg;
config: uds_msgconfig;
begin
FillChar(request, sizeof(request), 0);
FillChar(request_confirmation, sizeof(request_confirmation), 0);
FillChar(response, sizeof(response), 0);
611
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr := $0;
config.nai.protocol :=
uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT);
config.nai.target_addr :=
UInt16(uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1);
config.nai.target_type :=
cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.typem := uds_msgtype.PUDS_MSGTYPE_USDT;
// Free structures
TUDSApi.MsgFree_2013(request);
TUDSApi.MsgFree_2013(response);
TUDSApi.MsgFree_2013(request_confirmation);
end;
3.7.133 GetDataServiceId_2013
This method is a C# and VB helper: it gets PUDS message data service identifier in a safe way.
Syntax
C#
Visual Basic
Public Shared Function GetDataServiceId_2013(
ByRef msg As uds_msg,
ByRef val As Byte) As Boolean
End Function
612
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
msg UDS message containing the service identifier (see uds_msg on page 21).
val Output, service identifier value.
Returns
True if ok, false if not ok.
Example
The following example shows the use of the method GetDataServiceId_2013 . It allocates a message, sets a
service identifier, gets it, and prints it.
C#
Visual Basic
613
PCAN-UDS 2.x API – User Manual
uds_service.PUDS_SERVICE_SI_ClearDiagnosticInformation)
Dim service_id As Byte
If UDSApi.GetDataServiceId_2013(request, service_id) Then
MessageBox.Show("Set request service id = " + service_id.ToString(), "Success")
Else
MessageBox.Show("An error occurred", "Error")
End If
End If
3.7.134 SetDataServiceId_2013
This method is a C# and VB helper: it sets PUDS message data service id, in a safe way.
Syntax
C#
Visual Basic
Parameters
Parameter Description
msg UDS message containing the service identifier (see uds_msg on page 21).
val New service identifier value.
Returns
True if ok, false if not ok.
Example
The following example shows the use of the method SetDataServiceId_2013 . It allocates a message, sets a
service identifier, gets it, and prints it.
C#
614
PCAN-UDS 2.x API – User Manual
{
UDSApi.SetDataServiceId_2013(ref request,
(byte)uds_service.PUDS_SERVICE_SI_ClearDiagnosticInformation);
Byte service_id;
if (UDSApi.GetDataServiceId_2013(ref request, out service_id))
{
MessageBox.Show("Set request service id = " + service_id, "Success");
}
else
{
MessageBox.Show("An error occurred", "Error");
}
}
Visual Basic
3.7.135 GetDataNrc_2013
This method is a C# and VB helper: it gets PUDS message data negative response code (nrc) in a safe way.
Syntax
C#
Visual Basic
615
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
msg UDS message containing the nrc (see uds_msg on page 21).
val Output, nrc value.
Returns
True if ok, false if not ok.
Example
The following example shows the use of the method GetDataNrc_2013 . It allocates a message, a nrc pointer,
sets a new NRC value, then gets, and prints this value.
C#
Visual Basic
616
PCAN-UDS 2.x API – User Manual
UDSApi.SetDataNrc_2013(response, UDSApi.PUDS_NRC_EXTENDED_TIMING)
Dim nrc As Byte
If UDSApi.GetDataNrc_2013(response, nrc) Then
MessageBox.Show("Set NRC extended timing value = " + nrc.ToString(), "Success")
Else
MessageBox.Show("An error occurred", "Error")
End If
End If
3.7.136 SetDataNrc_2013
This method is a C# and VB helper: it sets PUDS message data negative response code (nrc) in a safe way.
Syntax
C#
Visual Basic
Parameters
Parameter Description
msg UDS message containing the nrc (see uds_msg on page 21).
val New nrc value.
Returns
True if ok, false if not ok.
Example
The following example shows the use of the method SetDataNrc_2013 . It allocates a message, a nrc pointer,
sets a new NRC value, then gets, and prints this value. Depending on the result, a message will be shown
to the user.
C#
617
PCAN-UDS 2.x API – User Manual
Visual Basic
UDSApi.SetDataNrc_2013(response, UDSApi.PUDS_NRC_EXTENDED_TIMING)
Dim nrc As Byte
If UDSApi.GetDataNrc_2013(response, nrc) Then
MessageBox.Show("Set NRC extended timing value = " + nrc.ToString(), "Success")
Else
MessageBox.Show("An error occurred", "Error")
End If
End If
618
PCAN-UDS 2.x API – User Manual
3.7.137 GetDataParameter_2013
This method is a C# and VB helper: it gets PUDS message data parameter in a safe way.
Syntax
C#
public static bool GetDataParameter_2013(
ref uds_msg msg,
int nump,
out Byte val);
Visual Basic
Public Shared Function GetDataParameter_2013(
ByRef msg As uds_msg,
ByVal nump As Integer,
ByRef val As Byte) As Boolean
End Function
Parameters
Parameter Description
msg UDS message containing the data parameter (see uds_msg on page 21).
nump Data parameter number (index start from 0).
val Output, data parameter value.
Returns
True if ok, false if not ok.
Example
The following example shows the use of the method GetDataParameter_2013 . It sets a new data parameter,
gets it, and prints it.
C#
uds_msgconfig config = new uds_msgconfig();
config.can_id = (UInt16)uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1;
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.extension_addr = 0;
619
PCAN-UDS 2.x API – User Manual
Visual Basic
UDSApi.SetDataParameter_2013(response, 0, 42)
Dim param As Byte
If UDSApi.GetDataParameter_2013(response, 0, param) Then
MessageBox.Show("Set param[0] = " + param.ToString(), "Success")
Else
MessageBox.Show("An error occurred", "Error")
End If
End If
3.7.138 SetDataParameter_2013
This method is a C# and VB helper: it sets PUDS message data parameter in a safe way.
Syntax
C#
Visual Basic
Parameters
Parameter Description
msg PUDS message containing the data parameter (see uds_msg on page 21).
nump Data parameter number (index start from 0).
val New data parameter value.
Returns
True if ok, false if not ok.
620
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the method SetDataParameter_2013 . It sets a new data parameter,
gets it, and prints it.
C#
uds_msgconfig config = new uds_msgconfig();
config.can_id = (UInt16)uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1;
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = uds_msgtype.PUDS_MSGTYPE_USDT;
config.nai.source_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_addr = (UInt16)uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.extension_addr = 0;
Visual Basic
Dim config As uds_msgconfig = New uds_msgconfig()
config.can_id = uds_can_id.PUDS_CAN_ID_ISO_15765_4_PHYSICAL_RESPONSE_1
config.can_msgtype = cantp_can_msgtype.PCANTP_CAN_MSGTYPE_STANDARD
config.nai.protocol = uds_msgprotocol.PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL
config.nai.target_type = cantp_isotp_addressing.PCANTP_ISOTP_ADDRESSING_PHYSICAL
config.type = uds_msgtype.PUDS_MSGTYPE_USDT
config.nai.source_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_ECU_1
config.nai.target_addr = uds_address.PUDS_ADDRESS_ISO_15765_4_ADDR_TEST_EQUIPMENT
config.nai.extension_addr = 0
UDSApi.SetDataParameter_2013(response, 0, 42)
Dim param As Byte
If UDSApi.GetDataParameter_2013(response, 0, param) Then
MessageBox.Show("Set param[0] = " + param.ToString(), "Success")
Else
MessageBox.Show("An error occurred", "Error")
End If
End If
621
PCAN-UDS 2.x API – User Manual
3.8 Functions
The functions of the PCAN-UDS 2.x API are divided into 5 groups of functionalities.
Connection
Function Description
UDS_Initialize_2013 Initializes a PUDS channel based on a PCANTP Channel handle (without CAN FD support).
UDS_InitializeFD_2013 Initializes a PUDS channel based on a PCANTP Channel handle (including CAN FD support).
Configuration
Function Description
UDS_SetValue_2013 Sets a configuration or information value within a PUDS channel.
UDS_AddMapping_2013 Adds a user-defined mapping between a CAN identifier and a network address
information.
UDS_RemoveMappingByCanId_2013 Removes all user defined PUDS mappings corresponding to a CAN identifier.
Information
Function Description
UDS_GetValue_2013 Retrieves information from a PUDS channel.
UDS_GetCanBusStatus_2013 Gets information about the internal BUS status of a PUDS channel.
UDS_GetMapping_2013 Retrieves a mapping matching the given CAN identifier and message type (11bits,
29 bits, FD, etc.).
UDS_GetMappings_2013 Retrieves all the PUDS mappings defined for a PUDS channel.
Message handling
Function Description
UDS_MsgAlloc_2013 Allocates a PUDS message using the given configuration.
UDS_MsgFree_2013 Deallocates a PUDS message.
UDS_MsgCopy_2013 Copies a PUDS message to another buffer.
UDS_MsgMove_2013 Moves a PUDS message to another buffer (and cleans the original message structure).
622
PCAN-UDS 2.x API – User Manual
Communication
Function Description
UDS_Read_2013 Reads a message from the receive queue of a PUDS channel.
UDS_SvcECUReset_2013 Writes to the transmit queue a request for UDS service ECUReset.
UDS_SvcLinkControl_2013 Writes to the transmit queue a request for UDS service LinkControl.
623
PCAN-UDS 2.x API – User Manual
Function Description
UDS_SvcDynamicallyDefineDataIdentifierDBMA_2013 Writes to the transmit queue a request for UDS service
DynamicallyDefineDataIdentifier.
624
PCAN-UDS 2.x API – User Manual
Function Description
UDS_SvcInputOutputControlByIdentifier_2013 Writes to the transmit queue a request for UDS service
InputOutputControlByIdentifier.
3.8.1 UDS_Initialize_2013
Initializes a PUDS channel based on a PCANTP channel handle (without CAN FD support).
Syntax
C
uds_status UDS_Initialize_2013(
cantp_handle channel,
cantp_baudrate baudrate,
cantp_hwtype hw_type,
uint32_t io_port,
uint16_t interrupt);
625
PCAN-UDS 2.x API – User Manual
C++
uds_status UDS_Initialize_2013(
cantp_handle channel,
cantp_baudrate baudrate,
cantp_hwtype hw_type = 0,
uint32_t io_port = 0,
uint16_t interrupt = 0);
Parameters
Parameter Description
channel The handle of a PCANTP channel (see cantp_handle on page 105).
baudrate The speed for the communication (see cantp_baudrate on page 116).
hw_type Non-plug and play: the type of hardware (see cantp_hwtype on page 113).
io_port Non-plug and play: the I/O address for the parallel port.
interrupt Non-plug and play: interrupt number of the parallel port.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
As indicated by its name, the UDS_Initialize_2013 function initiates a PUDS channel, preparing it for
communication within the CAN bus connected to it. Calls to the other functions will fail if they are used
with a channel handle, different than PCANTP_HANDLE_NONEBUS , that has not been initialized yet. Each
initialized channel should be released when it is not needed anymore.
To configure default standard ISO-TP mappings (see UDS and ISO-TP Network Addressing Information
on page 771):
• Functional request using 11 bits CAN identifier and normal addressing, from External Test
Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) to OBD functional address
( PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL ),
• Physical requests and responses using 11 bits CAN identifier and normal addressing, between the
External Test Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) and standard ECU
addresses (ECU #1 to #8)
To configure PCAN-ISO-TP 3.x to filter CAN frames to increase performance (frames that do not match
a mapping or a CAN ID in the white-list filter are ignored and discarded).
626
PCAN-UDS 2.x API – User Manual
The initialization process will fail if an application tries to initialize a PCANTP channel handle that has
already been initialized within the same process.
Take into consideration that initializing a channel causes a reset of the CAN hardware. In this way errors
like BUSOFF, BUSHEAVY, and BUSLIGHT, are removed.
Example
The following example shows the initialize and uninitialized processes for a Plug-And-Play channel
(channel 2 of the PCAN-PCI).
C/C++
uds_status result;
3.8.2 UDS_InitializeFD_2013
Initializes a PUDS channel based on a PCANTP channel handle (including CAN FD support).
Syntax
C/C++
uds_status UDS_InitializeFD_2013(
cantp_handle channel,
const cantp_bitrate bitrate_fd);
Parameters
Parameter Description
channel The handle of a FD capable PUDS channel (see cantp_handle on page 105).
bitrate_fd The speed for the communication (see cantp_bitrate on page 101, FD Bit Rate Parameter Definitions on
page 102).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
627
PCAN-UDS 2.x API – User Manual
Remarks
The UDS_InitializeFD_2013 function initiates a FD capable PUDS channel, preparing it for communication within
the CAN bus connected to it. Calls to the other functions will fail, if they are used with a channel handle,
different than PCANTP_HANDLE_NONEBUS , that has not been initialized yet. Each initialized channel should be
released when it is not needed anymore.
To configure default standard ISO-TP mappings (see UDS and ISO-TP Network Addressing Information
on page 771):
• Functional request using 11 bits CAN identifier and normal addressing, from External Test
Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) to OBD functional address
( PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL ),
• Physical requests and responses using 11 bits CAN identifier and normal addressing, between the
External Test Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) and standard ECU
addresses (ECU #1 to #8)
To configure PCAN-ISO-TP 3.x to filter CAN frames to increase performance (frames that do not match
a mapping or a CAN ID in the white-list filter are ignored and discarded).
The initialization process will fail if an application tries to initialize a PCANTP channel handle that has
already been initialized within the same process.
Take into consideration, that initializing a channel causes a reset of the CAN hardware. In this way errors
like BUSOFF, BUSHEAVY, and BUSLIGHT, are removed.
Example
The following example shows the initialize and uninitialized processes for a Plug and Play, FD capable
channel (channel 2 of a PCAN-USB hardware).
C/C++
uds_status result;
See also: on page 629, Using PCAN-UDS 2.x on page 12, cantp_bitrate on page 101,
UDS_Uninitialize_2013 FD Bit Rate
on page 102.
Parameter Definitions
Class-method version: InitializeFD_2013 on page 148.
628
PCAN-UDS 2.x API – User Manual
3.8.3 UDS_Uninitialize_2013
Uninitializes a PUDS channel.
Syntax
C/C++
uds_status UDS_Uninitialize_2013(
cantp_handle channel);
Parameters
Parameter Description
channel The handle of a PCANTP channel handle (see cantp_handle on page 105).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel cannot be uninitialized because it was not found in
the list of reserved channels of the calling application.
Remarks
A PUDS channel can be released using one of these possibilities:
Single-Release: Giving the handle of a PUDS channel initialized before with the function
UDS_Initialize_2013 . If the given channel cannot be found, then an error is returned.
Multiple-Release: Giving the handle value PCANTP_HANDLE_NONEBUS which instructs the API to search
for all channels initialized by the calling application and release them all. This option causes no errors
if no hardware were uninitialized.
Example
The following example shows the initialize and uninitialized processes for a Plug-And-Play channel
(channel 2 of a PCAN-PCI hardware).
C/C++
uds_status result;
// Release channel
result = UDS_Uninitialize_2013(PCANTP_HANDLE_PCIBUS2);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Uninitialization failed\n");
else
printf("PCAN-PCI (Ch-2) was released\n");
629
PCAN-UDS 2.x API – User Manual
3.8.4 UDS_SetValue_2013
Sets a configuration or information value within a PUDS channel.
Syntax
C/C++
uds_status UDS_SetValue_2013(
cantp_handle channel,
uds_parameter parameter,
void* buffer,
uint32_t buffer_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Parameter The code of the value to be set (see uds_parameter on page 41).
Buffer The buffer containing the value to be set.
Buffer_size The size in bytes of the given buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the function are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Remarks
Use the function UDS_SetValue_2013 to set configuration information or environment values of a PUDS
channel.
Note: That any calls with non PCAN-UDS 2.x API parameters (i.e. uds_parameter ) will be forwarded to
PCAN-ISO-TP 3.x API or PCAN-Basic API.
More information about the parameters and values that can be set can be found in Detailed Parameters
Characteristics on page 45.
Example
The following example shows the use of the function UDS_SetValue_2013 on the channel
PCANTP_HANDLE_PCIBUS2 to enable debug mode.
630
PCAN-UDS 2.x API – User Manual
See also: UDS_GetValue_2013 on page 631, uds_parameter on page 41, Detailed Parameters Characteristics on
page 45.
Class-method version: SetValue_2013 on page 153.
3.8.5 UDS_GetValue_2013
Retrieves information from a PUDS channel.
Syntax
C/C++
uds_status UDS_GetValue_2013(
cantp_handle channel,
uds_parameter parameter,
void* buffer,
uint32_t buffer_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
parameter The code of the value to retrieve (see uds_parameter on page 41).
buffer The buffer to return the required value.
buffer_size The size in bytes of the given buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the function are invalid. Check the value of the
buffer and assert it is compatible with the buffer length.
Example
The following example shows the use of the function UDS_GetValue_2013 to retrieve the separation time
parameter (STmin) on the USB channel 1. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uint8_t buffer = 0;
631
PCAN-UDS 2.x API – User Manual
See also: UDS_SetValue_2013 on page 630, uds_parameter on page 41, Detailed Parameters Characteristics on
page 45.
Class-method version: GetValue_2013 on page 178.
3.8.6 UDS_AddMapping_2013
Adds a user-defined mapping between a CAN identifier and a network address information. Defining a
mapping enables PCAN-ISO-TP 3.x communication with 11Bits CAN identifier or with opened Addressing
Formats (like PCANTP_ISOTP_FORMAT_NORMAL or PCANTP_ISOTP_FORMAT_EXTENDED ).
Syntax
C/C++
uds_status UDS_AddMapping_2013(
cantp_handle channel,
uds_mapping* mapping);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Mapping PUDS mapping to be added (see uds_mapping on page 25).
Remark
By default, some mappings are initialized in the PCAN-UDS 2.x API (see UDS and ISO-TP Network
Addressing Information on page 771).
With version 1.0, to handle custom ISO-TP messages, support advised to use CANTP_AddMapping
function in conjunction with PCAN-UDS. Updates of version 1 then added new parameters to manage
mappings (like PUDS_PARAM_ADD_MAPPING). With version 2.0, PCAN-UDS will ignore ISO-TP
messages that do not strictly correspond to the mappings and the configuration of the UDS node. It is
now advised not to directly use lower APIs to define mappings for higher layer API. Nevertheless, to
ensure retro-compatibility, an ISO-TP message (with no mapping defined in UDS) will still be readable in
UDS if its target address matches the server address.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the given mapping is null.
PUDS_STATUS_ALREADY_INITIALIZED A mapping with the same CAN identifier already exists.
PUDS_STATUS_MAPPING_INVALID Mapping is not valid regarding the UDS standard.
PUDS_STATUS_NO_MEMORY Failed to allocate memory to define mapping.
Example
The following example shows the use of the function UDS_AddMapping_2013 on the USB channel 1. It creates
mappings to communicate with custom CAN identifiers between test equipment and ECU 1 in ISO-15765-
2 11bits normal addressing on initialized USB channel 1:
Set CAN identifier = 0x123 and flow control id = 0x124 for request and set CAN identifier = 0x124 and
flow control id = 0x123 for response. Test equipment address corresponds to 0xF1 and ECU 1
address corresponds to 0x01. Here is a small scheme of the mapping:
632
PCAN-UDS 2.x API – User Manual
Request
External test ECU 1
equipment (ID=0x01)
(ID=0xF1)
Response
C/C++
uds_mapping request_mapping;
memset(&request_mapping, 0, sizeof(request_mapping));
request_mapping.can_id = 0x123;
request_mapping.can_id_flow_ctrl = 0x124;
request_mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.extension_addr = 0;
request_mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
request_mapping.can_tx_dlc = 8;
request_mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
request_mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
request_mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
uds_mapping response_mapping;
memset(&response_mapping, 0, sizeof(response_mapping));
response_mapping = request_mapping;
response_mapping.can_id = request_mapping.can_id_flow_ctrl;
response_mapping.can_id_flow_ctrl = request_mapping.can_id;
response_mapping.nai.source_addr = request_mapping.nai.target_addr;
response_mapping.nai.target_addr = request_mapping.nai.source_addr;
uds_status status;
status = UDS_AddMapping_2013(PCANTP_HANDLE_USBBUS1, &request_mapping);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Add request mapping\n");
else
printf("Failed to add request mapping\n");
status = UDS_AddMapping_2013(PCANTP_HANDLE_USBBUS1, &response_mapping);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Add response mapping\n");
else
printf("Failed to add response mapping\n");
633
PCAN-UDS 2.x API – User Manual
3.8.7 UDS_RemoveMappingByCanId_2013
Removes all user defined PUDS mappings corresponding to a CAN identifier.
Syntax
C/C++
uds_status UDS_RemoveMappingByCanId_2013(
cantp_handle channel,
uint32_t can_id);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
can_id The mapped CAN identifier to search for that identifies the mappings to remove (see predefined
uds_can_id values on page 58).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels
of the calling application.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The CAN identifier to remove is not specified in a mapping.
Example
The following example shows the use of the function UDS_RemoveMappingByCanId_2013 on the USB channel 1.
It creates a mapping then removes it using its CAN identifier on initialized USB channel 1:
C/C++
uds_mapping request_mapping;
memset(&request_mapping, 0, sizeof(request_mapping));
request_mapping.can_id = 0x123;
request_mapping.can_id_flow_ctrl = 0x124;
request_mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.extension_addr = 0;
request_mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
request_mapping.can_tx_dlc = 8;
request_mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
request_mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
request_mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
uds_status status;
status = UDS_AddMapping_2013(PCANTP_HANDLE_USBBUS1, &request_mapping);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
{
// Remove mapping using its can identifier
status = UDS_RemoveMappingByCanId_2013(PCANTP_HANDLE_USBBUS1, 0x123);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Remove request mapping using its can identifier\n",);
else
printf("Failed to remove request mapping\n");
}
else
634
PCAN-UDS 2.x API – User Manual
{
printf("Failed to add request mapping\n");
}
See also: uds_mapping on page 25, UDS_RemoveMapping_2013 on page 635, UDS_AddMapping_2013 on page 632.
Class-method version: RemoveMappingByCanId_2013 on page 171.
3.8.8 UDS_RemoveMapping_2013
Removes a user defined PUDS mapping.
Syntax
C/C++
uds_status UDS_RemoveMapping_2013(
cantp_handle channel,
uds_mapping mapping);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
mapping The mapping to remove (see uds_mapping on page 25).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The mapping is not a valid mapping.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping is not in the mapping list.
Example
The following example shows the use of the function UDS_RemoveMapping_2013 on the USB channel 1. It
creates a mapping then removes it.
C/C++
uds_mapping request_mapping;
memset(&request_mapping, 0, sizeof(request_mapping));
request_mapping.can_id = 0x123;
request_mapping.can_id_flow_ctrl = 0x124;
request_mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
request_mapping.nai.extension_addr = 0;
request_mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
request_mapping.can_tx_dlc = 8;
request_mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
request_mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
request_mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
uds_status status;
status = UDS_AddMapping_2013(PCANTP_HANDLE_USBBUS1, &request_mapping);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
{
// Remove the request mapping
635
PCAN-UDS 2.x API – User Manual
See also: uds_mapping on page 25, UDS_RemoveMappingByCanId_2013 on page 634, UDS_AddMapping_2013 on page
632.
Class-method version: RemoveMapping_2013 on page 168.
3.8.9 UDS_AddCanIdFilter_2013
Adds an entry to the CAN identifier white-list filtering. This function allows the user to listen to non-UDS
CAN frames or UUDT messages with no configured mapping.
Syntax
C/C++
uds_status UDS_AddCanIdFilter_2013(
cantp_handle channel,
uint32_t can_id);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
can_id CAN identifier to add in the white-list (see predefined uds_can_id values on page 58).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application.
PUDS_STATUS_ALREADY_INITIALIZED The CAN identifier is already in the white list.
PUDS_STATUS_NO_MEMORY Memory allocation error when adding the new element in the white list.
Example
The following example shows the use of the function UDS_AddCanIdFilter_2013 the channel
PCANTP_HANDLE_USBBUS1 . It adds a filter on 0xD1 CAN identifier.
636
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
result = UDS_AddCanIdFilter_2013(PCANTP_HANDLE_USBBUS1, 0xD1);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf(“Error adding CAN ID filter.\n”);
3.8.10 UDS_RemoveCanIdFilter_2013
Removes an entry from the CAN identifier white-list filtering.
Syntax
C/C++
uds_status UDS_RemoveCanIdFilter_2013(
cantp_handle channel,
uint32_t can_id);
Parameters
Parameter Description
Channel The handle of a PUDS channel (see cantp_handle on page 105).
can_id CAN identifier to remove (see predefined uds_can_id values on page 58).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of the
calling application. Or the CAN identifier is not in the white list.
Example
The following example shows the use of the function UDS_RemoveCanIdFilter_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It adds a filter on 0xD1 CAN identifier then removes it.
C/C++
uds_status result;
result = UDS_AddCanIdFilter_2013(PCANTP_HANDLE_USBBUS1, 0xD1);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Error adding CAN ID filter.\n");
637
PCAN-UDS 2.x API – User Manual
3.8.11 UDS_GetMapping_2013
Retrieves a mapping matching the given CAN identifier and message type (11bits, 29 bits, FD, etc.).
Syntax
C/C++
uds_status UDS_GetMapping_2013(
cantp_handle channel,
uds_mapping* buffer,
uint32_t can_id,
cantp_can_msgtype can_msgtype);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Buffer Output, buffer to store the searched mapping (see uds_mapping on page 25).
Can_id The CAN identifier to look for (see predefined uds_can_id values on page 58).
Can_msgtype The CAN message type to look for (11bits, 29 bits, FD, etc.). See also cantp_can_msgtype on page 121.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels
of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The buffer is invalid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED Indicates that no matching mapping was found in the registered mapping list.
Example
The following example shows the use of the function UDS_GetMapping_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It gets the mapping for the 0x7E0 CAN identifier then print it.
C/C++
uds_status result;
uds_mapping result_mapping;
result = UDS_GetMapping_2013(PCANTP_HANDLE_USBBUS1, &result_mapping,
PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1, PCANTP_CAN_MSGTYPE_STANDARD);
638
PCAN-UDS 2.x API – User Manual
3.8.12 UDS_GetMappings_2013
Retrieves all the mappings defined for a PUDS channel.
Syntax
C/C++
uds_status UDS_GetMappings_2013(
cantp_handle channel,
uds_mapping * buffer,
uint16_t buffer_length,
uint16_t* count);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Buffer Output, a buffer to store an array of uds_mapping (see uds_mapping on page 25).
Buffer_length The number of uds_mapping element the buffer can store.
Count Output, the actual number of elements copied in the buffer.
Remark
By default, some mappings are initialized in the PCAN-UDS 2.x API (see UDS and ISO-TP Network
Addressing Information on page 771).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_BUFFER_TOO_SMALL The given buffer is too small to store all mappings.
PUDS_STATUS_PARAM_INVALID_VALUE The buffer is invalid.
Example
The following example shows the use of the function UDS_GetMappings_2013 on PCANTP_HANDLE_USBBUS1 . It
displays all mappings added on the channel.
C/C++
uds_status result;
uint16_t count = 256;
uds_mapping mappings[256];
result = UDS_GetMappings_2013(PCANTP_HANDLE_USBBUS1, mappings, count, &count);
639
PCAN-UDS 2.x API – User Manual
3.8.13 UDS_GetSessionInformation_2013
Gets current ECU session information.
Syntax
C/C++
uds_status UDS_GetSessionInformation_2013(
cantp_handle channel,
uds_sessioninfo *session_info);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
session_info Input, the mapping to search for. Output, the session filled if an ECU session exists (see
uds_sessioninfo on page 22).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of
the calling application. Or the ECU session information is not initialized.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
Example
The following example shows the use of the function UDS_GetSessionInformation_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It gets the session information for a given mapping and prints it.
C/C++
uds_status result;
uds_sessioninfo session_info;
memset(&session_info, 0, sizeof(session_info));
// Mapping to search
session_info.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
640
PCAN-UDS 2.x API – User Manual
session_info.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
session_info.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
session_info.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
session_info.nai.extension_addr = 0;
3.8.14 UDS_StatusIsOk_2013
Checks if a PUDS status matches an expected result (default is PUDS_STATUS_OK ).
Syntax
C
bool UDS_StatusIsOk_2013(
const uds_status status,
const uds_status status_expected,
bool strict_mode);
C++
bool UDS_StatusIsOk_2013(
const uds_status status,
const uds_status status_expected = PUDS_STATUS_OK,
bool strict_mode = false);
Parameters
Parameter Description
status The PUDS status to analyze (see uds_status on page 32).
status_expected The expected PUDS status (see uds_status on page 32). The default value is PUDS_STATUS_OK.
strict_mode Enable strict mode (default is false). Strict mode ensures that bus or extra information are the same.
Returns
The return value is true if the status matches expected parameter.
641
PCAN-UDS 2.x API – User Manual
Remarks
When checking a uds_status , it is preferred to use UDS_StatusIsOk_2013 instead of comparing it with the ==
operator because UDS_StatusIsOk_2013 can remove information flag (in non-strict mode).
Example
The following example shows the use of the function UDS_StatusIsOk_2013 after initializing the channel
PCANTP_HANDLE_PCIBUS2 .
C/C++
uds_status result;
result = UDS_Initialize_2013(PCANTP_HANDLE_PCIBUS2, PCANTP_BAUDRATE_500K, (cantp_hwtype)0, 0,
0);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Initialization failed\n");
else
printf("PCAN-PCI (Ch-2) was initialized\n");
3.8.15 UDS_GetErrorText_2013
Gets a descriptive text for a PUDS error code.
Syntax
C/C++
uds_status UDS_GetErrorText_2013(
uds_status error_code,
uint16_t language,
char* buffer,
uint32_t buffer_size);
Parameters
Parameter Description
error_code A uds_status error code (see uds_status on page 32).
Language The current languages available for translation are: Neutral (0x00), German (0x07), English (0x09), Spanish
(0x0A), Italian (0x10) and French (0x0C).
buffer A buffer for a null-terminated char array.
Buffer_size Buffer size in bytes.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_PARAM_INVALID_VALUE Indicates that the parameters passed to the function are invalid. Check the parameter
‘buffer’; it should point to a char array, big enough to allocate the text for the given error
code.
Remarks
The Primary Language IDs are codes used by Windows OS from Microsoft, to identify a human language.
The API currently supports the following languages:
642
PCAN-UDS 2.x API – User Manual
Note: If the buffer is too small for the resulting text, the error 0x80008000 ( PUDS_STATUS_MASK_PCAN|
PCAN_ERROR_ILLPARAMVAL ) is returned. Even when only short texts are being currently returned, a text
within this function can have a maximum of 255 characters. For this reason, it is recommended to use
a buffer with a length of at least 256 bytes.
Example
The following example shows the use of the function UDS_GetErrorText_2013 to get the description of an error.
The language of the description’s text will be the same used by the operating system (if its language is
supported; otherwise English is used).
Note: It is assumed that the channel was NOT initialized (to generate an error).
C/C++
char str_msg[256];
uds_status result;
uds_status error_result;
error_result = UDS_Uninitialize_2013(PCANTP_HANDLE_USBBUS1);
result = UDS_GetErrorText_2013(error_result, 0x0, str_msg, 256);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false) && !UDS_StatusIsOk_2013(error_result,
PUDS_STATUS_OK, false))
printf("%s\n", str_msg);
3.8.16 UDS_GetCanBusStatus_2013
Gets information about the internal CAN bus status of a PUDS channel.
Syntax
C/C++
uds_status UDS_GetCanBusStatus_2013(
cantp_handle channel);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_FLAG_BUS_LIGHT Indicates a bus error within the given PUDS channel. The hardware is in bus-light status.
PUDS_STATUS_FLAG_BUS_HEAVY Indicates a bus error within the given PUDS channel. The hardware is in bus-heavy status.
PUDS_STATUS_FLAG_BUS_OFF Indicates a bus error within the given PUDS channel. The hardware is in bus-off status.
643
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved channels of the
calling application.
Remarks
When the hardware status is bus-off, an application cannot communicate anymore. Consider using the
PCAN-Basic property PCAN_BUSOFF_AUTORESET which instructs the API to automatically reset the CAN
controller when a bus-off state is detected.
Another way to reset errors like bus-off, bus-heavy and bus-light, is to uninitialize and initialize again the
channel used. This causes a hardware reset.
Example
The following example shows the use of the function UDS_GetCanBusStatus_2013 on the channel
PCANTP_HANDLE_PCIBUS1 . Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
3.8.17 UDS_MsgAlloc_2013
Allocates a PUDS message using the given configuration.
Syntax
C/C++
uds_status UDS_MsgAlloc_2013(
uds_msg* msg_buffer,
uds_msgconfig msg_configuration,
uint32_t msg_data_length
);
644
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
msg_buffer A uds_msg structure buffer. It will be freed if required (see uds_msg on page 21).
msg_configuration Configuration of the message to allocate (see uds_msgconfig on page 27).
msg_data_length Length of the message data.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
The uds_msg structure is automatically initialized and allocated by the PCAN-UDS 2.x API using:
- UDS_MsgAlloc_2013 function
- UDS_Read_2013 function
- UDS_WaitFor functions
Once processed, the uds_msg structure should be released using UDS_MsgFree_2013 function.
Example
The following example shows the use of the function UDS_MsgAlloc_2013 . It allocates a
ClearDiagnosticInformation service positive response (fixed length of one byte), with a physical
configuration between ECU 1 and test equipment using in ISO15765-2 11bits normal addressing.
C/C++
uds_msgconfig config_physical;
memset(&config_physical, 0, sizeof(config_physical));
config_physical.can_id = PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_1;
config_physical.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config_physical.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config_physical.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config_physical.type = PUDS_MSGTYPE_USDT;
config_physical.nai.source_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config_physical.nai.target_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config_physical.nai.extension_addr = 0;
uds_msg response_msg;
memset(&response_msg, 0, sizeof(uds_msg));
uds_status status = UDS_MsgAlloc_2013(&response_msg, config_physical, 1);
if (UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Allocate ClearDiagnosticInformation response.\n");
else
printf("Message allocation failed.\n");
645
PCAN-UDS 2.x API – User Manual
3.8.18 UDS_MsgFree_2013
Deallocates a PUDS message.
Syntax
C/C++
uds_status UDS_MsgFree_2013(
uds_msg* msg_buffer
);
Parameters
Parameter Description
msg_buffer An allocated uds_msg structure buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Example
The following example shows the use of the function UDS_MsgFree_2013 . Depending on the result, a message
will be shown to the user.
C/C++
uds_status result;
result = UDS_MsgFree_2013(&msg);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Free message error\n");
else
printf("Message released\n");
3.8.19 UDS_MsgCopy_2013
Copies a PUDS message to another buffer.
Syntax
C/C++
uds_status UDS_MsgCopy_2013(
uds_msg* msg_buffer_dst,
const uds_msg* msg_buffer_src
);
646
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
msg_buffer_dst A uds_msg structure buffer to store the copied message.
msg_buffer_src The uds_msg structure to copy.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
When a message is copied, a new buffer is allocated. Once processed, user has to release the source and
the destination messages (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the function UDS_MsgCopy_2013 . Depending on the result, a message
will be shown to the user.
C/C++
uds_msg destination;
memset(&destination, 0, sizeof(destination));
uds_status result = UDS_MsgCopy_2013(&destination, &source);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Copy error\n");
else
printf("Message copied\n");
3.8.20 UDS_MsgMove_2013
Moves a PUDS message to another buffer (and cleans the original message structure).
Syntax
C/C++
uds_status UDS_MsgMove_2013(
uds_msg* msg_buffer_dst,
uds_msg* msg_buffer_src
);
Parameters
Parameter Description
msg_buffer_dst A uds_msg structure buffer to store the message.
msg_buffer_src The uds_msg structure buffer used as the source (will be cleaned).
647
PCAN-UDS 2.x API – User Manual
Remarks
When a message is moved, the source buffer is cleaned: once processed, user only has to release the
destination message (see UDS_MsgFree_2013 on page 646).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Example
The following example shows the use of the function UDS_MsgMove_2013 . Depending on the result, a
message will be shown to the user.
C/C++
uds_msg destination;
memset(&destination, 0, sizeof(destination));
uds_status result = UDS_MsgMove_2013(&destination, &source);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Move error\n");
else
printf("Message moved\n");
648
PCAN-UDS 2.x API – User Manual
3.8.21 UDS_Read_2013
Reads a message from the receive queue of a PUDS channel.
Syntax
C
uds_status UDS_Read_2013(
cantp_handle channel,
uds_msg* out_msg_buffer,
uds_msg* in_msg_request,
cantp_timestamp* out_timestamp);
C++
uds_status UDS_Read_2013(
cantp_handle channel,
uds_msg* out_msg_buffer,
uds_msg* in_msg_request = 0,
cantp_timestamp* out_timestamp = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
out_msg_buffer A uds_msg buffer to store the PUDS message (see uds_msg on page 21).
in_msg_request Optional, filters read message via a request message and its network address information (see uds_msg
on page 21).
If NULL the first available message is fetched, otherwise in_msg_request must represent a sent PUDS
request. To look for the request confirmation, in_msg_request->type should not have the loopback flag;
otherwise a response from the target ECU will be searched.
out_timestamp A cantp_timestamp structure buffer to get the reception time of the message. If this value is not desired,
this parameter should be passed as NULL (see cantp_timestamp on page 104).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
Remarks
In addition to checking uds_status code, the cantp_netstatus should be checked as it contains the network
status of the message (see field msg.msgdata.any->netstatus in uds_msg on page 21).
In case of ISO-TP message, the message type contained in the message cantp_netaddrinfo which indicates
if the message is a complete ISO-TP message (no pending message flag) should be checked too (see
field msg.msgdata.isotp->netaddrinfo in uds_msg on page 21).
Specifying a NULL value for the parameter out_timestamp causes reading a message without timestamp
when the reception time is not desired.
The message structure is automatically allocated and initialized in UDS_Read_2013 function. So once the
message is processed, the structure must be released (see UDS_MsgFree_2013 on page 646).
649
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the function UDS_Read_2013 on the channel PCANTP_HANDLE_USBBUS1 .
Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel was already initialized. This example is basic, the preferred way
to read messages is Using Events (see on page 778).
C/C++
uds_status result;
uds_msg msg;
memset(&msg, 0, sizeof(msg));
bool stop = false;
do
{
// Read the first message in the queue
result = UDS_Read_2013(PCANTP_HANDLE_USBBUS1, &msg, NULL, NULL);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
{
printf("A message was received\n");
result = UDS_MsgFree_2013(&msg);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Message free error\n");
}
else
{
// An error occurred
printf("An error occurred\n");
// Here can be decided if the loop has to be terminated
// stop = HandleReadError(result);
}
} while (!stop);
See also: UDS_Write_2013 on page 650, uds_msg on page 21, UUDT Read/Write Example on page 776.
Class-method version: Read_2013 on page 219.
3.8.22 UDS_Write_2013
Transmits a message using a connected PUDS channel.
Syntax
C/C++
uds_status UDS_Write_2013(
cantp_handle channel,
uds_msg* msg_buffer);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_buffer A uds_msg buffer containing the message to be sent (see uds_msg on page 21).
650
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The message is not a valid message.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the reception
queue, the user must read a response for his previous request before or clear the
reception queues with UDS_Reset_2013 (see UDS_Reset_2013 on page 652).
PUDS_STATUS_PARAM_INVALID_TYPE The message type is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The corresponding mapping is unknown.
Remarks
The UDS_Write_2013 function does not actually send the UDS message, the transmission is asynchronous.
Should a message fail to be transmitted, it will be added to the reception queue with a specific network
error code in the msg.msgdata.any ->netstatus value of the uds_msg .
Note: To transmit a standard UDS service request, it is recommended to use the corresponding API
Service function starting with UDS_Svc (like UDS_SvcDiagnosticSessionControl_2013 ).
Example
The followingexample shows the use of the function UDS_Write_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It adds to the transmit queue a UDS request then waits until a confirmation
message is received. Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel was already initialized, mapping and message configuration
receive event wereconfigured. The content of data is not initialized in the example.
C/C++
uds_status result;
uds_msg request_msg;
uds_msg loopback_msg;
int wait_result;
memset(&request_msg, 0, sizeof(request_msg));
memset(&loopback_msg, 0, sizeof(loopback_msg));
651
PCAN-UDS 2.x API – User Manual
See also: UDS_Read_2013 on page 649, UUDT Read/Write Example on page 776.
Class-method version: Write_2013 on page 229.
3.8.23 UDS_Reset_2013
Resets the receive and transmit queues of a PUDS channel.
Syntax
C/C++
uds_status UDS_Reset_2013(
cantp_handle channel);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical error in case of
failure is:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized channels of the
calling application.
Remark
Calling this function ONLY clears the queues of a channel. A reset of the CAN controller does not take
place.
Example
The following example shows the use of the function UDS_Reset_2013 on the channel PCANTP_HANDLE_PCIBUS1 .
Depending on the result, a message will be shown to the user
C/C++
uds_status result;
652
PCAN-UDS 2.x API – User Manual
result = UDS_Reset_2013(PCANTP_HANDLE_PCIBUS1);
if (!UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf(“An error occurred\n”);
else
printf(“PCAN-PCI (Ch-1) was reset\n”);
3.8.24 UDS_WaitForSingleMessage_2013
Waits for a message (a response or a transmit confirmation) based on a PUDS message request.
Syntax
C/C++
uds_status UDS_WaitForSingleMessage_2013(
cantp_handle channel,
uds_msg* msg_request,
bool is_waiting_for_tx,
uint32_t timeout,
uint32_t timeout_enhanced,
uds_msg* out_msg_response);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A sent uds_msg message used as a reference to find the waited message (see uds_msg on page 21).
is_waiting_for_tx States whether the message to wait for is a transmit confirmation or not.
timeout Maximum time to wait (in milliseconds) for a message indication corresponding to the message
request. Note: A zero value means unlimited time.
timeout_enhanced Maximum time to wait (in milliseconds) for a message indication if ECU ask more time.
out_msg_response A uds_msg buffer to store the response message (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION Timeout while waiting for request confirmation (request message
loopback).
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE Timeout while waiting for response message.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
The criteria to identify if a response matches the message request is based only on the network addressing
information and the UDS service identifier: if the same service is requested multiple times with different
parameters (like service ReadDataByIdentifier with different data identifiers), the user will have to ensure
that the extra content matches the original request.
The timeout or timeout enhanced parameters are ignored once a message indication matching the request
is received (i.e. the first frame of the message).
653
PCAN-UDS 2.x API – User Manual
Since the duration of a message transmission/reception depends on various factors (bitrate, data length,
FD support, dlc, STmin, BS, etc.) user can call PCAN-ISO-TP function CANTP_GetMsgProgress_2016 to follow up
the progress of the communication (the cantp_msg parameter to use will be out_msg_response->msg ).
The parameters of UDS_WaitFor*_2013 functions have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the function UDS_WaitForSingleMessage_2013 on the channel
PCANTP_HANDLE_USBBUS1 . It writes a PUDS message on the CAN Bus and waits for the confirmation of the
transmission. Depending on the result, a message will be shown to the user.
Note: It is assumed that the channel and the mapping were already initialized.
C/C++
uds_status result;
uds_msg request;
uds_msg confirmation;
memset(&request, 0, sizeof(request));
memset(&confirmation, 0, sizeof(confirmation));
// Prepare an 11bit CAN ID, physically addressed UDS message containing 4 Bytes of data
uds_msgconfig config;
memset(&config, 0, sizeof(config));
config.can_id = PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
654
PCAN-UDS 2.x API – User Manual
}
else
{
// An error occurred
printf("An error occurred\n");
}
}
3.8.25 UDS_WaitForFunctionalResponses_2013
Waits for multiple messages (multiple responses from a functional request for instance) based on a PUDS
message request.
Syntax
C/C++
uds_status UDS_WaitForFunctionalResponses_2013(
cantp_handle channel,
uds_msg* msg_request,
uint32_t timeout,
uint32_t timeout_enhanced,
bool wait_until_timeout,
uint32_t max_msg_count,
uds_msg* out_msg_responses,
uint32_t* out_msg_count
);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A uds_msg containing the PUDS request message that was previously sent (see uds_msg on
page 21).
timeout Maximum time to wait (in milliseconds) for a message indication corresponding to the message
request. Note: A zero value means unlimited time.
timeout_enhanced Maximum time to wait (in milliseconds) for a message to be complete if ECU ask more time.
wait_until_timeout if false the function is interrupted if out_msg_count reaches max_msg_count.
max_msg_count Length of the responses buffer array (maximum messages that can be received).
out_ msg_responses A uds_msg buffer array to store the responses messages (see uds_msg on page 21).
out_msg_count Output, number of read messages.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_NO_MESSAGE Indicates that no matching messages were received in the given time.
655
PCAN-UDS 2.x API – User Manual
Remarks
The criteria to identify if a response matches the message request is based only on the network addressing
information and the UDS service identifier: if the same service is requested multiple times with different
parameters (like service ReadDataByIdentifier with different data identifiers), the user will have to ensure
that the extra content matches the original request.
The timeout or timeout enhanced parameters are ignored once a message indication matching the request
is received (i.e. the first frame of the message). They are re-enabled when the segmented message is fully
received.
The parameters of UDS_WaitFor*_2013 functions have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the function UDS_WaitForFunctionalResponses_2013 on the channel
PCANTP_HANDLE_ USBBUS1 . It writes a UDS functional message on the CAN Bus, waits for the confirmation
of the transmission, and then waits to receive responses from ECUs until a timeout occurs. Depending on
the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg confirmation;
uint32_t response_array_length = 5;
uds_msg response_array[5];
uint32_t count = 0;
int i;
memset(&request, 0, sizeof(request));
memset(&confirmation, 0, sizeof(confirmation));
for (i = 0; i < response_array_length; i++)
memset(&response_array[i], 0, sizeof(uds_msg));
656
PCAN-UDS 2.x API – User Manual
{
// Wait for the transmit confirmation
result = UDS_WaitForSingleMessage_2013(PCANTP_HANDLE_USBBUS1, &request, true, 10,
100, &confirmation);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false) &&
confirmation.msg.msgdata.any->netstatus == PCANTP_NETSTATUS_OK)
{
printf("Message was transmitted.\n");
// wait for the responses
result = UDS_WaitForFunctionalResponses_2013(PCANTP_HANDLE_USBBUS1,
&request, 10, 100, true, response_array_length, response_array,
&count);
if (count > 0)
{
printf("Responses were received\n");
for (uint32_t i = 0; i < count; i++)
{
UDS_MsgFree_2013(&(response_array[i]));
}
}
else
{
printf("No response was received\n");
}
UDS_MsgFree_2013(&confirmation);
}
else
{
// An error occurred
printf("Error occurred while waiting for transmit confirmation.\n");
}
UDS_MsgFree_2013(&request);
}
else
{
// An error occurred
printf("An error occurred\n");
}
}
See also: uds_msg on page 21, UDS_WaitForSingleMessage_2013 on page 653, UDS_WaitForService_2013 on page 657,
UDS_WaitForServiceFunctional_2013 on page 660.
Class-method version: WaitForFunctionalResponses_2013 on page 241.
3.8.26 UDS_WaitForService_2013
Handles the communication workflow for a UDS service expecting a single response. The function waits
for a transmit confirmation then for a response message. Even if the
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is set, the function will still wait.
Syntax
C/C++
uds_status UDS_WaitForService_2013(
cantp_handle channel,
uds_msg* msg_request,
uds_msg* out_msg_response,
uds_msg* out_msg_request_confirmation);
657
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
msg_request A uds_msg containing the PUDS request message that was previously sent (see
uds_msg on page 21).
out_ msg_response A uds_msg buffer to store the PUDS response message (see uds_msg on page 21).
out_msg_request_confirmation A uds_msg buffer to store the PUDS request confirmation message also known as
loopback message (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION Timeout while waiting for request confirmation (request message
loopback).
PUDS_STATUS_SERVICE_TIMEOUT_RESPONSE Timeout while waiting for response message.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_NO_MESSAGE Indicates that no matching message was received in the given time.
PUDS_STATUS_NETWORK_ERROR A network error occurred.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
The UDS_WaitForService_2013 function is a utility function that calls other PCAN-UDS 2.x API functions to
simplify UDS communication workflow:
1. The function gets the defined timeouts (global API request and response timeouts and timeouts
defined by the current session information with the ECU),
2. Waits for the confirmation of the request’s transmission,
3. On success, waits for the response.
4. If a negative response code is received stating that the ECU requires extended timing
( PUDS_NRC_EXTENDED_TIMING , 0x78), the function switches to the enhanced timeout (enhanced
P2CAN server max timeout, see uds_sessioninfo on page 22) and waits for another response.
5. Fills the output message with response data.
Even if the PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is set in the PUDS request message, the function
will still wait for an eventual Negative Response. If no error message is received the function will return
PUDS_STATUS_NO_MESSAGE , although in this case it must not be considered as an error. Moreover, if a
negative response code PUDS_NRC_EXTENDED_TIMING is received the
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is ignored as stated in ISO-14229-1.
The parameters of UDS_WaitFor*_2013 functions have a new order. They do not keep the order of the previous
version.
Example
The following example shows the use of the function UDS_WaitForService_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted (service ECUReset), and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
Note: It is assumed that the channel and the mapping were already initialized.
658
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
config.can_id = PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
659
PCAN-UDS 2.x API – User Manual
3.8.27 UDS_WaitForServiceFunctional_2013
Handles the communication workflow for a UDS service requested with functional addressing, i.e. multiple
responses can be expected. The function waits for a transmit confirmation then for responses. Even if the
PUDS_MSGTYPE_FLAG_NO_POSITIVE_RESPONSE flag is set, the function will still wait for eventual Negative
Responses.
Syntax
C/C++
uds_status UDS_WaitForServiceFunctional_2013(
cantp_handle channel,
uds_msg* msg_request,
uint32_t max_msg_count,
bool wait_until_timeout,
uds_msg* out_msg_responses,
uint32_t* out_msg_count,
uds_msg* out_msg_request_confirmation);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Msg_request A uds_msg containing the PUDS request message that was previously sent (see
uds_msg on page 21).
Max_msg_count Length of the responses buffer array (maximum messages that can be received).
Wait_until_timeout If false, the function is interrupted if out_msg_count reaches max_msg_count.
Out_ msg_responses A uds_msg buffer array to store the responses messages (see uds_msg on page 21).
Out_msg_count Output, number of read messages.
Out_msg_request_confirmation A uds_msg buffer to store the UDS request confirmation message also known as
loopback message (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of initialized
channels of the calling application.
PUDS_STATUS_OVERFLOW Output responses buffer is too small.
PUDS_STATUS_SERVICE_TX_ERROR An error occurred while transmitting the request.
PUDS_STATUS_SERVICE_TIMEOUT_CONFIRMATION Timeout while waiting for request confirmation (request message
loopback).
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is invalid.
PUDS_STATUS_NO_MESSAGE Indicates that no matching message was received in the given time.
PUDS_STATUS_NETWORK_ERROR A network error occurred.
PUDS_STATUS_SERVICE_RX_OVERFLOW Service received more messages than input buffer expected.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
The UDS_WaitForServiceFunctional_2013 function is a utility function that calls other PCAN-UDS 2.x API functions
to simplify UDS communication workflow when requests involve functional addressing:
1. The function gets the defined timeouts (global API request and response timeouts and timeouts
defined by the current session information with the ECU),
2. Waits for the confirmation of request’s transmission,
660
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the function UDS_WaitForServiceFunctional_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS functional service request is transmitted (service ECUReset), and the
UDS_WaitForServiceFunctional_2013 function is called to get the responses. Depending on the result, a message
will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uint32_t response_array_length = 5;
uds_msg response_array[5];
uint32_t count;
uds_msgconfig config;
int i;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
for (i = 0; i < response_array_length; i++)
memset(&response_array[i], 0, sizeof(uds_msg));
661
PCAN-UDS 2.x API – User Manual
}
UDS_MsgFree_2013(&request_confirmation);
}
else
{
printf("An error occurred\n");
}
UDS_MsgFree_2013(&request);
}
else
{
printf("An error occurred, while sending the request.\n");
}
3.8.28 UDS_SvcDiagnosticSessionControl_2013
Writes a UDS request according to the DiagnosticSessionControl service’s specifications. The
DiagnosticSessionControl service is used to enable different diagnostic sessions in the server.
Syntax
C/C++
uds_status UDS_SvcDiagnosticSessionControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint8_t session_type);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
session_type Subfunction parameter: type of the session (see uds_svc_param_dsc on page 71).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of
reserved channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the
buffer before reusing it (see UDS_MsgFree_2013 on page 646).
662
PCAN-UDS 2.x API – User Manual
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcDiagnosticSessionControl_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
663
PCAN-UDS 2.x API – User Manual
3.8.29 UDS_SvcECUReset_2013
Writes a UDS request according to the ECUReset service’s specifications. The ECUReset service is used by
the client to request a server (ECU) reset.
Syntax
C/C++
uds_status UDS_SvcECUReset_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t reset_type);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
reset_type Subfunction parameter: type of reset (see uds_svc_param_er on page 72).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
After receiving a positive response to UDS request ECUReset with the help of function
UDS_WaitForService_2013 , the API will revert the session information of that ECU to the default diagnostic
session.
Example
The following example shows the use of the service function UDS_SvcECUReset_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
664
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.30 UDS_SvcSecurityAccess_2013
Writes a UDS request according to the SecurityAccess service’s specifications. SecurityAccess service
provides a mean to access data and/or diagnostic services which have restricted access for security,
emissions, or safety reasons.
Syntax
C/C++
uds_status UDS_SvcSecurityAccess_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t security_access_type,
uint8_t * security_access_data,
uint32_t security_access_data_size);
665
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
security_access_type Subfunction parameter: type of security access (see SecurityAccess Type Definitions on page 766)
security_access_data If Requesting Seed, buffer is the optional data to transmit to a server/ECU (like identification). If
Sending Key, data holds the value generated by the security algorithm corresponding to a specific
“seed” value.
security_access_data_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcSecurityAccess_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
666
PCAN-UDS 2.x API – User Manual
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
See also: UDS_WaitForService_2013 on page 657, SecurityAccess Type Definitions on page 766.
Class-method version: SvcSecurityAccess_2013 on page 267.
3.8.31 UDS_SvcCommunicationControl_2013
Writes a UDS request according to the CommunicationControl service’s specifications.
CommunicationControl service's purpose is to switch on/off the transmission and/or the reception of
certain messages of (a) server(s)/ECU(s).
Syntax
uds_status UDS_SvcCommunicationControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t control_type,
uint8_t communication_type,
uint16_t node_identification_number);
C++
uds_status UDS_SvcCommunicationControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t control_type,
uint8_t communication_type,
uint16_t node_identification_number = 0);
667
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
control_type Subfunction parameter: type of communication control (see uds_svc_param_cc on page 74).
communication_type A bit-code value to reference the kind of communication to be controlled (see CommunicationControl
Communication Type Definitions on page 767).
node_identification_number A two bytes value, identify a node on a sub-network, only used with
PUDS_SVC_PARAM_CC_ERXDTXWEAI or PUDS_SVC_PARAM_CC_ERXTXWEAI control type)
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcCommunicationControl_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
668
PCAN-UDS 2.x API – User Manual
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
See also: UDS_WaitForService_2013 on page 657, CommunicationControl Communication Type Definitions on page 767.
Class-method version: SvcCommunicationControl_2013 on page 276.
3.8.32 UDS_SvcTesterPresent_2013
Writes a UDS request according to the TesterPresent service’s specifications. TesterPresent service
indicates to the server(s)/ECU(s) that a client is still connected to the vehicle and that certain diagnostic
services and/or communications that have been previously activated are to remain active.
Syntax
uds_status UDS_SvcTesterPresent_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t testerpresent_type);
C++
uds_status UDS_SvcTesterPresent_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t testerpresent_type = PUDS_SVC_PARAM_TP_ZSUBF);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
testerpresent_type No Subfunction parameter by default (see uds_svc_param_tp on page 75).
669
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcTesterPresent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request)) ;
memset(&request_confirmation, 0, sizeof(request_confirmation)) ;
memset(&response, 0, sizeof(response)) ;
memset(&config, 0, sizeof(config)) ;
670
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.33 UDS_SvcSecuredDataTransmission_2013
Writes a UDS request according to the SecuredDataTransmission service’s specifications(ISO-14229-
1:2013). SecuredDataTransmission service’s purpose is to transmit data that is protected against attacks
from third parties, which could endanger data security.
Syntax
C/C++
uds_status UDS_SvcSecuredDataTransmission_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t * security_data_request_record,
uint32_t security_data_request_record_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Request_config Message request configuration (see uds_msgconfig on page 27).
Out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Security_data_request_record Buffer containing the data as processed by the security sub-layer (See ISO-15764).
Security_data_request_record_size Size in bytes of the buffer.
671
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
When using SecuredDataTransmission service, user may need to construct a security_data_request_record that
is equal to another UDS service request definition. That is why UDS_Svc* functions can be called with
PUDS_ONLY_PREPARE_REQUEST as channel identifier (instead of using cantp_handle ): it prepares the uds_msg
structure without sending it.
Example
The following example shows the use of the service function UDS_SvcSecuredDataTransmission_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
Note: It is assumed that the channel was already initialized. The example shows the use of a numeric
buffer and points out the fact that Windows uses Little Endian Byte order and the UDS_SvcXXX functions
expect data in Big Endian Byte Order.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint32_t dw_buffer;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
672
PCAN-UDS 2.x API – User Manual
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Note: next a function is called to set MSB as 1st byte in the buffer
// (Win32 uses little endian format, UDS expects big endian)
uint32_t value_little_endian = 0xF0A1B2C3;
dw_buffer = Reverse32(&value_little_endian);
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.34 UDS_SvcSecuredDataTransmission_2020
Writes a UDS request according to the SecuredDataTransmission service’s specifications (ISO-14229-
1:2020). SecuredDataTransmission service's purpose is to transmit data that is protected against attacks
from third parties, which could endanger data security.
Syntax
C/C++
uds_status UDS_SvcSecuredDataTransmission_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t administrative_parameter,
uint8_t signature_encryption_calculation,
uint16_t anti_replay_counter,
uint8_t internal_service_identifier,
uint8_t *service_specific_parameters,
uint32_t service_specific_parameters_size,
uint8_t *signature_mac,
uint16_t signature_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
673
PCAN-UDS 2.x API – User Manual
Parameter Description
administrative_parameter Security features used in the message (see SecuredDataTransmission Administrative
Parameter Flags Definitions on page 768)
signature_encryption_calculation Signature or encryption algorithm identifier.
anti_replay_counter Anti-replay counter value.
internal_service_identifier Internal message service request identifier (see uds_service on page 53).
service_specific_parameters Buffer that contains internal message service request data.
service_specific_parameters_size Internal message service request data size (in bytes).
signature_mac Buffer that contains signature used to verify the message.
signature_size Size in bytes of the signature.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
When using SecuredDataTransmission service, user may need to construct a security_data_request_record that
is equal to another UDS service request definition. That is why UDS_Svc* functions can be called with
PUDS_ONLY_PREPARE_REQUEST as channel identifier (instead of using cantp_handle ): it prepares the uds_msg
structure without sending it.
Example
The following example shows the use of the service function UDS_SvcSecuredDataTransmission_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint16_t administrative_parameter;
uint8_t signature_encryption_calculation;
674
PCAN-UDS 2.x API – User Manual
uint16_t anti_replay_counter;
uint8_t internal_service_identifier;
uint8_t service_specific_parameters[4];
uint32_t service_specific_parameters_size;
uint8_t signature_mac[6];
uint16_t signature_size;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
675
PCAN-UDS 2.x API – User Manual
3.8.35 UDS_SvcControlDTCSetting_2013
Writes a UDS request according to the ControlDTCSetting service’s specifications. ControlDTCSetting
service shall be used by a client to stop or resume the setting of diagnostic trouble codes (DTCs) in the
server(s).
Syntax
C/C++
uds_status UDS_SvcControlDTCSetting_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t dtc_setting_type,
uint8_t * dtc_setting_control_option_record,
uint32_t dtc_setting_control_option_record_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Request_config Message request configuration (see uds_msgconfig on page 27).
Out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Dtc_setting_type Subfunction parameter (see uds_svc_param_cdtcs on page 76).
Dtc_setting_control_option_record This parameter record is user-optional and transmits data to a server (ECU) when
controlling the DTC setting. It can contain a list of DTCs to be turned on or off.
Dtc_setting_control_option_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcControlDTCSetting_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
676
PCAN-UDS 2.x API – User Manual
Note: It is assumed that the channel was already initialized. The example shows the use of a numeric
buffer and points out the fact that Windows uses Little Endian Byte order and the UDS_SvcXXX
functions expect data in Big Endian Byte Order.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint32_t dw_buffer;
uds_msgconfig config;
memset(&request, 0, sizeof(request)) ;
memset(&request_confirmation, 0, sizeof(request_confirmation)) ;
memset(&response, 0, sizeof(response)) ;
memset(&config, 0, sizeof(config)) ;
// Note: next a function is called to set MSB as 1st byte in the buffer
// (Win32 uses little endian format, UDS expects big endian)
uint32_t value_little_endian = 0xF0A1B2C3;
dw_buffer = Reverse32(&value_little_endian);
// Sends a physical ControlDTCSetting message
result = UDS_SvcControlDTCSetting_2013(PCANTP_HANDLE_USBBUS1, config, &request,
PUDS_SVC_PARAM_CDTCS_OFF, (uint8_t*)&dw_buffer, 3);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
result = UDS_WaitForService_2013(PCANTP_HANDLE_USBBUS1, &request, &response,
&request_confirmation);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Response was received\n");
else
// An error occurred
printf("An error occurred\n");
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
677
PCAN-UDS 2.x API – User Manual
3.8.36 UDS_SvcResponseOnEvent_2013
Writes a UDS request according to the ResponseOnEvent service’s specifications. The ResponseOnEvent
service requests a server (ECU) to start or stop transmission of responses on a specified event.
Syntax
C
uds_status UDS_SvcResponseOnEvent_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t event_type,
bool store_event,
uint8_t event_window_time,
uint8_t * event_type_record,
uint32_t event_type_record_size,
uint8_t * service_to_respond_to_record,
uint32_t service_to_respond_to_record_size);
C++
uds_status UDS_SvcResponseOnEvent_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t event_type,
bool store_event,
uint8_t event_window_time,
uint8_t * event_type_record = nullptr,
uint32_t event_type_record_size = 0,
uint8_t * service_to_respond_to_record = nullptr,
uint32_t service_to_respond_to_record_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
event_type Subfunction parameter: event type (see uds_svc_param_roe on page 77).
store_event Storage state (true to store event, false to do not store event).
event_window_time Specify a window for the event logic to be active in the server/ECU (see ResponseOnEvent
Service Definitions on page 767).
event_type_record Additional parameters for the specified event type.
event_type_record_size Size in bytes of the event type record (see ResponseOnEvent Service Definitions on page
767).
service_to_respond_to_record Service parameters, with first byte as service identifier (see
uds_svc_param_roe_recommended_service_id on page 78)
service_to_respond_to_record_size Size in bytes of the service to respond to record.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
678
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcResponseOnEvent_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t event_type_record[5];
uint8_t service_to_respond_to_record[5];
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
679
PCAN-UDS 2.x API – User Manual
service_to_respond_to_record, 2);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
result = UDS_WaitForService_2013(PCANTP_HANDLE_USBBUS1, &request, &response,
&request_confirmation);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Response was received\n");
else
// An error occurred
printf("An error occurred\n");
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
See also: UDS_WaitForService_2013 on page 657, ResponseOnEvent Service Definitions on page 767.
Class-method version: SvcResponseOnEvent_2013 on page 314.
3.8.37 UDS_SvcLinkControl_2013
Writes a UDS request according to the LinkControl service’s specifications. The LinkControl service is used
to control the communication link baud rate between the client and the server(s)/ECU(s) for the exchange
of diagnostic data.
Syntax
uds_status UDS_SvcLinkControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t link_control_type,
uint8_t baudrate_identifier,
uint32_t link_baudrate);
C++
uds_status UDS_SvcLinkControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t link_control_type,
uint8_t baudrate_identifier,
uint32_t link_baudrate = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
link_control_type Subfunction parameter: link control type (see uds_svc_param_lc on page 79).
baudrate_identifier Defined baud rate identifier (see uds_svc_param_lc_baudrate_identifier on page 80).
link_baudrate Used only with PUDS_SVC_PARAM_LC_VBTWSBR parameter: a three-byte value baud rate (baud rate
High, Middle and Low Bytes).
680
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcLinkControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
681
PCAN-UDS 2.x API – User Manual
else
// An error occurred
printf("An error occurred\n");
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.38 UDS_SvcReadDataByIdentifier_2013
Writes a UDS request according to the ReadDataByIdentifier service’s specifications. The
ReadDataByIdentifier service allows the client to request data record values from the server (ECU)
identified by one or more data identifiers.
Syntax
C/C++
uds_status UDS_SvcReadDataByIdentifier_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t * data_identifier,
uint32_t data_identifier_length);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
data_identifier Buffer containing a list of two-byte data identifiers (see uds_svc_param_di on page 82).
data_identifier_length Number of elements in the buffer (size in UInt16 of the buffer).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
682
PCAN-UDS 2.x API – User Manual
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDataByIdentifier_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
683
PCAN-UDS 2.x API – User Manual
3.8.39 UDS_SvcReadMemoryByAddress_2013
Writes a UDS request according to the ReadMemoryByAddress service’s specifications. The
ReadMemoryByAddress service allows the client to request memory data from the server (ECU) via a
provided starting address and to specify the size of memory to be read.
Syntax
C/C++
uds_status UDS_SvcReadMemoryByAddress_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t * memory_address_buffer,
uint8_t memory_address_size,
uint8_t * memory_size_buffer,
uint8_t memory_size_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
memory_address_buffer Starting address of server (ECU) memory from which data is to be retrieved.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size_buffer Number of bytes to be read starting at the address specified by memory address.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadMemoryByAddress_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
684
PCAN-UDS 2.x API – User Manual
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t memory_address_buffer[10];
uint8_t memory_size_buffer[10];
uint8_t memory_address_size = 10;
uint8_t memory_size_size = 3;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill data
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[i] = 'A' + i;
memory_size_buffer[i] = '1' + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
685
PCAN-UDS 2.x API – User Manual
3.8.40 UDS_SvcReadScalingDataByIdentifier_2013
Writes a UDS request according to the ReadScalingDataByIdentifier service’s specifications. The
ReadScalingDataByIdentifier service allows the client to request scaling data record information from the
server (ECU) identified by a data identifier.
Syntax
C/C++
uds_status UDS_SvcReadScalingDataByIdentifier_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t data_identifier);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadScalingDataByIdentifier_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
686
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.41 UDS_SvcReadDataByPeriodicIdentifier_2013
Writes a UDS request according to the ReadDataByPeriodicIdentifier service’s specifications. The
ReadDataByPeriodicIdentifier service allows the client to request the periodic transmission of data record
values from the server (ECU) identified by one or more periodic data identifiers.
Syntax
C/C++
uds_status UDS_SvcReadDataByPeriodicIdentifier_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t transmission_mode,
uint8_t * periodic_data_identifier,
uint32_t periodic_data_identifier_length);
687
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
transmission_mode Transmission rate mode (see uds_svc_param_rdbpi on page 86).
periodic_data_identifier Buffer containing a list of periodic data identifiers (see uds_svc_param_di on page 82).
periodic_data_identifier_length Number of elements in the buffer (size in bytes of the buffer).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDataByPeriodicIdentifier_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t periodic_data_identifier[10];
uint16_t periodic_data_identifier_size = 10;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
688
PCAN-UDS 2.x API – User Manual
config.can_id = PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1;
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Fill Data
for (int i = 0; i < periodic_data_identifier_size; i++)
{
periodic_data_identifier[i] = 'A' + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.42 UDS_SvcDynamicallyDefineDataIdentifierDBID_2013
Writes a UDS request according to the DynamicallyDefineDataIdentifier service’s specifications. The
DynamicallyDefineDataIdentifier service allows the client to dynamically define in a server (ECU) a data
identifier that can be read via the ReadDataByIdentifier service later. The Define by identifier subfunction
specifies that the definition of the dynamic data identifier shall occur via a data identifier reference.
Syntax
C/C++
uds_status UDS_SvcDynamicallyDefineDataIdentifierDBID_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t dynamically_defined_data_identifier,
uint16_t * source_data_identifier,
uint8_t * memory_size,
uint8_t * position_in_source_data_record,
uint32_t number_of_elements);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
689
PCAN-UDS 2.x API – User Manual
Parameter Description
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dynamically_defined_data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
source_data_identifier Buffer containing the sources of information to be included into the dynamic data record.
memory_size Buffer containing the total numbers of bytes from the source data record address.
position_in_source_data_record Buffer containing the starting byte positions of the excerpt of the source data record.
number_of_elements Number of source_data_identifier/position_in_source_data_record/memory_size triplet.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The total buffer length is too big. The resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcDynamicallyDefineDataIdentifierDBID_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint16_t source_data_identifier[10];
uint8_t memory_size[10];
uint8_t position_in_source_data_record[10];
uint16_t number_of_elements = 10;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
690
PCAN-UDS 2.x API – User Manual
config.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
config.nai.extension_addr = 0x0;
config.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
config.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Fill Data
for (int i = 0; i < number_of_elements; i++)
{
source_data_identifier[i] = ((0xF0 + i) << 8) + ('A' + i);
memory_size[i] = i + 1;
position_in_source_data_record[i] = 100 + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.43 UDS_SvcDynamicallyDefineDataIdentifierDBMA_2013
Writes a UDS request according to the DynamicallyDefineDataIdentifier service’s specifications. The
DynamicallyDefineDataIdentifier service allows the client to dynamically define in a server (ECU) a data
identifier that can be read via the ReadDataByIdentifier service later. The define by memory Address
subfunction specifies that the definition of the dynamic data identifier shall occur via an address reference.
Syntax
C/C++
uds_status UDS_SvcDynamicallyDefineDataIdentifierDBMA_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t dynamically_defined_data_identifier,
uint8_t memory_address_size,
uint8_t memory_size_size,
uint8_t * memory_address_buffer,
uint8_t * Memory_size_buffer,
uint32_t number_of_elements);
691
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dynamically_defined_data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
memory_address_size Size in bytes of the memory address items in the memory address buffer (max.: 0xF).
memory_size_size Size in bytes of the memory size items in the memory size buffer (max.: 0xF).
memory_address_buffer buffer containing the MemoryAddress buffer, must be an array of 'number_of_elements'
items whose size is 'memory_address_size' (size is 'number_of_elements *
memory_address_size' bytes)
memory_size_buffer buffer containing the MemorySize buffer, must be an array of 'number_of_elements' items
whose size is 'memory_size_size' (size is 'number_of_elements * memory_size_size' bytes)
number_of_elements Number of memory address/memory_size couple.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcDynamicallyDefineDataIdentifierDBMA_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
Note: It is assumed that the channel was already initialized.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint16_t number_of_elements = 3;
uint8_t memory_address_buffer[15];
uint8_t memory_size_buffer[9];
uint8_t memory_address_size = 5;
uint8_t memory_size_size = 3;
692
PCAN-UDS 2.x API – User Manual
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill data
for (int j = 0; j < number_of_elements; j++)
{
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[memory_address_size*j + i] = (10 * j) + i + 1;
}
for (int i = 0; i < memory_size_size; i++)
{
memory_size_buffer[memory_size_size*j + i] = 100 + (10 * j) + i + 1;
}
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
693
PCAN-UDS 2.x API – User Manual
3.8.44 UDS_SvcDynamicallyDefineDataIdentifierCDDDI_2013
Writes a UDS request according to the Clear Dynamically Defined Data Identifier service’s specifications.
The Clear Dynamically Defined Data Identifier subfunction shall be used to clear the specified dynamic data
identifier.
Syntax
C/C++
uds_status UDS_SvcDynamicallyDefineDataIdentifierCDDDI_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t dynamically_defined_data_identifier);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dynamically_defined_data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcDynamicallyDefineDataIdentifierCDDDI_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
694
PCAN-UDS 2.x API – User Manual
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.45 UDS_SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013
Writes a UDS request according to the Clear all Dynamically Defined Data Identifier service’s specifications.
The Clear Dynamically Defined Data Identifier subfunction (without data identifier parameter) shall be used
to clear all the specified dynamic data identifier in the server.
Syntax
C/C++
uds_status UDS_SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
695
PCAN-UDS 2.x API – User Manual
Parameter Description
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function
UDS_SvcDynamicallyDefineDataIdentifierClearAllDDDI_2013 on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical
service request is transmitted, and the UDS_WaitForService_2013 function is called to get the response.
Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
696
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.46 UDS_SvcWriteDataByIdentifier_2013
Writes a UDS request according to the WriteDataByIdentifier service’s specifications. The
WriteDataByIdentifier service allows the client to write information into the server (ECU) at an internal
location specified by the provided data identifier.
Syntax
C/C++
uds_status UDS_SvcWriteDataByIdentifier_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t data_identifier,
uint8_t * data_record,
uint32_t data_record_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
data_record Buffer containing the data to write.
data_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
697
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcWriteDataByIdentifier_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t data_record[10];
uint16_t data_record_size = 10;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill Data
for (int i = 0; i < data_record_size; i++)
{
data_record[i] = 'A' + i;
}
698
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.47 UDS_SvcWriteMemoryByAddress_2013
Writes a UDS request according to the WriteMemoryByAddress service’s specifications. The
WriteMemoryByAddress service allows the client to write information into the server (ECU) at one or more
contiguous memory locations.
Syntax
C/C++
uds_status UDS_SvcWriteMemoryByAddress_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t * memory_address_buffer,
uint8_t memory_address_size,
uint8_t * memory_size_buffer,
uint8_t memory_size_size,
uint8_t * data_record,
uint32_t data_record_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
memory_address_buffer Starting address buffer of server (ECU) memory to which data is to be written.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size_buffer Number of bytes to be written starting at the address specified by memory address.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
data_record Buffer containing the data to write.
data_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
699
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data length.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcWriteMemoryByAddress_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t data_record[50];
uint8_t memory_address_buffer[50];
uint8_t memory_size_buffer[50];
uint16_t data_record_size = 50;
uint8_t memory_address_size = 5;
uint8_t memory_size_size = 3;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill Data
for (int i = 0; i < data_record_size; i++)
{
700
PCAN-UDS 2.x API – User Manual
data_record[i] = i + 1;
memory_address_buffer[i] = 'A' + i;
memory_size_buffer[i] = 10 + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.48 UDS_SvcClearDiagnosticInformation_2013
Writes a UDS request according to the ClearDiagnosticInformation service’s specifications. The
ClearDiagnosticInformation service is used by the client to clear diagnostic information in one server's or
multiple servers’ memory.
Syntax
C/C++
uds_status UDS_SvcClearDiagnosticInformation_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint32_t group_of_dtc);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
group_of_dtc A three-byte value indicating the group of DTCs (e.g. powertrain, body, chassis) or the particular DTC
to be cleared (see ClearDiagnosticInformation Group of DTC Definitions on page 768).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
701
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcClearDiagnosticInformation_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
702
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.49 UDS_SvcClearDiagnosticInformation_2020
Writes a UDS request according to the ClearDiagnosticInformation service’s specifications with memory
selection parameter (ISO-14229-1:2020). The ClearDiagnosticInformation service is used by the client to
clear diagnostic information in one server's or multiple servers’ memory.
Syntax
C/C++
uds_status UDS_SvcClearDiagnosticInformation_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint32_t group_of_dtc,
uint8_t memory_selection);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
group_of_dtc A three-byte value indicating the group of DTCs (e.g. powertrain, body, chassis) or the particular DTC
to be cleared (see ClearDiagnosticInformation Group of DTC Definitions on page 768).
memory_selection User defined DTC memory.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
703
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service function UDS_SvcClearDiagnosticInformation_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
704
PCAN-UDS 2.x API – User Manual
3.8.50 UDS_SvcReadDTCInformation_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformation_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t PUDS_SVC_PARAM_RDTCI_Type,
uint8_t dtc_status_mask);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RNODTCBSM,
PUDS_SVC_PARAM_RDTCI_RDTCBSM,
PUDS_SVC_PARAM_RDTCI_RMMDTCBSM,
PUDS_SVC_PARAM_RDTCI_RNOMMDTCBSM,
PUDS_SVC_PARAM_RDTCI_RNOOBDDTCBSM,
PUDS_SVC_PARAM_RDTCI_ROBDDTCBSM.
See also uds_svc_param_rdtci on page 88.
dtc_status_mask Contains eight DTC status bits.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once
processed, this request message should be released (see UDS_MsgFree_2013 on page 646).
Only the following subfunctions are allowed:
- reportNumberOfDTCByStatusMask,
- reportDTCByStatusMask,
- reportMirrorMemoryDTCByStatusMask,
- reportNumberOfMirrorMemoryDTCByStatusMask,
705
PCAN-UDS 2.x API – User Manual
- reportNumberOfEmissionsRelatedOBDDTCByStatusMask,
- reportEmissionsRelatedOBDDTCByStatusMask.
Example
The following example shows the use of the service function UDS_SvcReadDTCInformation_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
706
PCAN-UDS 2.x API – User Manual
3.8.51 UDS_SvcReadDTCInformationRDTCSSBDTC_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCSnapshotRecordByDTCNumber ( PUDS_SVC_PARAM_RDTCI_RDTCSSBDTC ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRDTCSSBDTC_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint32_t dtc_mask,
uint8_t dtc_snapshot_record_number);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code.
dtc_snapshot_record_number The number of the specific DTCSnapshot data records.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRDTCSSBDTC_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
707
PCAN-UDS 2.x API – User Manual
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.52 UDS_SvcReadDTCInformationRDTCSSBRN_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCSnapshotByRecordNumber ( PUDS_SVC_PARAM_RDTCI_RDTCSSBRN ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRDTCSSBRN_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t dtc_snapshot_record_number);
708
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_snapshot_record_number The number of the specific DTCSnapshot data records.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRDTCSSBRN_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
709
PCAN-UDS 2.x API – User Manual
config.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.53 UDS_SvcReadDTCInformationReportExtended_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. Only
reportDTCExtendedDataRecordByDTCNumber and reportMirrorMemoryDTCExtendedDataRecordByDTCNumber subfunctions
are allowed.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationReportExtended_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t PUDS_SVC_PARAM_RDTCI_Type,
uint32_t dtc_mask,
uint8_t dtc_extended_data_record_number);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page
21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RDTCEDRBDN,
PUDS_SVC_PARAM_RDTCI_RMMDEDRBDN.
See also uds_svc_param_rdtci on page 88.
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble
code.
dtc_extended_data_record_number The number of the specific DTCExtendedData record requested.
710
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationReportExtended_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
711
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.54 UDS_SvcReadDTCInformationReportSeverity_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. Only
reportNumberOfDTCBySeverityMaskRecord and reportDTCSeverityInformation subfunctions are allowed.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationReportSeverity_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t PUDS_SVC_PARAM_RDTCI_Type,
uint8_t dtc_severity_mask,
uint8_t dtc_status_mask);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RNODTCBSMR,
PUDS_SVC_PARAM_RDTCI_RDTCBSMR
See also uds_svc_param_rdtci on page 88.
dtc_severity_mask A mask of eight (8) DTC severity bits (see uds_svc_param_rdtci_dtcsvm on page 91).
dtc_status_mask A mask of eight (8) DTC status bits.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
712
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationReportSeverity_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
713
PCAN-UDS 2.x API – User Manual
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.55 UDS_SvcReadDTCInformationRSIODTC_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportSeverityInformationOfDTC ( PUDS_SVC_PARAM_RDTCI_RSIODTC ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRSIODTC_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint32_t dtc_mask);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_mask A unique identification number for a specific diagnostic trouble code.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRSIODTC_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
714
PCAN-UDS 2.x API – User Manual
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
See also: UDS_WaitForService_2013 on page 657.
Class-method version: SvcReadDTCInformationRSIODTC_2013 on page 418.
3.8.56 UDS_SvcReadDTCInformationNoParam_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. Only theses
following subfunctions are allowed:
- reportSupportedDTC
- reportFirstTestFailedDTC
- reportFirstConfirmedDTC
- reportMostRecentTestFailedDTC
- reportMostRecentConfirmedDTC
715
PCAN-UDS 2.x API – User Manual
- reportDTCFaultDetectionCounter
- reportDTCWithPermanentStatus
- reportDTCSnapshotIdentification
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationNoParam_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t PUDS_SVC_PARAM_RDTCI_Type);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
PUDS_SVC_PARAM_RDTCI_Type Subfunction parameter, ReadDTCInformation type, use one of the following:
PUDS_SVC_PARAM_RDTCI_RFTFDTC,
PUDS_SVC_PARAM_RDTCI_RFCDTC,
PUDS_SVC_PARAM_RDTCI_RMRTFDTC,
PUDS_SVC_PARAM_RDTCI_RMRCDTC,
PUDS_SVC_PARAM_RDTCI_RSUPDTC,
PUDS_SVC_PARAM_RDTCI_RDTCWPS,
PUDS_SVC_PARAM_RDTCI_RDTCSSI ,
PUDS_SVC_PARAM_RDTCI_RDTCFDC.
See also uds_svc_param_rdtci on page 88.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationNoParam_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
716
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.57 UDS_SvcReadDTCInformationRDTCEDBR_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCExtDataRecordByRecordNumber ( PUDS_SVC_PARAM_RDTCI_RDTCEDBR ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRDTCEDBR_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint8_t dtc_extended_data_record_number);
717
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_extended_data_record_number DTC extended data record number.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRDTCEDBR_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint8_t dtc_extended_data_record_number = 0x12;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
718
PCAN-UDS 2.x API – User Manual
config.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
config.type = PUDS_MSGTYPE_USDT;
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.58 UDS_SvcReadDTCInformationRUDMDTCBSM_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportUserDefMemoryDTCByStatusMask ( PUDS_SVC_PARAM_RDTCI_RUDMDTCBSM ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRUDMDTCBSM_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint8_t dtc_status_mask,
uint8_t memory_selection);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Request_config Message request configuration (see uds_msgconfig on page 27).
Out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Dtc_status_mask A mask of eight (8) DTC status bits.
Memory_selection Memory selection.
719
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRUDMDTCBSM_2013 on
the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint8_t dtc_status_mask = 0x12;
uint8_t memory_selection = 0x34;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
720
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.59 UDS_SvcReadDTCInformationRUDMDTCSSBDTC_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportUserDefMemoryDTCSnapshotRecordByDTCNumber ( PUDS_SVC_PARAM_RDTCI_RUDMDTCSSBDTC ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRUDMDTCSSBDTC_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint32_t dtc_mask,
uint8_t user_def_dtc_snapshot_record_number,
uint8_t memory_selection);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code.
user_def_dtc_snapshot_record_number User DTC snapshot record number.
memory_selection Memory selection.
721
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRUDMDTCSSBDTC_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint32_t dtc_mask = 0x12345678;
uint8_t user_def_dtc_snapshot_record_number = 0x9A;
uint8_t memory_selection = 0xBC;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
722
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.60 UDS_SvcReadDTCInformationRUDMDTCEDRBDN_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportUserDefMemoryDTCExtDataRecordByDTCNumber ( PUDS_SVC_PARAM_RDTCI_RUDMDTCEDRBDN ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRUDMDTCEDRBDN_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint32_t dtc_mask,
uint8_t dtc_extended_data_record_number,
uint8_t memory_selection);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_mask A unique identification number (three-byte value) for a specific diagnostic trouble code.
dtc_extended_data_record_number DTC extened data record number.
memory_selection Memory selection.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
723
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRUDMDTCEDRBDN_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint32_t dtc_mask = 0x12345678;
uint8_t dtc_extended_data_record_number = 0x9A;
uint8_t memory_selection = 0xBC;
memset(&request, 0, sizeof(request)) ;
memset(&request_confirmation, 0, sizeof(request_confirmation)) ;
memset(&response, 0, sizeof(response)) ;
memset(&config, 0, sizeof(config)) ;
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
724
PCAN-UDS 2.x API – User Manual
3.8.61 UDS_SvcReadDTCInformationRDTCEDI_2020
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportSupportedDTCExtDataRecord ( PUDS_SVC_PARAM_RDTCI_RDTCEDI ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRDTCEDI_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint8_t dtc_extended_data_record_number);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
dtc_extended_data_record_number DTC extended data record number.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRDTCEDI_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
725
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint8_t dtc_extended_data_record_number = 0x12;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.62 UDS_SvcReadDTCInformationRWWHOBDDTCBMR_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportWWHOBDDTCByMaskRecord ( PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCBMR ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRWWHOBDDTCBMR_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
726
PCAN-UDS 2.x API – User Manual
uint8_t functional_group_identifier,
uint8_t dtc_status_mask,
uint8_t dtc_severity_mask);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
functional_group_identifier Functional group identifier.
dtc_status_mask A mask of eight (8) DTC status bits.
dtc_severity_mask A mask of eight (8) DTC severity bits (see uds_svc_param_rdtci_dtcsvm on page 91).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRWWHOBDDTCBMR_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint8_t functional_group_identifier = 0x12;
uint8_t dtc_status_mask = 0x34;
uint8_t dtc_severity_mask = 0x78;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
727
PCAN-UDS 2.x API – User Manual
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.63 UDS_SvcReadDTCInformationRWWHOBDDTCWPS_2013
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportWWHOBDDTCWithPermanentStatus ( PUDS_SVC_PARAM_RDTCI_RWWHOBDDTCWPS ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRWWHOBDDTCWPS_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint8_t functional_group_identifier);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
functional_group_identifier Functional group identifier.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
728
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRWWHOBDDTCWPS_2013
on the channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint8_t functional_group_identifier = 0x12;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
729
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.64 UDS_SvcReadDTCInformationRDTCBRGI_2020
Writes a UDS request according to the ReadDTCInformation service’s specifications. This service allows a
client to read the status of server-resident Diagnostic Trouble Code (DTC) information. The subfunction
reportDTCInformationByDTCReadinessGroupIdentifier ( PUDS_SVC_PARAM_RDTCI_RDTCBRGI ) is implicit.
Syntax
C/C++
uds_status UDS_SvcReadDTCInformationRDTCBRGI_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg* out_msg_request,
uint8_t functional_group_identifier,
uint8_t dtc_readiness_group_identifier);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
functional_group_identifier Functional group identifier.
dtc_readiness_group_identifier DTC readiness group identifier.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
730
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service function UDS_SvcReadDTCInformationRDTCBRGI_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
uint8_t functional_group_identifier = 0x12;
uint8_t dtc_readiness_group_identifier = 0x34;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
731
PCAN-UDS 2.x API – User Manual
3.8.65 UDS_SvcInputOutputControlByIdentifier_2013
Writes a UDS request according to the InputOutputControlByIdentifier service’s specifications. The
InputOutputControlByIdentifier service is used by the client to substitute a value for an input signal, internal
server (ECU) function and/or control an output (actuator) of an electronic system.
Syntax
uds_status UDS_SvcInputOutputControlByIdentifier_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t data_identifier,
uint8_t * control_option_record,
uint32_t control_option_record_size,
uint8_t * control_enable_mask_record,
uint32_t control_enable_mask_record_size);
C++
uds_status UDS_SvcInputOutputControlByIdentifier_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint16_t data_identifier,
uint8_t * control_option_record,
uint32_t control_option_record_size,
uint8_t * control_enable_mask_record = nullptr,
uint32_t control_enable_mask_record_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
data_identifier A two-byte data identifier (see uds_svc_param_di on page 82).
control_option_record First byte can be used as either an input output control parameter that describes how the
server (ECU) shall control its inputs or outputs (see uds_svc_param_iocbi on page 92), or as
an additional control state byte.
control_option_record_size Size in bytes of the control option record buffer.
control_enable_mask_record The control enable mask shall only be supported when the input output control parameter is
used and the data identifier to be controlled consists of more than one parameter (i.e. the data
identifier is bit-mapped or packed by definition). There shall be one bit in the control enable
mask corresponding to each individual parameter defined within the data identifier.
control_enable_mask_record_size Size in bytes of the control enable mask record buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
732
PCAN-UDS 2.x API – User Manual
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcInputOutputControlByIdentifier_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t control_option_record[10];
uint8_t control_enable_mask_record[10];
uint16_t control_option_record_size = 10;
uint16_t control_enable_mask_record_size = 5;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill Data
for (int i = 0; i < control_option_record_size; i++)
{
control_option_record[i] = 'A' + i;
control_enable_mask_record[i] = 10 + i;
733
PCAN-UDS 2.x API – User Manual
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.66 UDS_SvcRoutineControl_2013
Writes a UDS request according to the RoutineControl service’s specifications. The RoutineControl service
is used by the client to start/stop a routine and request routine results.
Syntax
C
uds_status UDS_SvcRoutineControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t routine_control_type,
uint16_t routine_identifier,
uint8_t * routine_control_option_record,
uint32_t routine_control_option_record_size);
C++
uds_status UDS_SvcRoutineControl_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t routine_control_type,
uint16_t routine_identifier,
uint8_t * routine_control_option_record = nullptr,
uint32_t routine_control_option_record_size = 0);
734
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
routine_control_type Subfunction parameter: routine control type (see uds_svc_param_rc on page 93).
routine_identifier Server local routine identifier (see uds_svc_param_rc_rid on page 94).
routine_control_option_record Buffer containing the routine control options (only with start and stop routine
subfunctions).
routine_control_option_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcRoutineControl_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t routine_control_option_record[10];
uint16_t routine_control_option_record_size = 10;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
735
PCAN-UDS 2.x API – User Manual
// Fill data
for (int i = 0; i < routine_control_option_record_size; i++)
{
routine_control_option_record[i] = 'A' + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
See also: UDS_WaitForService_2013 on page 657, uds_svc_param_rc on page 93, uds_svc_param_rc_rid on page 94.
Class-method version: SvcRoutineControl_2013 on page 474.
3.8.67 UDS_SvcRequestDownload_2013
Writes a UDS request according to the RequestDownload service’s specifications. The RequestDownload
service is used by the client to initiate a data transfer from the client to the server/ECU (download).
Syntax
C/C++
uds_status UDS_SvcRequestDownload_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t compression_method,
uint8_t encrypting_method,
uint8_t * memory_address_buffer,
uint8_t memory_address_size,
uint8_t * memory_size_buffer,
uint8_t memory_size_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
736
PCAN-UDS 2.x API – User Manual
Parameter Description
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
memory_address_buffer Starting address of server (ECU) memory to which data is to be written.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size_buffer Used by the server (ECU) to compare the uncompressed memory size with the total amount of
data transferred during the TransferData service.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcRequestDownload_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t memory_address_buffer[8];
uint8_t memory_size_buffer[8];
uint8_t memory_address_size = 8;
uint8_t memory_size_size = 8;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
737
PCAN-UDS 2.x API – User Manual
// Fill data
for (int i = 0; i < memory_address_size; i++)
{
memory_address_buffer[i] = 'A' + i;
memory_size_buffer[i] = 10 + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.68 UDS_SvcRequestUpload_2013
Writes a UDS request according to the RequestUpload service’s specifications. The RequestUpload service
is used by the client to initiate a data transfer from the server/ECU to the client (upload).
Syntax
C/C++
uds_status UDS_SvcRequestUpload_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t compression_method,
uint8_t encrypting_method,
uint8_t * memory_address_buffer,
uint8_t memory_address_size,
uint8_t * memory_size_buffer,
uint8_t memory_size_size);
738
PCAN-UDS 2.x API – User Manual
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no compression
method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting method
is used.
memory_address_buffer Starting address of server (ECU) memory from which data is to be retrieved.
memory_address_size Size in bytes of the memory address buffer (max.: 0xF).
memory_size_buffer Used by the server (ECU) to compare the uncompressed memory size with the total amount of data
transferred during the TransferData service.
memory_size_size Size in bytes of the memory size buffer (max.: 0xF).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcRequestUpload_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t memory_address_buffer[4];
uint8_t memory_size_buffer[4];
uint8_t memory_address_size = 4;
uint8_t memory_size_size = 4;
uds_msgconfig config;
int i;
739
PCAN-UDS 2.x API – User Manual
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
for (i = 0; i < 4; i++) {
memory_address_buffer[i] = 0;
memory_size_buffer[i] = 0;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.69 UDS_SvcTransferData_2013
Writes a UDS request according to the TransferData service’s specifications. The TransferData service is
used by the client to transfer data either from the client to the server/ECU (download) or from the
server/ECU to the client (upload).
Syntax
C
uds_status UDS_SvcTransferData_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t block_sequence_counter,
uint8_t * transfer_request_parameter_record,
uint32_t transfer_request_parameter_record_size);
740
PCAN-UDS 2.x API – User Manual
C++
uds_status UDS_SvcTransferData_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t block_sequence_counter,
uint8_t * transfer_request_parameter_record = nullptr,
uint32_t transfer_request_parameter_record_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
block_sequence_counter The block_sequence_counter parameter value starts at 0x01 with the first TransferData
request that follows the RequestDownload (0x34) or RequestUpload (0x35) service. Its
value is incremented by 1 for each subsequent TransferData request. At the value of
0xFF, the block_sequence_counter rolls over and starts at 0x00 with the next
TransferData request message.
transfer_request_parameter_record Buffer containing the required transfer parameters.
transfer_request_parameter_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcTransferData_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
741
PCAN-UDS 2.x API – User Manual
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t record[50];
uint8_t record_size = 50;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill data
for (int i = 0; i < record_size; i++)
{
record[i] = 'A' + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
742
PCAN-UDS 2.x API – User Manual
3.8.70 UDS_SvcRequestTransferExit_2013
Writes a UDS request according to the RequestTransferExit service’s specifications. The
RequestTransferExit service is used by the client to terminate a data transfer between the client and
server/ECU (upload or download).
Syntax
C
uds_status UDS_SvcRequestTransferExit_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t * transfer_request_parameter_record,
uint32_t transfer_request_parameter_record_size);
C++
uds_status UDS_SvcRequestTransferExit_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t * transfer_request_parameter_record = nullptr,
uint32_t transfer_request_parameter_record_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
transfer_request_parameter_record Buffer containing the required transfer parameters.
transfer_request_parameter_record_size Size in bytes of the buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
743
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service function UDS_SvcRequestTransferExit_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uint8_t transfer_request_parameter_record[20];
uint8_t transfer_request_parameter_record_size = 20;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Fill data
for (int i = 0; i < transfer_request_parameter_record_size; i++)
{
transfer_request_parameter_record[i] = 'A' + i;
}
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
744
PCAN-UDS 2.x API – User Manual
3.8.71 UDS_SvcAccessTimingParameter_2013
Writes a UDS request according to the AccessTimingParameter service’s specifications.
Syntax
C/C++
uds_status UDS_SvcAccessTimingParameter_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t access_type,
uint8_t* request_record,
uint32_t request_record_size);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
access_type Access type (see uds_svc_param_atp on page 95).
request_record Timing parameter request record.
request_record_size Size in bytes of the request record.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_OVERFLOW The given buffer size is too big, the resulting UDS message data size is
bigger than the maximum data size.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
Example
The following example shows the use of the service function UDS_SvcAccessTimingParameter_2013 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
745
PCAN-UDS 2.x API – User Manual
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.72 UDS_SvcRequestFileTransfer_2013
Writes a UDS request according to the SvcRequestFileTransfer service’s specifications.
Syntax
C
uds_status UDS_SvcRequestFileTransfer_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t mode_of_operation,
uint16_t file_path_and_name_size,
uint8_t *file_path_and_name,
uint8_t compression_method,
uint8_t encrypting_method,
uint8_t file_size_parameter_size,
uint8_t *file_size_uncompressed,
746
PCAN-UDS 2.x API – User Manual
uint8_t *file_size_compressed);
C++
uds_status UDS_SvcRequestFileTransfer_2013(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t mode_of_operation,
uint16_t file_path_and_name_size,
uint8_t *file_path_and_name,
uint8_t compression_method = 0,
uint8_t encrypting_method = 0,
uint8_t file_size_parameter_size = 0,
uint8_t *file_size_uncompressed = 0,
uint8_t *file_size_compressed = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
mode_of_operation Mode of operation (see uds_svc_param_rft_moop on page 96).
file_path_and_name_size Size in bytes of file_path_and_name buffer
file_path_and_name File path and name string.
compression_method A nibble-value that specifies the compression method, the value 0x0 specifies that no
compression method is used.
encrypting_method A nibble-value that specifies the encrypting method, the value 0x0 specifies that no encrypting
method is used.
file_size_parameter_size Size in byte of file_size_uncompressed and file_size_compressed parameters
file_size_uncompressed Uncompressed file size.
file_size_compressed Compressed file size.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
747
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service function UDS_SvcRequestFileTransfer_2013 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
748
PCAN-UDS 2.x API – User Manual
3.8.73 UDS_SvcAuthenticationDA_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction deAuthenticate is implicit.
Syntax
C/C++
uds_status UDS_SvcAuthenticationDA_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service function UDS_SvcAuthenticationDA_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
749
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.74 UDS_SvcAuthenticationVCU_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyCertificateUnidirectional is implicit.
Syntax
uds_status UDS_SvcAuthenticationVCU_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t communication_configuration,
uint8_t *certificate_client,
uint16_t certificate_client_size,
uint8_t *challenge_client,
uint16_t challenge_client_size);
750
PCAN-UDS 2.x API – User Manual
C++
uds_status UDS_SvcAuthenticationVCU_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t communication_configuration,
uint8_t *certificate_client,
uint16_t certificate_client_size,
uint8_t *challenge_client = nullptr,
uint16_t challenge_client_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
communication_configuration Configuration information about communication.
certificate_client Buffer containing the certificate of the client.
certificate_client_size Size in bytes of the certificate buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service function UDS_SvcAuthenticationVCU_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
751
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
752
PCAN-UDS 2.x API – User Manual
3.8.75 UDS_SvcAuthenticationVCB_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyCertificateBidirectional is implicit.
Syntax
C/C++
uds_status UDS_SvcAuthenticationVCB_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t communication_configuration,
uint8_t *certificate_client,
uint16_t certificate_client_size,
uint8_t *challenge_client,
uint16_t challenge_client_size) ;
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Request_config Message request configuration (see uds_msgconfig on page 27).
Out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Communication_configuration Configuration information about communication.
Certificate_client Buffer containing the certificate of the client.
Certificate_client_size Size in bytes of the certificate buffer.
Challenge_client Buffer containing the challenge of the client.
Challenge_client_size Size in bytes of the challenge buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
753
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service function UDS_SvcAuthenticationVCB_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
754
PCAN-UDS 2.x API – User Manual
3.8.76 UDS_SvcAuthenticationPOWN_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction proofOfOwnership is implicit.
Syntax
uds_status UDS_SvcAuthenticationPOWN_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t *proof_of_ownership_client,
uint16_t proof_of_ownership_client_size,
uint8_t *ephemeral_public_key_client,
uint16_t ephemeral_public_key_client_size);
C++
uds_status UDS_SvcAuthenticationPOWN_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t *proof_of_ownership_client,
uint16_t proof_of_ownership_client_size,
uint8_t *ephemeral_public_key_client = nullptr,
uint16_t ephemeral_public_key_client_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
ephemeral_public_key_client Buffer containing the ephemeral public key of the client.
ephemeral_public_key_client_size Size in bytes of the ephemeral public key buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
755
PCAN-UDS 2.x API – User Manual
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter(see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service function UDS_SvcAuthenticationPOWN_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
756
PCAN-UDS 2.x API – User Manual
3.8.77 UDS_SvcAuthenticationRCFA_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction requestChallengeForAuthentication is implicit.
Syntax
C/C++
uds_status UDS_SvcAuthenticationRCFA_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t communication_configuration,
uint8_t *algorithm_indicator);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
communication_configuration Configuration information about communication.
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
757
PCAN-UDS 2.x API – User Manual
Example
The following example shows the use of the service function UDS_SvcAuthenticationRCFA_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
C/C++
uds_status result ;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
758
PCAN-UDS 2.x API – User Manual
3.8.78 UDS_SvcAuthenticationVPOWNU_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyProofOfOwnershipUnidirectional is implicit.
Syntax
uds_status UDS_SvcAuthenticationVPOWNU_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t *algorithm_indicator,
uint8_t *proof_of_ownership_client,
uint16_t proof_of_ownership_client_size,
uint8_t *challenge_client,
uint16_t challenge_client_size,
uint8_t *additional_parameter,
uint16_t additional_parameter_size);
C++
uds_status UDS_SvcAuthenticationVPOWNU_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t *algorithm_indicator,
uint8_t *proof_of_ownership_client,
uint16_t proof_of_ownership_client_size,
uint8_t *challenge_client = nullptr,
uint16_t challenge_client_size = 0,
uint8_t *additional_parameter = nullptr,
uint16_t additional_parameter_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Request_config Message request configuration (see uds_msgconfig on page 27).
Out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Algorithm_indicator Buffer of 16 bytes containing the algorithm indicator
proof_of_ownership_client Buffer containing the proof of ownership of the client.
Proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
Challenge_client Buffer containing the challenge of the client.
Challenge_client_size Size in bytes of the challenge buffer.
Additional_parameter Buffer containing additional parameters.
Additional_parameter_size Size in bytes of the additional parameter buffer.
759
PCAN-UDS 2.x API – User Manual
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service function UDS_SvcAuthenticationVPOWNU_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
760
PCAN-UDS 2.x API – User Manual
uint8_t algorithm_indicator[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
uint8_t proof_of_ownership_client[2] = { 0x12, 0x34 };
uint16_t proof_of_ownership_client_size = 2;
uint8_t challenge_client[2] = { 0x56, 0x78 };
uint16_t challenge_client_size = 2;
uint8_t additional_parameter[2] = { 0x9A, 0xBC };
uint16_t additional_parameter_size = 2;
result = UDS_SvcAuthenticationVPOWNU_2020(PCANTP_HANDLE_USBBUS1, config, &request,
algorithm_indicator, proof_of_ownership_client, proof_of_ownership_client_size,
challenge_client, challenge_client_size, additional_parameter,
additional_parameter_size);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
result = UDS_WaitForService_2013(PCANTP_HANDLE_USBBUS1, &request, &response,
&request_confirmation);
if (UDS_StatusIsOk_2013(result, PUDS_STATUS_OK, false))
printf("Response was received\n");
else
// An error occurred
printf("An error occurred\n");
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
3.8.79 UDS_SvcAuthenticationVPOWNB_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction verifyProofOfOwnershipBidirectional is implicit.
Syntax
uds_status UDS_SvcAuthenticationVPOWNB_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t *algorithm_indicator,
uint8_t *proof_of_ownership_client,
uint16_t proof_of_ownership_client_size,
uint8_t *challenge_client,
uint16_t challenge_client_size,
uint8_t *additional_parameter,
uint16_t additional_parameter_size);
C++
uds_status UDS_SvcAuthenticationVPOWNB_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request,
uint8_t *algorithm_indicator,
uint8_t *proof_of_ownership_client,
uint16_t proof_of_ownership_client_size,
uint8_t *challenge_client,
761
PCAN-UDS 2.x API – User Manual
uint16_t challenge_client_size,
uint8_t *additional_parameter = nullptr,
uint16_t additional_parameter_size = 0);
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
request_config Message request configuration (see uds_msgconfig on page 27).
out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
algorithm_indicator Buffer of 16 bytes containing the algorithm indicator.
proof_of_ownership_client Buffer containing the proof of ownership of the client.
proof_of_ownership_client_size Size in bytes of the proof of ownership buffer.
challenge_client Buffer containing the challenge of the client.
challenge_client_size Size in bytes of the challenge buffer.
additional_parameter Buffer containing additional parameters.
additional_parameter Size in bytes of the additional parameter buffer.
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE One of the given parameters is not valid.
PUDS_STATUS_MAPPING_NOT_INITIALIZED The mapping given in the message configuration is unknown.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service function UDS_SvcAuthenticationVPOWNB_2020 on the
channel PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the
UDS_WaitForService_2013 function is called to get the response. Depending on the result, a message will be
shown to the user.
762
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
763
PCAN-UDS 2.x API – User Manual
3.8.80 UDS_SvcAuthenticationAC_2020
Writes a UDS request according to the Authentication service’s specifications (ISO-14229-1:2020). The
subfunction authenticationConfiguration is implicit.
Syntax
C/C++
uds_status UDS_SvcAuthenticationAC_2020(
cantp_handle channel,
uds_msgconfig request_config,
uds_msg *out_msg_request) ;
Parameters
Parameter Description
channel The handle of a PUDS channel (see cantp_handle on page 105).
Request_config Message request configuration (see uds_msgconfig on page 27).
Out_msg_request Output, request message created and sent by the function (see uds_msg on page 21).
Returns
The return value is a uds_status code. PUDS_STATUS_OK is returned on success. The typical errors in case of
failure are:
PUDS_STATUS_NOT_INITIALIZED Indicates that the given PUDS channel was not found in the list of reserved
channels of the calling application.
PUDS_STATUS_PARAM_INVALID_VALUE The request configuration is not valid (see uds_msgconfig on page 27), or
the given message buffer is null.
PUDS_STATUS_SERVICE_ALREADY_PENDING A message with the same service identifier is already pending in the
reception queue, the user must read a response for his previous request
before or clear the reception queues with UDS_Reset_2013 (see
UDS_Reset_2013 on page 652).
PUDS_STATUS_NO_MEMORY Failed to allocate memory and copy the new message in the transmission
queue.
PUDS_STATUS_MESSAGE_BUFFER_ALREADY_USED The given message buffer is already allocated, user must release the buffer
before reusing it (see UDS_MsgFree_2013 on page 646).
Remarks
This function creates a new message using the given message configuration and sets the given data
according to the service’s specifications. It then writes the message to the transmit queue. Once processed,
this request message should be released (see UDS_MsgFree_2013 on page 646).
The PCAN-UDS 2.x API provides uds_svc_authentication_subfunction (see on page 98) and
uds_svc_authentication_return_parameter (see on page 99) enumerations to help user to decode Authentication
service responses.
Example
The following example shows the use of the service function UDS_SvcAuthenticationAC_2020 on the channel
PCANTP_HANDLE_USBBUS1 . A UDS physical service request is transmitted, and the UDS_WaitForService_2013
function is called to get the response. Depending on the result, a message will be shown to the user.
764
PCAN-UDS 2.x API – User Manual
C/C++
uds_status result;
uds_msg request;
uds_msg request_confirmation;
uds_msg response;
uds_msgconfig config;
memset(&request, 0, sizeof(request));
memset(&request_confirmation, 0, sizeof(request_confirmation));
memset(&response, 0, sizeof(response));
memset(&config, 0, sizeof(config));
// Free structures
UDS_MsgFree_2013(&request);
UDS_MsgFree_2013(&response);
UDS_MsgFree_2013(&request_confirmation);
765
PCAN-UDS 2.x API – User Manual
3.9 Definitions
The PCAN-UDS 2.x API defines the following values:
Name Description
Messages Related Definitions Defines values and constants for the members of the uds_msg structure.
PCAN-UDS 2.x Service Parameter Definitions Defines constants to be used with some UDS service functions.
Data information:
Other values:
Note: Ranges for system-supplier-specific use and ISO/SAE reserved values have been discarded.
766
PCAN-UDS 2.x API – User Manual
the bit-encoded low nibble of this byte represents the communication types,
the high nibble defines which of the subnets connected to the receiving node shall be disabled/enabled
The following table defines the EventWindowTime parameters to be used with ResponseOnEvent service:
767
PCAN-UDS 2.x API – User Manual
The following table defines the onTimerInterrupt timer parameters to be used with ResponseOnEvent
service:
768
PCAN-UDS 2.x API – User Manual
4 Additional Information
PCAN is the platform for PCAN-OBDII, PCAN-UDS 2.x, and PCAN-Basic. In the following, topics there is an
overview of PCAN and the fundamental practice with the interface DLL CanApi2 (PCAN-API).
Topics Description
PCAN Fundamentals This section contains an introduction to PCAN
PCAN-Basic This section contains general information about the PCAN-Basic API
UDS and ISO-TP Network This section contains general information about the ISO-TP network addressing format
Addressing Information
The basis for the communication between PCs and external hardware via CAN is a series of Windows
Kernel-Mode Drivers (Virtual Device Drivers) e.g. PCAN_USB.SYS, PCAN_PCI.SYS, PCAN_xxx.SYS. These
drivers are the core of a complete CAN environment on a PC running Windows and work as interfaces
between CAN software and PC-based CAN hardware. The drivers manage the entire data flow of every
CAN device connected to the PC.
769
PCAN-UDS 2.x API – User Manual
See also: PCAN-Basic on page 770, ISO-TP Network Addressing Format on page 774.
4.2 PCAN-Basic
PCAN-Basic is a programming application interface (API) for CAN communication using the PCAN system
of the company PEAK-System Technik GmbH. It comprises of a collection of Windows Device Drivers which
allow the real-time connection of Windows applications to all CAN busses physically connected to a PC.
PCAN-Basic supports connecting several CAN channels simultaneously, from the same or different types
of devices. The following list shows the PCAN-Channels that can be connected per PCAN-Device:
Using PCAN-Basic
PCAN-Basic offers the possibility to use several PCAN channels within the same application easily. The
communication process is divided in 3 phases: initialization, interaction, and finalization of a PCAN channel.
Initialization: To do CAN communication using a channel, it is necessary to first initialize it. This is done
making a call to the function CAN_Initialize (class-method: Initialize ) or CAN_InitializeFD (class-method: InitializeFD )
in case of FD communication.
Interaction: After successful initialization, a channel is ready to communicate with the connected CAN bus.
Further configuration is not needed. The functions CAN_Read and CAN_Write (class-methods: Read and Write )
can then be used to read and write CAN messages. If the used channel is FD-capable and has been
initialized using CAN_InitializedFD , then the functions to use are CAN_ReadFD and CAN_WriteFD (class-methods:
ReadFD and WriteFD ). An extra configuration can be made to improve a communication session, like
changing the message filter to target-specific messages.
Finalization: When the communication is finished, the function CAN_Uninitialize (class-method: Uninitialize )
should be called to release the PCAN channel and the resources allocated to it. In this way, the channel is
marked as “Free” and can be used by other applications.
770
PCAN-UDS 2.x API – User Manual
See also: PCAN Fundamentals on page 769, ISO-TP Network Addressing Format on page 774.
Functional request using 11 bits CAN identifier and normal addressing, from External Test Equipment
address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) to OBD functional address
( PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL ):
• CAN ID 0x7DF ( PUDS_ISO_15765_4_CAN_ID_FUNCTIONAL_REQUEST ) from Source 0xF1 to Target 0x33
Physical requests and responses using 11 bits CAN identifier and normal addressing, between the
External Test Equipment address ( PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT ) and standard ECU
addresses (ECU #1 to #8):
• ECU #1
- Request: CAN ID 0x7E8 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_1 ) from Source 0xF1
to Target 0x01
- Response: CAN ID 0x7E0 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_1 ) from Source
0x01 to Target 0xF1
• ECU #2:
- Request: CAN ID 0x7E9 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_2 ) from Source 0xF1
to Target 0x01
- Response: CAN ID 0x7E1 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_2 ) from Source
0x01 to Target 0xF1
• ECU #3:
- Request: CAN ID 0x7EA ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_3 ) from Source 0xF1
to Target 0x01
- Response: CAN ID 0x7E2 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_3 ) from Source
0x01 to Target 0xF1
771
PCAN-UDS 2.x API – User Manual
• ECU #4:
- Request: CAN ID 0x7EB ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_4 ) from Source 0xF1
to Target 0x01
- Response: CAN ID 0x7E3 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_4 ) from Source
0x01 to Target 0xF1
• ECU #5:
- Request: CAN ID 0x7EC ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_5 ) from Source 0xF1
to Target 0x01
- Response: CAN ID 0x7E4 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_5 ) from Source
0x01 to Target 0xF1
• ECU #6:
- Request: CAN ID 0x7ED ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_6 ) from Source 0xF1
to Target 0x01
- Response: CAN ID 0x7E5 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_6 ) from Source
0x01 to Target 0xF1
• ECU #7:
- Request: CAN ID 0x7EE ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_7 ) from Source 0xF1 to
Target 0x01
- Response: CAN ID 0x7E6 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_7 ) from Source
0x01 to Target 0xF1
• ECU #8:
- Request: CAN ID 0x7EF ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_REQUEST_8 ) from Source 0xF1 to
Target 0x01
- Response: CAN ID 0x7E7 ( PUDS_ISO_15765_4_CAN_ID_PHYSICAL_RESPONSE_8 ) from Source
0x01 to Target 0xF1
Communications with 29 bits CAN identifier and FIXED NORMAL addressing format (where XX is
Target Address and YY Source address and respectively physical/functional addressing):
- CAN ID 0x00DAXXYY/0x00DBXXYY (data link layer priority 0)
- CAN ID 0x04DAXXYY/0x04DBXXYY (data link layer priority 1)
- CAN ID 0x08DAXXYY/0x08DBXXYY (data link layer priority 2)
- CAN ID 0x0CDAXXYY/0x0CDBXXYY (data link layer priority 3)
- CAN ID 0x10DAXXYY/0x10DBXXYY (data link layer priority 4)
- CAN ID 0x14DAXXYY/0x14DBXXYY (data link layer priority 5)
- CAN ID 0x18DAXXYY/0x18DBXXYY (data link layer priority 6)
- CAN ID 0x1CDAXXYY/0x1CDBXXYY (data link layer priority 7)
Communications with 29 bits CAN identifier and MIXED addressing format (where XX is Target Address
and YY Source address and respectively physical/functional addressing):
- CAN ID 0x00CEXXYY/0x00CDXXYY (data link layer priority 0)
- CAN ID 0x04CEXXYY/0x04CDXXYY (data link layer priority 1)
- CAN ID 0x08CEXXYY/0x08CDXXYY (data link layer priority 2)
- CAN ID 0x0CCEXXYY/0x0CCDXXYY (data link layer priority 3)
- CAN ID 0x10CEXXYY/0x10CDXXYY (data link layer priority 4)
772
PCAN-UDS 2.x API – User Manual
If an application requires other communication settings, it will have to be set with through the function
UDS_AddMapping_2013 and the method AddMapping_2013 . See also uds_mapping on page 25.
Alternatively, it is also possible to directly use PCAN-ISO-TP 3.x API. Once a PUDS channel is initialized,
PCAN-ISO-TP 3.x specific functions (like CANTP_Write_2016 and CANTP_Read_2016 ) can be called.
cantp_handle channel;
// ...
cantp_handle channel;
// ...
773
PCAN-UDS 2.x API – User Manual
Standardized 29 bits CAN identifiers do not use mappings, if you want to override those CAN identifiers,
simply use that value when adding a mapping.
If you need to disable completely the handling of standardized ISO-TP 29 bits CAN identifiers,
consider disabling their support directly in PCAN-ISO-TP API using the following parameters:
• PCANTP_PARAMETER_SUPPORT_29B_ENHANCED
• PCANTP_PARAMETER_SUPPORT_29B_FIXED_NORMAL
• PCANTP_PARAMETER_SUPPORT_29B_MIXED
The following table sums up the mandatory configuration to the PCAN-ISO-TP 3.x API for each addressing
format:
A mapping allows an PCANTP node to identify and decode CAN Identifiers, it binds a CAN identifier to an
PCANTP network address information. CAN messages that cannot be identified are ignored by the API.
774
PCAN-UDS 2.x API – User Manual
Mappings involving physically addressed communication are most usually defined in pairs: the first
mapping defines outgoing communication (i.e. request messages from node A to node B) and the second
to match incoming communication (i.e. responses from node B to node A).
// Add mapping for physical request from external equipment to ECU_1: ID=0x326
memset(&mapping, 0, sizeof(mappin g));
mapping.can_id = 0x326;
mapping.can_id_flow_ctrl = 0x626;
mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mapping.can_tx_dlc = 8;
mapping.nai.extension_addr = 0;
mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status = UDS_AddMapping_2013(channel, &mapping);
if (!UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Add mapping failed.\n");
// Add mapping for physical response from ECU_#X to external equipment: ID=0x626
memset(&mapping, 0, sizeof(mappin g));
mapping.can_id = 0x626;
mapping.can_id_flow_ctrl = 0x326;
mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mapping.can_tx_dlc = 8;
mapping.nai.extension_addr = 0;
mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_ECU_1;
mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_PHYSICAL;
status = UDS_AddMapping_2013(channel, &mapping);
if (!UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Add mapping failed.\n");
775
PCAN-UDS 2.x API – User Manual
mapping.can_msgtype = PCANTP_CAN_MSGTYPE_STANDARD;
mapping.can_tx_dlc = 8;
mapping.nai.extension_addr = 0;
mapping.nai.protocol = PUDS_MSGPROTOCOL_ISO_15765_2_11B_NORMAL;
mapping.nai.source_addr = PUDS_ISO_15765_4_ADDR_TEST_EQUIPMENT;
mapping.nai.target_addr = PUDS_ISO_15765_4_ADDR_OBD_FUNCTIONAL;
mapping.nai.target_type = PCANTP_ISOTP_ADDRESSING_FUNCTIONAL;
status = UDS_AddMapping_2013(channel, &mapping);
if (!UDS_StatusIsOk_2013(status, PUDS_STATUS_OK, false))
printf("Add mapping failed.\n");
uds_status status;
int tmp_buffer;
int count;
uds_msgconfig config;
uds_msg tx_msg;
uds_msg rx_msg;
memset(&config, 0, sizeof(config));
memset(&tx_msg, 0, sizeof(tx_msg));
memset(&rx_msg, 0, sizeof(rx_msg));
776
PCAN-UDS 2.x API – User Manual
777
PCAN-UDS 2.x API – User Manual
UDS_Uninitialize_2013(PCANTP_HANDLE_NONEBUS);
The client program does not need to check periodically for received messages any longer
The response time on received messages is reduced
To use events, the client application must call the UDS_SetValue_2013 function (class-method: SetValue_2013 ) to
set the parameter PUDS_PARAMETER_RECEIVE_EVENT . This parameter sets the handle for the event object.
When receiving a message, the API sets this event to the Signaled state.
Another thread must be started in the client application, which waits for the event to be signaled, using
one of the Win32 synchronization functions (e.g. WaitForSingleObject ) without increasing the processor load.
After the event is signaled, available messages can be read with the UDS_Read_2013 function (class method:
Read_2013 ), and the UDS messages can be processed.
Remarks
Be careful, it is not recommended to use both event-handler (with a reading thread) and the UDS WaitFor
functions and methods:
UDS_WaitForSingleMessage_2013 / WaitForSingleMessage_2013
UDS_WaitForFunctionalResponses_2013 / WaitForFunctionalResponses_2013
UDS_WaitForService_2013 / WaitForService_2013
UDS_WaitForServiceFunctional_2013 / WaitForServiceFunctional_2013
Indeed, both mechanisms would read messages at the same time, the result is that one will not receive
any (or some) messages. If one of the previous functions is called and a thread is waiting for events to call
the read UDS message function, then the user will have to temporarily prevent the thread from reading
messages.
• Trigger mode set (default): After the first waiting thread has been released, the event object's
state changes to non-signaled. Other waiting threads are not released. If no threads are waiting,
the event object's state remains signaled
• Trigger mode pulse: After the first waiting thread has been released, the event object's state
changes to non-signaled. Other waiting threads are not released. If no threads are waiting, or if
no thread can be released immediately, the event object's state is simply set to non-signaled
778
PCAN-UDS 2.x API – User Manual
779
PCAN-UDS 2.x API – User Manual
5 License Information
The use of this software is subject to the terms of the End User License Agreement of PEAK-System Technik
GmbH.
The APIs PCAN-UDS 2.x, PCAN-ISO-TP 3.x, and PCAN-Basic are property of the PEAK-System Technik
GmbH and may be used only in connection with a hardware component purchased from PEAK-System or
one of its partners. If CAN hardware of third-party suppliers should be compatible to that of PEAK-System,
then you are not allowed to use the mentioned APIs with those components.
If a third-party supplier develops software based on the mentioned APIs and problems occur during the
use of this software, consult that third-party supplier.
780