31 UDS_LOGI(__FILE__,
"%s (%d)", UDSEventToStr(evt), evt);
34 UDS_LOGE(__FILE__,
"Exiting on step %d with error: %s", c->step,
35 UDSErrToStr(*(UDSErr_t *)ev_data));
36 c->err = *(UDSErr_t *)ev_data;
40 case Step_0_RDBI_Send: {
41 const uint16_t dids[] = {0xf190};
42 c->err = UDSSendRDBI(client, dids, 1);
44 UDS_LOGE(__FILE__,
"UDSSendRDBI failed with err: %d", c->err);
47 c->step = Step_1_RDBI_Recv;
50 case Step_1_RDBI_Recv: {
52 {0xf190, 2, &(c->rdbi_f190), memmove},
55 c->err = UDSUnpackRDBIResponse(client, vars, 1);
57 UDS_LOGE(__FILE__,
"UDSUnpackRDBIResponse failed with err: %s",
61 UDS_LOGI(__FILE__,
"0xf190 has value %d", c->rdbi_f190);
62 c->step = Step_2_WDBI_Send;
66 case Step_2_WDBI_Send: {
67 uint16_t val = c->rdbi_f190 + 1;
72 c->err = UDSSendWDBI(client, 0xf190, data,
sizeof(data));
74 UDS_LOGE(__FILE__,
"UDSSendWDBI failed with err: %s", UDSErrToStr(c->err));
77 c->step = Step_3_WDBI_Recv;
80 case Step_3_WDBI_Recv: {
82 UDS_LOGI(__FILE__,
"WDBI response received");
92int main(
int ac,
char **av) {
96 if (UDSTpIsoTpSockInitClient(&tp,
"vcan0", 0x7E8, 0x7E0, 0x7DF)) {
97 UDS_LOGE(__FILE__,
"UDSTpIsoTpSockInitClient failed");
101 if (UDSClientInit(&client)) {
111 UDS_LOGI(__FILE__,
"polling");
112 while (ctx.step != Step_DONE) {
113 UDSClientPoll(&client);
ISO14229-1 (UDS) library.
@ UDS_EVT_ResponseReceived
int(* fn)(struct UDSClient *client, UDSEvent_t evt, void *ev_data)
Read data by identifier variable structure.