File linux_socket.c

FileList > examples > linux_socket > linux_socket.c

Go to the source code of this file

  • #include <stdio.h>
  • #include <stdlib.h>
  • #include <stdbool.h>
  • #include <string.h>
  • #include <unistd.h>
  • #include <time.h>
  • #include <stdarg.h>
  • #include <net/if.h>
  • #include <sys/ioctl.h>
  • #include <sys/socket.h>
  • #include <linux/can.h>
  • #include <linux/can/raw.h>
  • #include <isotp.h>

Public Static Attributes

Type Name
int _socket
SocketCAN file descriptor.
uint8_t g_isotpRecvBuf
uint8_t g_isotpSendBuf
IsoTpLink g_link
ISO-TP link instance, allocated statically in RAM.

Public Functions

Type Name
int main (int argc, char ** argv)

Macros

Type Name
define SEC_TO_US (sec) ((sec) \* 1000000)
Macro to convert seconds to microseconds.
define _CAN_INTERFACE "slcan0"
CAN interface to use (e.g., "can0", "slcan0", etc.)
define _ISOTP_BUFSIZE (128)
Buffer size for ISO-TP messages (must be >= 4095 for full ISO-TP support)/*#end#* /.
define _ISOTP_CAN_ID (0x0C1)
CAN ID to use for sending ISO-TP messages (must match the receiver's expected ID)/*#end#* /.

Public Static Attributes Documentation

variable _socket

SocketCAN file descriptor.

int _socket;


variable g_isotpRecvBuf

uint8_t g_isotpRecvBuf[_ISOTP_BUFSIZE];

Buffer for receiving ISO-TP messages, allocated statically in RAM


variable g_isotpSendBuf

uint8_t g_isotpSendBuf[_ISOTP_BUFSIZE];

Buffer for sending ISO-TP messages, allocated statically in RAM


ISO-TP link instance, allocated statically in RAM.

IsoTpLink g_link;


Public Functions Documentation

function main

int main (
    int argc,
    char ** argv
) 

Macro Definition Documentation

define SEC_TO_US

Macro to convert seconds to microseconds.

#define SEC_TO_US (
    sec
) `((sec) * 1000000)`


define _CAN_INTERFACE

CAN interface to use (e.g., "can0", "slcan0", etc.)

#define _CAN_INTERFACE `"slcan0"`


define _ISOTP_BUFSIZE

Buffer size for ISO-TP messages (must be >= 4095 for full ISO-TP support)/*#end#* /.

#define _ISOTP_BUFSIZE `(128)`


define _ISOTP_CAN_ID

CAN ID to use for sending ISO-TP messages (must match the receiver's expected ID)/*#end#* /.

#define _ISOTP_CAN_ID `(0x0C1)`



The documentation for this class was generated from the following file examples/linux_socket/linux_socket.c