Softing EasyPDU UserManual
Softing EasyPDU UserManual
1 Mainpage 2
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 System Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 What the EasyPDU API provides . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Supported D-PDU APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Supported VCI hardware devices and protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 EasyPDU Demo Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Tutorial 13
3.1 EasyPDU examples for Microsoft Visual Studio 2010 . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 FAQ 13
4.1 Questions concerning EasyPDU C++ API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.1.1 I get an unhandled Exception error while running EasyPDUCpp . . . . . . . . . . . . . . . 13
5 Namespace Index 13
5.1 Namespace List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6 Class Index 14
6.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
7 Namespace Documentation 14
7.1 EasyPDU Namespace Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
7.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
7.1.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
CONTENTS ii
8 Class Documentation 20
9 Example Documentation 34
9.1 ComParam.ini . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.2 example_1.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
9.3 example_1.cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
9.4 example_1.py . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
9.5 example_2.cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Index40
CONTENTS 1
1 Mainpage
• Introduction
• System Requirements
1.1 Introduction
This document includes getting started information and a function reference for the EasyPDU, an API on top of the
D-PDU API that allows simple access for the most common API functions. The D-PDU API, as an internationally
standardized programming interface has gained widespread adoption in the industry over the last years. It provides
full access to all important vehicle diagnostic protocols and is supported by a variety of diagnostic kernels and user
applications. However, there is one draw-back to this "one size fits all" approach: The D-PDU API is in no way
easy to handle. When a programmer intends to create a simple application, based on a diagnostic protocol, and
designed only for a very specific and limited purpose, this can be achieved with the D-PDU API - but unfortunately
not in an easy way. Literally dozens of calls to D-PDU API functions, several memory allocations (and also memory
releases), handling of different types of handles (module handles, ComLogicalLink handles, ComPrimitive handles)
are required, in order to send one single diagnostic message to a vehicle interface. This situation creates a strong
desire for a simpler, more condensed variant of a D-PDU API, where basic vehicle communication can be achieved
with a bare minimum of required calls to the D-PDU API.
1 Mainpage 2
1.2 System Requirements
In order to use the EasyPDU API for your own application, you need:
• a supported vehicle communication interface (VCI) hardware device connected to your PC and configured
with your D-PDU API
• an integrated development environment (IDE) for at least one of the supported programming languages: C++,
Visual Basic, C#, Python
• the EasyPDU API library files for your particular programming language
– C++
– C#
– Visual Basic
– other dotNET languages
– Python
For a complete list of all supported VCI hardware devices and protocols see Protocol/Bustype/Port combinations for
supported VCIs.
The EasyPDU_GUI.exe is a graphical demo application that uses the EasyPDU API. Before you start to write your
own application it may be useful to check your D-PDU API installation and VCI configuration with this demo GUI:
1. Start EasyPDU_GUI.exe.
2. Select D-PDU API from drop-down list. If no D-PDU API is available, check your D-PDU API installation and
your RootDescriptionFile.
4. Select VCI hardware device from drop-down list. If no VCI is available, check whether your VCI is connected
to your PC an installed correctly using the tools installed with your D-PDU API. Also check whether your VCI
is supported.
5. Click on "connect VCI". If you use a W-LAN device an get an connection error open the Windows wireless
lan connections and see if your VCI is connected. If so, you can try to disconnect an reconnect the VCI.
8. Click on "read ComParams and UniqueRespIdTable from .ini file" and select a .ini file with your configuration.
There is an example ComParam.ini file, but depending on your bus configuration you have modify it.
10. Type your PDU in comma separated decimal or 0xHEX notation (for example: "10,92") and click "send"-button
in order to start a diagnostic session.
• If there is a ECU with the default identifier of your D-PDU API for this protocol, you will get
R RespId(1): 50 92
as a positive response.
• If there is no ECU with the default identifier of your D-PDU API for this protocol, you will get
R Error: RX_TIMEOUT: P2 timeout
as a timeout error.
• If you get an other error, there seems to be something wrong with your bus.
This list shows all Protocol/Bus/Port combinations that are possible with the appropriate VCIs.
Following VCIs are supported:
• EDICblue
• EDICcard2
• EDICpci
• EDICusb
• EDICwlan
• VCI_HSC
• VCI_HSX
• VCI_HS_LIGHT
• VCI_HS_PLUS
• VCI_HS_WLAN_HD
2.1 EDICblue
2.2 EDICcard2
2.2 EDICcard2 6
ISO_11898_RAW ISO_11898_2_DWCAN CAN2
ISO_11898_RAW ISO_11898_3_DWFTCAN CAN1
ISO_11898_RAW ISO_11898_3_DWFTCAN CAN2
ISO_11898_RAW ISO_11898_3_DWFTCAN CAN2
MSP_SFTNG_CAN ISO_11898_2_DWCAN CAN1
MSP_SFTNG_CAN ISO_11898_2_DWCAN CAN2
MSP_SFTNG_CAN ISO_11898_2_DWCAN CAN2
MSP_SFTNG_CAN ISO_11898_3_DWFTCAN CAN1
MSP_SFTNG_CAN ISO_11898_3_DWFTCAN CAN2
MSP_SFTNG_CAN ISO_11898_3_DWFTCAN CAN2
ISO_14230_3_on_ISO_14230_2 ISO_9141_2_UART KL_LINE
ISO_14230_3_on_ISO_14230_2 ISO_9141_2_UART K_LINE
MSP_VW2000LP_on_ISO_←- ISO_9141_2_UART KL_LINE
14230_2
MSP_VW2000LP_on_ISO_←- ISO_9141_2_UART K_LINE
14230_2
MSP_VW2000LP_on_TP20 ISO_11898_2_DWCAN CAN1
MSP_VW2000LP_on_TP20 ISO_11898_2_DWCAN CAN2
MSP_VW2000LP_on_TP20 ISO_11898_2_DWCAN CAN2
MSP_VW2000LP_on_TP20 ISO_11898_3_DWFTCAN CAN1
MSP_VW2000LP_on_TP20 ISO_11898_3_DWFTCAN CAN2
MSP_VW2000LP_on_TP20 ISO_11898_3_DWFTCAN CAN2
MSP_VW2000LP_on_TP16 ISO_11898_2_DWCAN CAN1
MSP_VW2000LP_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_VW2000LP_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_VW2000LP_on_TP16 ISO_11898_3_DWFTCAN CAN1
MSP_VW2000LP_on_TP16 ISO_11898_3_DWFTCAN CAN2
MSP_VW2000LP_on_TP16 ISO_11898_3_DWFTCAN CAN2
MSP_KW1281_on_ISO_9141_2 ISO_9141_2_UART KL_LINE
MSP_KW1281_on_ISO_9141_2 ISO_9141_2_UART K_LINE
ISO_OBD_on_K_Line ISO_9141_2_UART KL_LINE
ISO_OBD_on_K_Line ISO_9141_2_UART K_LINE
ISO_OBD_on_ISO_15765_4 ISO_11898_2_DWCAN CAN1
ISO_OBD_on_ISO_15765_4 ISO_11898_2_DWCAN CAN2
ISO_OBD_on_ISO_15765_4 ISO_11898_2_DWCAN CAN2
MSP_SFTNG_ISO_11898_←- ISO_11898_2_DWCAN CAN1
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_2_DWCAN CAN2
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_2_DWCAN CAN2
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_3_DWFTCAN CAN1
onboard
2.2 EDICcard2 7
MSP_SFTNG_ISO_11898_←- ISO_11898_3_DWFTCAN CAN2
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_3_DWFTCAN CAN2
onboard
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN1
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_KW1281_on_TP16 ISO_11898_3_DWFTCAN CAN1
MSP_KW1281_on_TP16 ISO_11898_3_DWFTCAN CAN2
MSP_KW1281_on_TP16 ISO_11898_3_DWFTCAN CAN2
2.3 EDICpci
2.3 EDICpci 8
MSP_SFTNG_ISO_11898_←- ISO_11898_2_DWCAN CAN1
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_2_DWCAN CAN2
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_3_DWFTCAN CAN1
onboard
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN1
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_KW1281_on_TP16 ISO_11898_3_DWFTCAN CAN1
2.4 EDICusb
2.4 EDICusb 9
MSP_SFTNG_ISO_11898_←- ISO_11898_2_DWCAN CAN2
onboard
MSP_SFTNG_ISO_11898_←- ISO_11898_3_DWFTCAN CAN1
onboard
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN1
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_KW1281_on_TP16 ISO_11898_3_DWFTCAN CAN1
2.5 EDICwlan
2.5 EDICwlan 10
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN1
MSP_KW1281_on_TP16 ISO_11898_2_DWCAN CAN2
MSP_KW1281_on_TP16 ISO_11898_3_DWFTCAN CAN1
2.6 VCI_HSC
2.7 VCI_HSX
2.8 VCI_HS_LIGHT
2.6 VCI_HSC 11
MSP_VW2000LP_on_TP20 ISO_11898_2_DWCAN CAN1
MSP_VW2000LP_on_TP16 ISO_11898_2_DWCAN CAN1
ISO_11898_RAW ISO_11898_2_DWCAN CAN1
SAE_J1939_73_on_SAE_J1939←- SAE_J1939_11_DWCAN CAN1
_21
MSP_KW500_3_on_KW500_2 KW500_1_UART KL_LINE
ISO_14230_3_on_ISO_14230_2 ISO_14230_1_UART K_LINE
ISO_15031_5_on_ISO_14230_4 ISO_14230_1_UART K_LINE
ISO_15031_5_on_ISO_9141_2 ISO_9141_2_UART K_LINE
ISO_OBD_on_K_Line ISO_14230_1_UART K_LINE
MSP_VW2000LP_on_ISO_←- ISO_14230_1_UART K_LINE
14230_2
MSP_KW71_UART ISO_9141_2_UART KL_LINE
2.9 VCI_HS_PLUS
2.10 VCI_HS_WLAN_HD
2.9 VCI_HS_PLUS 12
MSP_KW500_3_on_KW500_2 KW500_1_UART KL_LINE
ISO_14230_3_on_ISO_14230_2 ISO_14230_1_UART K_LINE
ISO_15031_5_on_ISO_14230_4 ISO_14230_1_UART K_LINE
ISO_15031_5_on_ISO_9141_2 ISO_9141_2_UART K_LINE
ISO_OBD_on_K_Line ISO_14230_1_UART K_LINE
MSP_VW2000LP_on_ISO_←- ISO_14230_1_UART K_LINE
14230_2
MSP_KW71_UART ISO_9141_2_UART KL_LINE
3 Tutorial
In the examples folder, you can find short code examples for every supported programming language. These
examples are well documentated an can be uses as a basis for your own EasyPDU application. For simplification,
the example folders for the diffenent programming languages each contain all required dll in order to compile and run
the example "out of the box". Nevertheless, you have to do some modifications to the ComParam.ini file, depending
on your particular bus configuration.
• for C++:
• for C#:
• for Python:
4 FAQ
• when using Visual Studio, make sure you have compiled with /MD or /MDd
• if the exception is of type EasyPduException you can catch it in order to get more information
5 Namespace Index
3 Tutorial 13
EasyPDU
Namespace for the EasyPDU C++ API 14
6 Class Index
Here are the classes, structs, unions and interfaces with brief descriptions:
Cop
Class for convenient communication primitive access. 20
EasyPduException
This Exception is thrown whenever something went wrong in an EasyPDU function. 22
Link
Class for convenient access to a ComLogicalLink. 23
Pduapi
Class for convenient D-PDU API access. 27
Response
Class for convenient Cop-Response access. 30
Vci
Class for convenient VCI hardware device access. 32
7 Namespace Documentation
Classes
• class Cop
Class for convenient communication primitive access.
• class EasyPduException
This Exception is thrown whenever something went wrong in an EasyPDU function.
• class Link
Class for convenient access to a ComLogicalLink.
• class Pduapi
Class for convenient D-PDU API access.
• class Response
Class for convenient Cop-Response access.
• class Vci
Class for convenient VCI hardware device access.
6 Class Index 14
Enumerations
• enum VCITYPE {
EDICblue, EDICcard2, EDICpci, EDICusb,
EDICwlan, VCI_HSC, VCI_HSX, VCI_HS_LIGHT,
VCI_HS_PLUS, VCI_HS_WLAN_HD }
VCI Type
• enum PROTOCOL {
ISO_11898_RAW, ISO_14230_3_on_ISO_14230_2, ISO_14230_3_on_ISO_15765_2, ISO_15031_5_on←-
_ISO_14230_4,
ISO_15031_5_on_ISO_15765_4, ISO_15031_5_on_ISO_9141_2, ISO_15765_3_on_ISO_15765_2, ISO←-
_OBD_on_ISO_15765_4,
ISO_OBD_on_K_Line, MSP_KW1281_on_ISO_9141_2, MSP_KW1281_on_TP16, MSP_KW500_3_on_←-
KW500_2,
MSP_KW71_UART, MSP_MOST_14229_on_MOST_DAP, MSP_SFTNG_CAN, MSP_SFTNG_ISO_←-
11898_onboard,
MSP_VW2000LP_on_ISO_14230_2, MSP_VW2000LP_on_TP16, MSP_VW2000LP_on_TP20, SAE_←-
J1939_73_on_SAE_J1939_21 }
Protocol
• enum BUSTYPE {
ISO_11898_2_DWCAN, ISO_11898_3_DWFTCAN, ISO_14230_1_UART, ISO_9141_2_UART,
KW500_1_UART, MOST, SAE_J1939_11_DWCAN }
Bustype
• enum PORT {
CAN1, CAN2, KL_LINE, K_LINE,
L_LINE, MOST_PORT }
Port on the VCI.
• enum COP_TYPE { STARTCOMM, STOPCOMM, SENDRECV, UPDATEPARAM }
Type of the Cop.
• enum T_PDU_ERROR {
PDU_STATUS_NOERROR = 0x00000000, PDU_ERR_FCT_FAILED = 0x00000001, PDU_ERR_RESER←-
VED_1 = 0x00000010, PDU_ERR_COMM_PC_TO_VCI_FAILED = 0x00000011,
PDU_ERR_PDUAPI_NOT_CONSTRUCTED = 0x00000020, PDU_ERR_SHARING_VIOLATION =
0x00000021, PDU_ERR_RESOURCE_BUSY = 0x00000030, PDU_ERR_RESOURCE_TABLE_CHAN←-
GED = 0x00000031,
PDU_ERR_RESOURCE_ERROR = 0x00000032, PDU_ERR_CLL_NOT_CONNECTED = 0x00000040,
PDU_ERR_CLL_NOT_STARTED = 0x00000041, PDU_ERR_INVALID_PARAMETERS = 0x00000050,
PDU_ERR_INVALID_HANDLE = 0x00000060, PDU_ERR_VALUE_NOT_SUPPORTED = 0x00000061,
PDU_ERR_ID_NOT_SUPPORTED = 0x00000062, PDU_ERR_COMPARAM_NOT_SUPPORTED =
0x00000063,
PDU_ERR_COMPARAM_LOCKED = 0x00000064, PDU_ERR_TX_QUEUE_FULL = 0x00000070, PDU_←-
ERR_EVENT_QUEUE_EMPTY = 0x00000071, PDU_ERR_VOLTAGE_NOT_SUPPORTED = 0x00000080,
PDU_ERR_MUX_RSC_NOT_SUPPORTED = 0x00000081, PDU_ERR_CABLE_UNKNOWN = 0x00000082,
PDU_ERR_NO_CABLE_DETECTED = 0x00000083, PDU_ERR_CLL_CONNECTED = 0x00000084,
PDU_ERR_TEMPPARAM_NOT_ALLOWED = 0x00000090, PDU_ERR_RSC_LOCKED = 0x000000←-
A0, PDU_ERR_RSC_LOCKED_BY_OTHER_CLL = 0x000000A1, PDU_ERR_RSC_NOT_LOCKED =
0x000000A2,
PDU_ERR_MODULE_NOT_CONNECTED = 0x000000A3, PDU_ERR_API_SW_OUT_OF_DATE =
0x000000A4, PDU_ERR_MODULE_FW_OUT_OF_DATE = 0x000000A5, PDU_ERR_PIN_NOT_CON←-
NECTED = 0x000000A6 }
Original D-PDU API error code.
Bustype
Enumerator
Enumerator
Enumerator
CAN1 Can be used for CAN-lowspeed and CAN-highspeed if supported by VCI. If the module has seperated
CAN ports for higspeed and lowspeed like the EDICblue use CAN1 for highspeed.
CAN2 Can be used for CAN-lowspeed and CAN-highspeed if supported by VCI. If the module has seperated
CAN ports for higspeed and lowspeed like the EDICblue use CAN2 for lowspeed.
KL_LINE KL-Line port.
K_LINE K-Line port.
L_LINE L-Line port.
MOST_PORT MOST port.
Protocol
Enumerator
Enumerator
Enumerator
Original D-PDU API status code. This enum contains status codes for ComPrimitives, ComLogicalLinks and Mod-
ules
Enumerator
PDU_COPST_IDLE ComPrimitive is in the CommLogicalLink’s ComPrimitive Queue and has not been acted
upon.
VCI Type
Enumerator
EDICblue EDICblue
EDICcard2 EDICcard2
EDICpci EDICpci
EDICusb EDICusb
EDICwlan EDICwlan
VCI_HSC samtec HSC VCI
VCI_HSX Samtec HSX VCI
VCI_HS_LIGHT Samtec HSlight USB VCI
VCI_HS_PLUS Samtec HS+ USB/Ethernet VCI
VCI_HS_WLAN_HD Samtec HS+ wLAN/HD VCI
8 Class Documentation
8 Class Documentation 20
Public Member Functions
• void waitUntilFinished ()
Wait until Cop has finished successfully or with error.
• Response getResponse ()
Get a single response from this communication primitive.
• void cancel ()
Cancel communication primitive.
• T_PDU_STATUS getStatus ()
Get original Pduapi Cop status.
Examples:
example_1.cpp.
Returns
Examples:
example_1.cpp.
Examples:
example_1.cpp.
Returns
Returns
Examples:
example_1.cpp.
• void connect ()
Connect Link.
• void disconnect ()
Disconnect Link.
• bool isConnected ()
Determines if the Link is connected.
• Cop startCop (COP_TYPE copType, int sendCounter, int receiveCounter, std::vector< unsigned char >
dataBytes)
Start a Cop for sending and receiving data.
• Cop startCop (COP_TYPE copType, int sendCounter, int receiveCounter, std::string byteString)
Start a Cop for sending and receiving data.
• int getComParam (std::string name)
Get a communication parameter.
• void setComParam (std::string name, int value)
Set a communication parameter.
• void setComParam (std::string name, std::string value)
Set a communication parameter.
• int getUniqueRespIdTable (int uniqueRespIdentifier, std::string name)
Get a communication parameter from an UniqueRespIdTable.
• int getUniqueRespIdTable (std::string uniqueRespIdentifier, std::string name)
Get a communication parameter from an UniqueRespIdTable.
• void setUniqueRespIdTable (int uniqueRespIdentifier, std::string name, int value)
Set a communication parameter from an UniqueRespIdTable.
• void setUniqueRespIdTable (std::string uniqueRespIdentifier, std::string name, std::string value)
Set a communication parameter from an UniqueRespIdTable.
• void readAndSetParamsFromFile (std::string filename)
Read Comparams and UniqueResponseTable from a text file and set them.
Examples:
example_1.cpp.
Connect Link.
Connect Link after setComParam() and setUniqueRespIdTable() but before startCop().
Examples:
example_1.cpp.
Disconnect Link.
After disconnecting Link you cannot startCop() until connect() is called again.
Returns
Returns
Returns
Returns
Read Comparams and UniqueResponseTable from a text file and set them.
Parameters
filename Location of the parameter file.
Examples:
example_1.cpp.
Parameters
name Name of the communication parameter.
value New communication parameter value.
8.3.2.12 Cop startCop ( COP_TYPE copType, int sendCounter, int receiveCounter, std::vector< unsigned char >
dataBytes )
Returns
Cop object.
Examples:
example_1.cpp.
8.3.2.13 Cop startCop ( COP_TYPE copType, int sendCounter, int receiveCounter, std::string byteString )
Returns
Cop object.
• Vci connectVci ()
Open connection to the first Vci found. This is only useful if you have just one Vci.
• Vci connectVci (VCITYPE vciType)
Open connection to a Vci of the specified VCITYPE.
• Vci connectVci (std::string vciName)
Open connection to a Vci device.
• std::vector< std::string > getVciList ()
Get a list of all VCIs that are currently available.
Examples:
example_1.cpp.
Open connection to the first Vci found. This is only useful if you have just one Vci.
Returns
Examples:
example_1.cpp.
Returns
Returns
Construct a Pduapi object from the D-PDU API with the highest version number found in the Root-XML file. Prefers
Softing PK versions.
Perfer PK version.
Returns
Pduapi object.
Construct a Pduapi object from a installed D-PDU API with the specified name.
Examples: EDIC_D_PDU_API_11_22_001 for Softing D-PDU API, D_PDU_API_SAMTEC for samtec PDUAPI.
Returns
Pduapi object.
Returns
Returns
Returns
Returns
Examples:
example_1.cpp.
Returns
Byte vector.
Returns
Returns
Returns
Returns
Returns
Examples:
example_1.cpp.
Returns
Link object.
Examples:
example_1.cpp.
Returns
Link object.
8.6.2.3 void startBustrace ( BUSTYPE bustype, PORT port, std::string path, std::string filename )
8.6.2.4 void startBustrace ( std::string bustype, std::string port, std::string path, std::string filename )
9 Example Documentation
9.1 ComParam.ini
1 ;here you can set your ComParams
2 ;you can set decimal or hexadecimal values
3 ;for hexadecimal values use the prefix 0x
4 ;you can add / delete parameters depending on the protocol used
5
6 [ISO_15765_3_on_ISO_15765_2]
7 CP_P2Max=100000
8 CP_RequestAddrMode=0x2
9 CP_CanFuncReqId=0x641
10 CP_CanFuncReqFormat=0x5
11
12
13 ;here you can set your UniqueRespIdTable parameters
14 ;the first value is the page number
15 ;if no UniqueRespIdTable is defined, all responses are received
16 ;you can add / delete parameters depending on the protocol used
17 ;ComParam sections for a UniqueRespIdTable always start with "URID_"
18 ;after the protocol name you have to assign the UniqueRespId
19
20 [URID_ISO_15765_3_on_ISO_15765_2=1]
21 ;CP_CanPhysReqId=0x642
22 ;CP_CanPhysReqFormat=0x5
23 ;CP_CanRespUSDTId=0x682
24 ;CP_CanRespUSDTFormat=0x5
9.2 example_1.cpp
/***********************************************************************************************
* This is a simple example for using the EasyPDU API with C++.
***********************************************************************************************
* Softing AG Richard-Reitzner-Allee 6 D-85540 Haar, Germany
* Projekt EasyPDU http://www.softing.com
***********************************************************************************************
*
* This example file shows how to work with the EasyPDUCpp API.
* Make sure, you have added the EasyPDUCpp.dll/EasyPDUCpp.lib to your project.
* If you want to use IntelliSense for easy code completion make sure that the EasyPDUCpp.xml file is in
the same folder as the EasyPDUCpp.dll file.
*
* This sequential program will try communicate with an ECU on the CAN bus.
*
* IMPORTANT: Depending on your bus structure an ECU you must adapt the ComParam and UniqueRespIdTable
settings!
*
* The steps are:
* - load the D-PDU API
* - connect the VCI
9 Example Documentation 34
* - open a Link to the CAN bus
* - set a few ComParams
* - set the UniqueRespIdTable
* - update the ComParams and UniqueRespIdTable settings
* - send a request to the ECU and receive the answer
* - print the received data bytes
* - close all open ressources
* - wait for key to exit
*
* If something is going wrong, a detailed Exception will be thrown. It is up to you to handle it.
*/
#include <vector>
#include <string>
#include <iostream>
#include "EasyPDUCpp.h"
int main()
{
try
{
// construct D-PDU API
Pduapi pduapi = Pduapi::construct();
cout << "Pduapi constructed" << endl;
// connect Vci
Vci vci = pduapi.connectVci();
cout << "Vci connected" << endl;
// open Link
Link link = vci.openLink(ISO_15765_3_on_ISO_15765_2,
ISO_11898_2_DWCAN,CAN1);
cout << "Link opened" << endl;
/*
// way 1: set ComParams and UniqueRespId directly
link.setComParam("CP_P2Max", 100000);
link.setComParam("CP_RequestAddrMode", 0x1);
link.setComParam("CP_CanFuncReqId", 0x18DB33F1);
link.setComParam("CP_CanFuncReqFormat", 0x7);
link.setUniqueRespIdTable(1, "CP_CanPhysReqId", 0x18DA10F1);
link.setUniqueRespIdTable(1, "CP_CanPhysReqFormat", 0x7);
link.setUniqueRespIdTable(1, "CP_CanRespUSDTId", 0x18DAF110);
link.setUniqueRespIdTable(1, "CP_CanRespUSDTFormat", 0x7);
*/
// connect Link
link.connect();
cout << "Link connected" << endl;
// start Cop
Cop cop = link.startCop(SENDRECV, 1, 2, "10 92");
cout << "Cop started" << endl << endl;
// get response(s)
while (Response response = cop.getResponse())
{
if(response.isError())
{
cout << "Response error code: " << Pduapi::getEnumString(response.getErrorCode()) << endl;
cout << "Response error message: " << response.getErrorMessage() << endl << endl;
}
else
{
cout << "Response data: " << response.getDataAsHexString() << endl << endl;
}
}
}
catch(EasyPduException e)
{
cout << endl << "------------------------------------------------" << endl;
cout << e.what();
cout << endl << "------------------------------------------------" << endl;
9.2 example_1.cpp 35
}
9.3 example_1.cs
/***********************************************************************************************
* This is a simple example for using the EasyPDU API with C#.
***********************************************************************************************
* Softing AG Richard-Reitzner-Allee 6 D-85540 Haar, Germany
* Projekt EasyPDU http://www.softing.com
***********************************************************************************************
*
* This example file shows how to work with the EasyPDUdotNET API.
* Make sure, you have added the EasyPDUdotNET.dll to your project.
* If you want to use IntelliSense for easy code completion make sure that the EasyPDUdotNET.xml file is in
the same folder as the EasyPDUdotNET.dll file.
*
* This sequential program will try communicate with an ECU on the CAN bus.
*
* IMPORTANT: Depending on your bus structure an ECU you must adapt the ComParam and UniqueRespIdTable
settings!
*
* The steps are:
* - load the D-PDU API
* - connect the VCI
* - open a Link to the CAN bus
* - set a few ComParams
* - set the UniqueRespIdTable
* - update the ComParams and UniqueRespIdTable settings
* - send a request to the ECU and receive the answer
* - print the received data bytes
* - close all open ressources
* - wait for key to exit
*
* If something is going wrong, a detailed Exception will be thrown. It is up to you to handle it.
*/
using System;
using EasyPDU;
class EXAMPLE_1
{
static void Main(string[] args)
{
try
{
// Load D-PDU API
Console.WriteLine("Load D-PDU API...");
using (Pduapi pduapi = Pduapi.construct())
{
// Connect VCI
Console.WriteLine("Connect VCI...");
using (Vci vci = pduapi.connectVci())
{
// Open Link
Console.WriteLine("Open Link...");
using (Link link = vci.openLink(PROTOCOL.ISO_15765_3_on_ISO_15765_2,
BUSTYPE.ISO_11898_2_DWCAN, PORT.CAN1))
{
// Set ComParams for physical addressing
Console.WriteLine("Set ComParams for physical addressing...");
link.setComParam("CP_RequestAddrMode", 0x1); // 0x1 = physical, 0x2 = functional
// Connect Link
9.3 example_1.cs 36
Console.WriteLine("Connect Link...");
link.connect();
// Send data
Console.WriteLine("Send data...");
using (Cop cop = link.startCop(COP_TYPE.STARTCOMM, 1, -2, new byte[] { 0x10, 0x92
}))
{
// Print received data
Console.WriteLine("Print received data:");
while (true)
{
using (Response response = cop.getResponse())
{
if (response == null)
break;
if (response.isError())
Console.WriteLine(" Error: " + response.getErrorMessage());
else
Console.WriteLine(" RespId(" + response.getUniqueRespIdentifier() + "): " +
response.getDataAsHexString());
}
}
}
}
}
}
}
catch (EasyPduException e)
{
Console.WriteLine(e.Message);
}
9.4 example_1.py
1 ###############################################################################################
2 # This is a simple example for using the EasyPDU API with Python 2.7 32 bit.
3 # Important: The EasyPDU is currently not working with Python 3 or any 64 bit Python.
4 ###############################################################################################
5 # Softing AG Richard-Reitzner-Allee 6 D-85540 Haar, Germany
6 # Projekt EasyPDU http://www.softing.com
7 ###############################################################################################
8
9 from EasyPDUPython import *
10
11 print "construct PDUAPI"
12 with Pduapi.construct() as pduapi:
13 print "connect VCI"
14 with pduapi.connectVci("EDICusb") as vci:
15 print "open logical link"
16 with vci.openLink(PROTOCOL.ISO_15765_3_on_ISO_15765_2, BUSTYPE.ISO_11898_2_DWCAN, PORT.CAN1) as link:
17 print "set communication parameters"
18 link.setComParam("CP_P2Max", 10000)
19 link.setComParam("CP_RequestAddrMode", 0x2)
20 link.setComParam("CP_CanFuncReqId", 0x18DB33F1)
21 link.setComParam("CP_CanFuncReqFormat", 0x7)
22 print "set unique response id table"
23 link.setUniqueRespIdTable(1, "CP_CanPhysReqId", 0x18DA10F1)
24 link.setUniqueRespIdTable(1, "CP_CanPhysReqFormat", 0x7)
25 link.setUniqueRespIdTable(1, "CP_CanRespUSDTId", 0x18DAF110)
26 link.setUniqueRespIdTable(1, "CP_CanRespUSDTFormat", 0x7)
27 print "connect link"
28 link.connect()
29 print "start cop"
30 with link.startCop(COP_TYPE.SENDRECV, 1, -2, [0x10, 0x92]) as cop:
31 print "get cop response"
32 while True:
33 response = cop.getResponse()
34 if not response: break
35 if response.isError():
9.4 example_1.py 37
36 print response.getErrorMessage()
37 else:
38 print response.getDataAsHexString()
39 del response
40
41 raw_input("PRESS ENTER TO EXIT...")
9.5 example_2.cs
/***********************************************************************************************
* This is a simple example for using the EasyPDU API with C#.
***********************************************************************************************
* Softing AG Richard-Reitzner-Allee 6 D-85540 Haar, Germany
* Projekt EasyPDU http://www.softing.com
***********************************************************************************************
*
* This example file shows how to work with the EasyPDUdotNET API.
* Make sure, you have added the EasyPDUdotNET.dll to your project.
* If you want to use IntelliSense for easy code completion make sure that the EasyPDUdotNET.xml file is in
the same folder as the EasyPDUdotNET.dll file.
*
* This program will start two thread:
* Thread 1 will receive data from the CAN_RAW bus.
* Thread 2 will send data to the CAN_RAW bus.
*
*
* IMPORTANT 1: Depending on your bus structure an ECU you must adapt the ComParam and UniqueRespIdTable
settings!
* IMPORTANT 2: If the ECU does not response, the receive thread will wait infinite!
*
* The steps are:
* - load the D-PDU API
* - connect the VCI
* - open a Link to the CAN bus
* - set the UniqueRespIdTable
* - update UniqueRespIdTable settings
* - start Thread1
* - start ReceiveOnly ComPrimitive
* - wait until Thread2 has started sending ComPrimitive
* - received 10 responses data
* - start Thread2
* - wait until Thread1 has started ReceiveOnly ComPrimitive
* - start 2 ComPrimiteve with sendCounter=5 (2 * 5 = 10)
* - wait until Thread1 and Thread2 have finished
* - wait for key to exit
*
* If something is going wrong, a detailed Exception will be thrown. It is up to you to handle it.
*/
using System;
using System.Threading;
using EasyPDU;
class EXAMPLE_2
{
static void Main(string[] args)
{
try
{
// Load D-PDU API
Console.WriteLine("MainThread: Load D-PDU API...");
using (Pduapi pduapi = Pduapi.construct())
{
// Connect VCI
Console.WriteLine("MainThread: Connect VCI...");
using (Vci vci = pduapi.connectVci())
{
// Open Link
Console.WriteLine("MainThread: Open Link...");
using (Link link = vci.openLink(PROTOCOL.ISO_15765_3_on_ISO_15765_2,
BUSTYPE.ISO_11898_2_DWCAN, PORT.CAN1))
{
9.5 example_2.cs 38
link.readAndSetParamsFromFile("ComParam.ini");
// Connect Link
Console.WriteLine("MainThread: Connect Link...");
link.connect();
// Stop ComPrimitive
Console.WriteLine("ReceiveThread: Stop receiving ComPrimitive...");
}
}
9.5 example_2.cs 39
Index
CAN1 MSP_VW2000LP_on_ISO_14230_2, 18
EasyPDU, 17 MSP_VW2000LP_on_TP16, 18
CAN2 MSP_VW2000LP_on_TP20, 18
EasyPDU, 17 PDU_CLLST_COMM_STARTED, 20
Cop, 20 PDU_CLLST_OFFLINE, 20
PDU_CLLST_ONLINE, 20
EDICblue PDU_COPST_CANCELLED, 20
EasyPDU, 20 PDU_COPST_EXECUTING, 19
EDICcard2 PDU_COPST_FINISHED, 20
EasyPDU, 20 PDU_COPST_IDLE, 19
EDICpci PDU_COPST_WAITING, 20
EasyPDU, 20 PDU_ERR_API_SW_OUT_OF_DATE, 19
EDICusb PDU_ERR_CABLE_UNKNOWN, 19
EasyPDU, 20 PDU_ERR_CLL_CONNECTED, 19
EDICwlan PDU_ERR_CLL_NOT_CONNECTED, 19
EasyPDU, 20 PDU_ERR_CLL_NOT_STARTED, 19
EasyPDU PDU_ERR_COMM_PC_TO_VCI_FAILED, 18
CAN1, 17 PDU_ERR_COMPARAM_LOCKED, 19
CAN2, 17 PDU_ERR_COMPARAM_NOT_SUPPORTED, 19
EDICblue, 20 PDU_ERR_EVENT_QUEUE_EMPTY, 19
EDICcard2, 20 PDU_ERR_EVT_FRAME_STRUCT, 18
EDICpci, 20 PDU_ERR_EVT_INIT_ERROR, 18
EDICusb, 20 PDU_ERR_EVT_LOST_COMM_TO_VCI, 18
EDICwlan, 20 PDU_ERR_EVT_NOERROR, 18
ISO_11898_2_DWCAN, 16 PDU_ERR_EVT_PROT_ERR, 18
ISO_11898_3_DWFTCAN, 16 PDU_ERR_EVT_RSC_LOCKED, 18
ISO_11898_RAW, 17 PDU_ERR_EVT_RX_ERROR, 18
ISO_14230_1_UART, 16 PDU_ERR_EVT_RX_TIMEOUT, 18
ISO_14230_3_on_ISO_14230_2, 17 PDU_ERR_EVT_TESTER_PRESENT_ERROR,
ISO_14230_3_on_ISO_15765_2, 17 18
ISO_15031_5_on_ISO_14230_4, 17 PDU_ERR_EVT_TX_ERROR, 18
ISO_15031_5_on_ISO_15765_4, 17 PDU_ERR_EVT_VCI_HARDWARE_FAULT, 18
ISO_15031_5_on_ISO_9141_2, 17 PDU_ERR_FCT_FAILED, 18
ISO_15765_3_on_ISO_15765_2, 17 PDU_ERR_ID_NOT_SUPPORTED, 19
ISO_9141_2_UART, 16 PDU_ERR_INVALID_HANDLE, 19
ISO_OBD_on_ISO_15765_4, 17 PDU_ERR_INVALID_PARAMETERS, 19
ISO_OBD_on_K_Line, 17 PDU_ERR_MODULE_FW_OUT_OF_DATE, 19
K_LINE, 17 PDU_ERR_MODULE_NOT_CONNECTED, 19
KL_LINE, 17 PDU_ERR_MUX_RSC_NOT_SUPPORTED, 19
KW500_1_UART, 16 PDU_ERR_NO_CABLE_DETECTED, 19
L_LINE, 17 PDU_ERR_PDUAPI_NOT_CONSTRUCTED, 18
MOST, 16 PDU_ERR_PIN_NOT_CONNECTED, 19
MOST_PORT, 17 PDU_ERR_RESERVED_1, 18
MSP_KW1281_on_ISO_9141_2, 17 PDU_ERR_RESOURCE_BUSY, 18
MSP_KW1281_on_TP16, 17 PDU_ERR_RESOURCE_ERROR, 19
MSP_KW500_3_on_KW500_2, 17 PDU_ERR_RESOURCE_TABLE_CHANGED, 18
MSP_KW71_UART, 17 PDU_ERR_RSC_LOCKED, 19
MSP_MOST_14229_on_MOST_DAP, 17 PDU_ERR_RSC_LOCKED_BY_OTHER_CLL, 19
MSP_SFTNG_CAN, 17 PDU_ERR_RSC_NOT_LOCKED, 19
MSP_SFTNG_ISO_11898_onboard, 17 PDU_ERR_SHARING_VIOLATION, 18
PDU_ERR_TEMPPARAM_NOT_ALLOWED, 19 EasyPDU, 16
PDU_ERR_TX_QUEUE_FULL, 19
PDU_ERR_VALUE_NOT_SUPPORTED, 19 L_LINE
PDU_ERR_VOLTAGE_NOT_SUPPORTED, 19 EasyPDU, 17
PDU_MODST_AVAIL, 20 Link, 23
PDU_MODST_NOT_AVAIL, 20
PDU_MODST_NOT_READY, 20 MOST
PDU_MODST_READY, 20 EasyPDU, 16
PDU_STATUS_NOERROR, 18 MOST_PORT
SAE_J1939_11_DWCAN, 16 EasyPDU, 17
SAE_J1939_73_on_SAE_J1939_21, 18 MSP_KW1281_on_ISO_9141_2
SENDRECV, 17 EasyPDU, 17
STARTCOMM, 17 MSP_KW1281_on_TP16
STOPCOMM, 17 EasyPDU, 17
UPDATEPARAM, 17 MSP_KW500_3_on_KW500_2
VCI_HS_LIGHT, 20 EasyPDU, 17
VCI_HS_PLUS, 20 MSP_KW71_UART
VCI_HS_WLAN_HD, 20 EasyPDU, 17
VCI_HSC, 20 MSP_MOST_14229_on_MOST_DAP
VCI_HSX, 20 EasyPDU, 17
MSP_SFTNG_CAN
ISO_11898_2_DWCAN EasyPDU, 17
EasyPDU, 16 MSP_SFTNG_ISO_11898_onboard
ISO_11898_3_DWFTCAN EasyPDU, 17
EasyPDU, 16 MSP_VW2000LP_on_ISO_14230_2
ISO_11898_RAW EasyPDU, 18
EasyPDU, 17 MSP_VW2000LP_on_TP16
ISO_14230_1_UART EasyPDU, 18
EasyPDU, 16 MSP_VW2000LP_on_TP20
ISO_14230_3_on_ISO_14230_2 EasyPDU, 18
EasyPDU, 17
ISO_14230_3_on_ISO_15765_2 PDU_CLLST_COMM_STARTED
EasyPDU, 17 EasyPDU, 20
ISO_15031_5_on_ISO_14230_4 PDU_CLLST_OFFLINE
EasyPDU, 17 EasyPDU, 20
ISO_15031_5_on_ISO_15765_4 PDU_CLLST_ONLINE
EasyPDU, 17 EasyPDU, 20
ISO_15031_5_on_ISO_9141_2 PDU_COPST_CANCELLED
EasyPDU, 17 EasyPDU, 20
ISO_15765_3_on_ISO_15765_2 PDU_COPST_EXECUTING
EasyPDU, 17 EasyPDU, 19
ISO_9141_2_UART PDU_COPST_FINISHED
EasyPDU, 16 EasyPDU, 20
ISO_OBD_on_ISO_15765_4 PDU_COPST_IDLE
EasyPDU, 17 EasyPDU, 19
ISO_OBD_on_K_Line PDU_COPST_WAITING
EasyPDU, 17 EasyPDU, 20
PDU_ERR_API_SW_OUT_OF_DATE
K_LINE EasyPDU, 19
EasyPDU, 17 PDU_ERR_CABLE_UNKNOWN
KL_LINE EasyPDU, 19
EasyPDU, 17 PDU_ERR_CLL_CONNECTED
KW500_1_UART EasyPDU, 19
INDEX 41
PDU_ERR_CLL_NOT_CONNECTED EasyPDU, 19
EasyPDU, 19 PDU_ERR_RESERVED_1
PDU_ERR_CLL_NOT_STARTED EasyPDU, 18
EasyPDU, 19 PDU_ERR_RESOURCE_BUSY
PDU_ERR_COMM_PC_TO_VCI_FAILED EasyPDU, 18
EasyPDU, 18 PDU_ERR_RESOURCE_ERROR
PDU_ERR_COMPARAM_LOCKED EasyPDU, 19
EasyPDU, 19 PDU_ERR_RESOURCE_TABLE_CHANGED
PDU_ERR_COMPARAM_NOT_SUPPORTED EasyPDU, 18
EasyPDU, 19 PDU_ERR_RSC_LOCKED
PDU_ERR_EVENT_QUEUE_EMPTY EasyPDU, 19
EasyPDU, 19 PDU_ERR_RSC_LOCKED_BY_OTHER_CLL
PDU_ERR_EVT_FRAME_STRUCT EasyPDU, 19
EasyPDU, 18 PDU_ERR_RSC_NOT_LOCKED
PDU_ERR_EVT_INIT_ERROR EasyPDU, 19
EasyPDU, 18 PDU_ERR_SHARING_VIOLATION
PDU_ERR_EVT_LOST_COMM_TO_VCI EasyPDU, 18
EasyPDU, 18 PDU_ERR_TEMPPARAM_NOT_ALLOWED
PDU_ERR_EVT_NOERROR EasyPDU, 19
EasyPDU, 18 PDU_ERR_TX_QUEUE_FULL
PDU_ERR_EVT_PROT_ERR EasyPDU, 19
EasyPDU, 18 PDU_ERR_VALUE_NOT_SUPPORTED
PDU_ERR_EVT_RSC_LOCKED EasyPDU, 19
EasyPDU, 18 PDU_ERR_VOLTAGE_NOT_SUPPORTED
PDU_ERR_EVT_RX_ERROR EasyPDU, 19
EasyPDU, 18 PDU_MODST_AVAIL
PDU_ERR_EVT_RX_TIMEOUT EasyPDU, 20
EasyPDU, 18 PDU_MODST_NOT_AVAIL
PDU_ERR_EVT_TESTER_PRESENT_ERROR EasyPDU, 20
EasyPDU, 18 PDU_MODST_NOT_READY
PDU_ERR_EVT_TX_ERROR EasyPDU, 20
EasyPDU, 18 PDU_MODST_READY
PDU_ERR_EVT_VCI_HARDWARE_FAULT EasyPDU, 20
EasyPDU, 18 PDU_STATUS_NOERROR
PDU_ERR_FCT_FAILED EasyPDU, 18
EasyPDU, 18 Pduapi, 27
PDU_ERR_ID_NOT_SUPPORTED
EasyPDU, 19 Response, 30
PDU_ERR_INVALID_HANDLE
SAE_J1939_11_DWCAN
EasyPDU, 19
EasyPDU, 16
PDU_ERR_INVALID_PARAMETERS
SAE_J1939_73_on_SAE_J1939_21
EasyPDU, 19
EasyPDU, 18
PDU_ERR_MODULE_FW_OUT_OF_DATE
SENDRECV
EasyPDU, 19
EasyPDU, 17
PDU_ERR_MODULE_NOT_CONNECTED
STARTCOMM
EasyPDU, 19
EasyPDU, 17
PDU_ERR_MUX_RSC_NOT_SUPPORTED
STOPCOMM
EasyPDU, 19
EasyPDU, 17
PDU_ERR_NO_CABLE_DETECTED
EasyPDU, 19 UPDATEPARAM
PDU_ERR_PDUAPI_NOT_CONSTRUCTED EasyPDU, 17
EasyPDU, 18
PDU_ERR_PIN_NOT_CONNECTED VCI_HS_LIGHT
INDEX 42
EasyPDU, 20
VCI_HS_PLUS
EasyPDU, 20
VCI_HS_WLAN_HD
EasyPDU, 20
VCI_HSC
EasyPDU, 20
VCI_HSX
EasyPDU, 20
Vci, 32
INDEX 43