16static bool done =
false;
17static int sleep_ms(uint32_t tms);
19void sigint_handler(
int signum) {
20 printf(
"SIGINT received\n");
27 printf(
"Unhandled event: %d\n", ev);
28 return UDS_NRC_ServiceNotSupported;
32int main(
int ac,
char **av) {
34 memset(&sa, 0,
sizeof(sa));
35 sa.sa_handler = sigint_handler;
36 sigaction(SIGINT, &sa, NULL);
39 if (UDSTpIsoTpSockInitServer(&tp,
"vcan0", 0x7E0, 0x7E8, 0x7DF)) {
40 fprintf(stderr,
"UDSTpIsoTpSockInitServer failed\n");
44 if (UDSServerInit(&srv)) {
45 fprintf(stderr,
"UDSServerInit failed\n");
51 printf(
"server up, polling . . .\n");
56 printf(
"server exiting\n");
60static int sleep_ms(uint32_t tms) {
63 ts.tv_sec = tms / 1000;
64 ts.tv_nsec = (tms % 1000) * 1000000;
66 ret = nanosleep(&ts, &ts);
67 }
while (ret && errno == EINTR);
ISO14229-1 (UDS) library.
UDSErr_t(* fn)(struct UDSServer *srv, UDSEvent_t event, void *arg)