|
iso14229 0.11.0
ISO14229-1 (UDS) C Library
|
ISO 14229 (UDS) library. More...
#include "iso14229.h"#include <assert.h>#include <inttypes.h>#include <sys/time.h>#include <time.h>#include <stdlib.h>#include <Arduino.h>#include <esp_timer.h>#include <zephyr/kernel.h>#include <errno.h>#include <linux/can.h>#include <linux/can/raw.h>#include <net/if.h>#include <stdarg.h>#include <stdbool.h>#include <stdint.h>#include <sys/ioctl.h>#include <unistd.h>#include <linux/can/isotp.h>#include <poll.h>#include <string.h>#include <sys/socket.h>
Go to the source code of this file.
Macros | |
| #define | STATE_IDLE 0U |
| #define | STATE_SENDING 1U |
| #define | STATE_AWAIT_SEND_COMPLETE 2U |
| #define | STATE_AWAIT_RESPONSE 3U |
Typedefs | |
| typedef UDSErr_t(*) | UDSService(UDSServer_t *srv, UDSReq_t *r) |
| signature of internal service handlers | |
Functions | |
| UDSErr_t | UDSClientInit (UDSClient_t *client) |
| Call this once. | |
| UDSErr_t | UDSSendBytes (UDSClient_t *client, const uint8_t *data, uint16_t size) |
| Send user-defined bytes to a UDS server. | |
| UDSErr_t | UDSSendECUReset (UDSClient_t *client, uint8_t type) |
| Request ECUReset. | |
| UDSErr_t | UDSSendDiagSessCtrl (UDSClient_t *client, uint8_t mode) |
| Change the diagnostic session. | |
| UDSErr_t | UDSSendCommCtrl (UDSClient_t *client, uint8_t ctrl, uint8_t comm) |
| Change communication settings. | |
| UDSErr_t | UDSSendTesterPresent (UDSClient_t *client) |
| What's up? | |
| UDSErr_t | UDSSendRDBI (UDSClient_t *client, const uint16_t *didList, const uint16_t numDataIdentifiers) |
| Read Data By Identifier. | |
| UDSErr_t | UDSSendWDBI (UDSClient_t *client, uint16_t dataIdentifier, const uint8_t *data, uint16_t size) |
| Write Data By Identifier. | |
| UDSErr_t | UDSSendRoutineCtrl (UDSClient_t *client, uint8_t type, uint16_t routineIdentifier, const uint8_t *data, uint16_t size) |
| Request to Twiddle Routines. | |
| UDSErr_t | UDSSendRequestDownload (UDSClient_t *client, uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, size_t memoryAddress, size_t memorySize) |
| Request to Download via TransferData. | |
| UDSErr_t | UDSSendRequestUpload (UDSClient_t *client, uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, size_t memoryAddress, size_t memorySize) |
| Request to Upload via TransferData. | |
| UDSErr_t | UDSSendTransferData (UDSClient_t *client, uint8_t blockSequenceCounter, const uint16_t blockLength, const uint8_t *data, uint16_t size) |
| Transfer Data to/from a buffer. | |
| UDSErr_t | UDSSendRequestTransferExit (UDSClient_t *client) |
| Call this when finished with TransferData. | |
| UDSErr_t | UDSSendRequestFileTransfer (UDSClient_t *client, const uint8_t mode, const char *filePath, const size_t filePathLen, const size_t fileSizeUncompressed, const size_t fileSizeCompressed) |
| filesystem-based frontend to TransferData | |
| UDSErr_t | UDSCtrlDTCSetting (UDSClient_t *client, uint8_t dtcSettingType, const uint8_t *dtcSettingControlOptionRecord, uint16_t len) |
| control DTC setting | |
| UDSErr_t | UDSSendSecurityAccess (UDSClient_t *client, uint8_t level, const uint8_t *data, uint16_t size) |
| Get Security Access. | |
| UDSErr_t | UDSUnpackSecurityAccessResponse (const UDSClient_t *client, struct SecurityAccessResponse *resp) |
| Parse server's response to SecurityAccess. | |
| UDSErr_t | UDSUnpackRoutineControlResponse (const UDSClient_t *client, struct RoutineControlResponse *resp) |
| Parse server's response to RoutineControl. | |
| UDSErr_t | UDSUnpackRequestDownloadResponse (const UDSClient_t *client, struct RequestDownloadResponse *resp) |
| Parse server's response to RequestDownload. | |
| UDSErr_t | UDSClientPoll (UDSClient_t *client) |
| Call at <5ms intervals. | |
| UDSErr_t | UDSUnpackRDBIResponse (UDSClient_t *client, UDSRDBIVar_t *vars, uint16_t numVars) |
| Parse server's response to RDBI. | |
| UDSErr_t | UDSServerInit (UDSServer_t *srv) |
| call this once | |
| void | UDSServerPoll (UDSServer_t *srv) |
| Call this at <5ms intervals. | |
| UDSErr_t | UDSTpSend (UDSTp_t *hdl, const uint8_t *buf, const size_t len, const UDSSDU_t *info) |
| Send to transport. | |
| UDSErr_t | UDSTpRecv (UDSTp_t *hdl, uint8_t *buf, const size_t bufsiz, size_t *recvlen, UDSSDU_t *info) |
| Receive from transport. | |
| UDSErr_t | UDSTpPoll (UDSTp_t *hdl) |
| call this at <5ms intervals | |
| UDSErr_t | UDSTpISOTpCPoll (UDSTp_t *hdl) |
| UDSErr_t | UDSTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t sa, uint32_t ta, uint32_t sa_func, uint32_t ta_func) |
| UDSErr_t | UDSServerTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func) |
| Initialize isotp-c transport for UDSServer_t. | |
| UDSErr_t | UDSClientTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func) |
| Initialize isotp-c transport for UDSClient_t. | |
| UDSErr_t | UDSServerTpISOTpCSocketCANInit (UDSTpISOTpCSocketCAN_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func) |
| Initialize isotp-c over SocketCAN transport for UDSServer_t. | |
| UDSErr_t | UDSClientTpISOTpCSocketCANInit (UDSTpISOTpCSocketCAN_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func) |
| Initialize isotp-c over SocketCAN transport for UDSClient_t. | |
| void | UDSTpISOTpCSocketCANDeinit (UDSTpISOTpCSocketCAN_t *tp) |
| release socket | |
| UDSErr_t | UDSServerTpIsoTpSockInit (UDSTpIsoTpSock_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func) |
| for UDSServer_t | |
| UDSErr_t | UDSClientTpIsoTpSockInit (UDSTpIsoTpSock_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func) |
| for UDSClient_t | |
| void | UDSTpIsoTpSockDeinit (const UDSTpIsoTpSock_t *tp) |
| release sockets | |
SPDX-License-Identifier: MIT
Definition in file iso14229.c.
| typedef UDSErr_t(*) UDSService(UDSServer_t *srv, UDSReq_t *r) |
Definition at line 2582 of file iso14229.c.
| UDSErr_t UDSClientInit | ( | UDSClient_t * | client | ) |
Definition at line 366 of file iso14229.c.
| UDSErr_t UDSClientPoll | ( | UDSClient_t * | client | ) |
Definition at line 1173 of file iso14229.c.
| UDSErr_t UDSClientTpISOTpCInit | ( | UDSTpISOTpC_t * | tp, |
| uint32_t | source_addr, | ||
| uint32_t | target_addr, | ||
| uint32_t | target_addr_func ) |
| tp | UDSTpISOTpC_t instance. |
| source_addr | Client listens for responses at this address. |
| target_addr | Client sends physical requests to this address. |
| target_addr_func | Client sends functional transmissions to this address. |
Definition at line 3323 of file iso14229.c.
| UDSErr_t UDSClientTpISOTpCSocketCANInit | ( | UDSTpISOTpCSocketCAN_t * | tp, |
| const char * | ifname, | ||
| uint32_t | source_addr, | ||
| uint32_t | target_addr, | ||
| uint32_t | target_addr_func ) |
| tp | UDSTpISOTpC_t instance. |
| source_addr | Client listens for responses at this address. |
| target_addr | Client sends physical requests to this address. |
| target_addr_func | Client sends functional transmissions to this address. |
Definition at line 3476 of file iso14229.c.
| UDSErr_t UDSClientTpIsoTpSockInit | ( | UDSTpIsoTpSock_t * | tp, |
| const char * | ifname, | ||
| uint32_t | source_addr, | ||
| uint32_t | target_addr, | ||
| uint32_t | target_addr_func ) |
Definition at line 3744 of file iso14229.c.
| UDSErr_t UDSCtrlDTCSetting | ( | UDSClient_t * | client, |
| uint8_t | dtcSettingType, | ||
| const uint8_t * | dtcSettingControlOptionRecord, | ||
| uint16_t | len ) |
Definition at line 1022 of file iso14229.c.
| UDSErr_t UDSSendBytes | ( | UDSClient_t * | client, |
| const uint8_t * | data, | ||
| uint16_t | size ) |
Definition at line 654 of file iso14229.c.
| UDSErr_t UDSSendCommCtrl | ( | UDSClient_t * | client, |
| uint8_t | ctrl, | ||
| uint8_t | comm ) |
Definition at line 689 of file iso14229.c.
| UDSErr_t UDSSendDiagSessCtrl | ( | UDSClient_t * | client, |
| uint8_t | mode ) |
Definition at line 678 of file iso14229.c.
| UDSErr_t UDSSendECUReset | ( | UDSClient_t * | client, |
| uint8_t | type ) |
Definition at line 667 of file iso14229.c.
| UDSErr_t UDSSendRDBI | ( | UDSClient_t * | client, |
| const uint16_t * | didList, | ||
| const uint16_t | numDataIdentifiers ) |
Definition at line 712 of file iso14229.c.
| UDSErr_t UDSSendRequestDownload | ( | UDSClient_t * | client, |
| uint8_t | dataFormatIdentifier, | ||
| uint8_t | addressAndLengthFormatIdentifier, | ||
| size_t | memoryAddress, | ||
| size_t | memorySize ) |
Definition at line 804 of file iso14229.c.
| UDSErr_t UDSSendRequestFileTransfer | ( | UDSClient_t * | client, |
| const uint8_t | mode, | ||
| const char * | filePath, | ||
| const size_t | filePathLen, | ||
| const size_t | fileSizeUncompressed, | ||
| const size_t | fileSizeCompressed ) |
Definition at line 917 of file iso14229.c.
| UDSErr_t UDSSendRequestTransferExit | ( | UDSClient_t * | client | ) |
Definition at line 907 of file iso14229.c.
| UDSErr_t UDSSendRequestUpload | ( | UDSClient_t * | client, |
| uint8_t | dataFormatIdentifier, | ||
| uint8_t | addressAndLengthFormatIdentifier, | ||
| size_t | memoryAddress, | ||
| size_t | memorySize ) |
Definition at line 841 of file iso14229.c.
| UDSErr_t UDSSendRoutineCtrl | ( | UDSClient_t * | client, |
| uint8_t | type, | ||
| uint16_t | routineIdentifier, | ||
| const uint8_t * | data, | ||
| uint16_t | size ) |
Definition at line 768 of file iso14229.c.
| UDSErr_t UDSSendSecurityAccess | ( | UDSClient_t * | client, |
| uint8_t | level, | ||
| const uint8_t * | data, | ||
| uint16_t | size ) |
Definition at line 1062 of file iso14229.c.
| UDSErr_t UDSSendTesterPresent | ( | UDSClient_t * | client | ) |
Definition at line 701 of file iso14229.c.
| UDSErr_t UDSSendTransferData | ( | UDSClient_t * | client, |
| uint8_t | blockSequenceCounter, | ||
| const uint16_t | blockLength, | ||
| const uint8_t * | data, | ||
| uint16_t | size ) |
Definition at line 876 of file iso14229.c.
| UDSErr_t UDSSendWDBI | ( | UDSClient_t * | client, |
| uint16_t | dataIdentifier, | ||
| const uint8_t * | data, | ||
| uint16_t | size ) |
Definition at line 736 of file iso14229.c.
| UDSErr_t UDSServerInit | ( | UDSServer_t * | srv | ) |
Definition at line 2773 of file iso14229.c.
| void UDSServerPoll | ( | UDSServer_t * | srv | ) |
Definition at line 2790 of file iso14229.c.
| UDSErr_t UDSServerTpISOTpCInit | ( | UDSTpISOTpC_t * | tp, |
| uint32_t | source_addr, | ||
| uint32_t | target_addr, | ||
| uint32_t | source_addr_func ) |
| tp | UDSTpISOTpC_t instance. |
| source_addr | Server listens for physical transmissions on this address. |
| target_addr | Server sends responses to this address. |
| source_addr_func | Server listens for functional transmissions on this address. |
Definition at line 3318 of file iso14229.c.
| UDSErr_t UDSServerTpISOTpCSocketCANInit | ( | UDSTpISOTpCSocketCAN_t * | tp, |
| const char * | ifname, | ||
| uint32_t | source_addr, | ||
| uint32_t | target_addr, | ||
| uint32_t | source_addr_func ) |
| tp | UDSTpISOTpSocketCAN_t instance. |
| source_addr | Server listens for physical transmissions on this address. |
| target_addr | Server sends responses to this address. |
| source_addr_func | Server listens for functional transmissions on this address. |
Definition at line 3469 of file iso14229.c.
| UDSErr_t UDSServerTpIsoTpSockInit | ( | UDSTpIsoTpSock_t * | tp, |
| const char * | ifname, | ||
| uint32_t | source_addr, | ||
| uint32_t | target_addr, | ||
| uint32_t | source_addr_func ) |
Definition at line 3717 of file iso14229.c.
| UDSErr_t UDSTpISOTpCInit | ( | UDSTpISOTpC_t * | tp, |
| uint32_t | sa, | ||
| uint32_t | ta, | ||
| uint32_t | sa_func, | ||
| uint32_t | ta_func ) |
Definition at line 3298 of file iso14229.c.
Definition at line 3182 of file iso14229.c.
| void UDSTpISOTpCSocketCANDeinit | ( | UDSTpISOTpCSocketCAN_t * | tp | ) |
Definition at line 3483 of file iso14229.c.
| void UDSTpIsoTpSockDeinit | ( | const UDSTpIsoTpSock_t * | tp | ) |
Definition at line 3770 of file iso14229.c.
Definition at line 2899 of file iso14229.c.
| UDSErr_t UDSTpRecv | ( | UDSTp_t * | hdl, |
| uint8_t * | buf, | ||
| const size_t | bufsiz, | ||
| size_t * | recvlen, | ||
| UDSSDU_t * | info ) |
Definition at line 2891 of file iso14229.c.
Definition at line 2884 of file iso14229.c.
| UDSErr_t UDSUnpackRDBIResponse | ( | UDSClient_t * | client, |
| UDSRDBIVar_t * | vars, | ||
| uint16_t | numVars ) |
Definition at line 1191 of file iso14229.c.
| UDSErr_t UDSUnpackRequestDownloadResponse | ( | const UDSClient_t * | client, |
| struct RequestDownloadResponse * | resp ) |
Definition at line 1151 of file iso14229.c.
| UDSErr_t UDSUnpackRoutineControlResponse | ( | const UDSClient_t * | client, |
| struct RoutineControlResponse * | resp ) |
Definition at line 1124 of file iso14229.c.
| UDSErr_t UDSUnpackSecurityAccessResponse | ( | const UDSClient_t * | client, |
| struct SecurityAccessResponse * | resp ) |
Definition at line 1099 of file iso14229.c.