Network Access

group Network_access

Functions

CALLBACK_HANDLE StartListenToChannel(API_HANDLE, const char *channel, OnDataFrameCallback callback)

start a listener on a given channel, the callback function will be invoked whenever a frame is sent over the channel

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function to be invoked

Returns:

CALLBACK_HANDLE, it must be used as input for StopListenToChannel

BOOL StopListenToChannel(API_HANDLE, const char *channel, CALLBACK_HANDLE callback)

stop listening on a channel

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : CALLBACK_HANDLE got from StartListenToChannel

Returns:

BOOL

CALLBACK_HANDLE StartListenToSerial(API_HANDLE, const char *channel, OnSerialEventCallback callback)

start listening on a given serial channel

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function to be invoked

Returns:

CALLBACK_HANDLE

BOOL StopListenToSerial(API_HANDLE, const char *channel, CALLBACK_HANDLE callback)

stop listening on a given serial channel

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function used in the PublisherSubscribeToSerial

Returns:

BOOL

CALLBACK_HANDLE StartListenToIo(API_HANDLE, const char *channel, OnIOEventStateCallback callback)

start listening on a given I/O channel

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function to be invoked

Returns:

CALLBACK_HANDLE

BOOL StopListenToIo(API_HANDLE, const char *channel, CALLBACK_HANDLE callback)

stop listening on a given I/O channel

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function used in the PublisherSubscribeToIo

Returns:

BOOL

CALLBACK_HANDLE StartListenToFrame(API_HANDLE, const char *channel, OnDataFrameCallback callback, uint64_t frame_id, FramesGroup frames_direction, PublishingMode mode)

start listening on a given frame

!

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function to be invoked

  • frame_id – : message id

  • frames_direction – : listen for a received/send frames or both (FRAMES_GROUP_RX, FRAMES_GROUP_TXx,FRAMES_GROUP_ANY)

  • mode – : specify if we need to get a notification for every received frame or just if the payload has changed

Returns:

CALLBACK_HANDLE, it must be used as input for StopListenToFrame

BOOL StopListenToFrame(API_HANDLE, const char *channel, CALLBACK_HANDLE callback, uint64_t frame_id)

stop listening on a given frame

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : CALLBACK_HANDLE got from StartListenToFrame

  • frame_id – : message id

Returns:

BOOL

CALLBACK_HANDLE StartListenToBusStatus(API_HANDLE, const char *channel, OnBusStateCallback callback)

start listening on bus state, depending on the bus type we can track the communication state of the bus. exp: for lin

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : function to be invoked, function prototype contains the events received

Returns:

CALLBACK_HANDLE, it must be used as input for StopListenToBusStatus

BOOL StopListenToBusStatus(API_HANDLE, const char *channel, CALLBACK_HANDLE callback)

stop listen on bus state

Parameters:
  • channel – : channel name like defined in the config file (*.yaml)

  • callback – : CALLBACK_HANDLE got from StartListenToBusStatus

Returns:

BOOL

BOOL TransmitCanFrame(API_HANDLE, const char *channel_id, uint64_t frame_id, const uint8_t *payload, size_t payload_size, BOOL fd)

send raw can frame on a given channel

Parameters:
  • channel_id – : channel name like defined in the config file (*.yaml)

  • frame_id – : message id

  • payload – : message payload as bytes

  • payload_size – : payload length

  • fd – : if true send as can-fd message, else use normal can

Returns:

BOOL

BOOL TransmitCanFrameFlags(API_HANDLE api, const char *channel_id, uint64_t frame_id, const uint8_t *payload, size_t payload_size, BOOL fd, uint32_t flags)

send raw can frame on a given channel

Parameters:
  • channel_id – : channel name like defined in the config file (*.yaml)

  • frame_id – : message id

  • payload – : message payload as bytes

  • payload_size – : payload length

  • fd – : if true send as can-fd message, else use normal can

  • flags – additional data flags

Returns:

BOOL

BOOL StartSendingCyclicCanFrame(API_HANDLE api, const char *channel_id, uint64_t frame_id, const uint8_t *payload, size_t payload_size, const uint64_t cycle, BOOL fd, uint32_t flags)

Start sending a cyclic CAN frame on a given channel.

Parameters:
  • channel_id – : The channel name as defined in the configuration file (*.yaml).

  • frame_id – : The message ID.

  • payload – : The message payload as an array of bytes.

  • payload_size – : The length of the payload.

  • cycle – : The cyclic interval for sending the frame.

  • fd – : If true, send as a CAN-FD message; otherwise, use normal CAN.

  • flags – : Additional data flags.

Returns:

TRUE if the operation is successful, FALSE otherwise.

BOOL StopSendingCyclicCanFrame(API_HANDLE api, const char *channel_id, uint64_t frame_id)

Stop sending a cyclic CAN frame on a given channel.

Parameters:
  • channel_id – : The channel name as defined in the configuration file (*.yaml).

  • frame_id – : The message ID.

Returns:

TRUE if the operation is successful, FALSE otherwise.

BOOL TransmitFlexrayFrame(API_HANDLE, const char *channel_id, uint64_t frame_id, const uint8_t *payload, size_t payload_size, FRCommunicationChannel channel, TransmissionMode transmission_mode, uint32_t error_flags)

send raw FlexRay message on a given channel

Parameters:
  • channel_id

  • frame_id

  • payload

  • payload_size

  • channel

  • transmission_mode

  • error_flags

Returns:

BOOL

BOOL StopTransmitFlexrayFrame(API_HANDLE, const char *channel_id, uint64_t frame_id, FRCommunicationChannel channel)

stop transmit continious flexray message on a given channel

Parameters:
  • channel_id

  • frame_id

  • channel

Returns:

BOOL

BOOL ActivateWakeUpFlexRayBus(API_HANDLE, const char *channel_id, BOOL do_wake_up)

activate wake up a specific flexray bus

Parameters:
  • channel_id – : channel name like defined in the config file (*.yaml)

  • do_wake_up – : whether activate or deactivate automatic wake up

Returns:

BOOL

BOOL TransmitLinFrame(API_HANDLE, const char *channel_id, uint16_t frame_id, const uint8_t *payload, size_t payload_size)

transmit lin frame after next master request

Parameters:
  • channel_id – : channel name like defined in the config file (*.yaml)

  • frame_id – : message id

  • payload – : payload as bytes

  • payload_size – : payload length

Returns:

BOOL

BOOL WakeUpLinBus(API_HANDLE, const char *channel_id)
BOOL TransmitEthernetFrame(API_HANDLE, const char *channel_id, const uint8_t *payload, size_t payload_size, uint64_t timestamp)

send raw ethernet frame on a given channel

Parameters:
  • channel_id – : channel name like defined in the config file (*.yaml)

  • payload – The raw Ethernet frame payload as a pointer to uint8_t.

  • payload_size – The size of the payload.

  • timestamp

Returns:

BOOL: indicating whether the operation was successful.

uint64_t StartSendingCyclicEthFrame(API_HANDLE, const char *channel_id, const uint8_t *payload, size_t payload_size, uint64_t cycle)

Start sending a raw Ethernet frame on a given channel.

Parameters:
  • channel_id – channel name like defined in the config file (*.yaml)

  • payload – The raw Ethernet frame payload as a pointer to uint8_t.

  • payload_size – The size of the payload.

  • cycle – The cycle parameter.

Returns:

uint64_t: A hash value associated with the started cyclic send. Use this hash to stop the cyclic send.

BOOL StopSendingCyclicEthFrame(API_HANDLE, const char *channel_id, uint64_t frame_hash)

Stop sending a raw Ethernet frame on a given channel.

Parameters:
  • channel_id – channel name like defined in the config file (*.yaml)

  • frame_hash – The hash value associated with the cyclic send to be stopped.

Returns:

BOOL: indicating whether the operation was successful.

BOOL SendSerialMessage(API_HANDLE api, const char *channel_id, const char *message)

send raw serial message on a given channel

Parameters:
  • channel_id

  • message

Returns:

BOOL

BUFFER_HANDLE GetLastReceivedFrameValue(API_HANDLE, const char *channel_name, uint64_t frame_id)

Get the Last Received Frame Value object.

Parameters:
  • channel_name – : channel name like defined in the config file (*.yaml)

  • frame_id – : message id

Returns:

BUFFER_HANDLE

BOOL OpenDiagConnection(API_HANDLE, uint8_t src_diag_addr, const char *target_ip)

start HSFZ connection with diag server of IP address target_ip and using src_diag_addr as source diag address

Deprecated:

This function will be DELETED. Use OpenDiagnosticSession instead.

Parameters:
  • src_diag_addr – : source diag address used in the current diag connection

  • target_ip – : ip address of the diag server

Returns:

BOOL

BOOL SendDiag(API_HANDLE, uint8_t src_diag_addr, uint8_t tar_diag_addr, const uint8_t *payload, size_t payload_size, const char *target_ip)

sends a diagnostic job to a diagnostic server. This method will just set up the connection and must be used before calling the method SendDiag from the given diag address.

Deprecated:

This function will be DELETED. Use TransmitDiagnosticMessage instead.

Parameters:
  • src_diag_addr – :source diagnostic address

  • tar_diag_addr – :target diagnostic address

  • payload – : diag payload concerning UDS norm

  • payload_size – : size of payload

  • target_ip – : IP address of the diagnostic server

Returns:

BOOL

CALLBACK_HANDLE RegisterCallback(API_HANDLE, uint8_t src_diag_addr, uint8_t tar_diag_addr, OnDiagResponseCallback callback, const char *target_ip)

register a callback function to be called when diag response is received from server with diag address tar_diag_addr to tester id src_diag_addr

Deprecated:

This function will be DELETED. Use RegisterDiagnosticMessageCallback instead.

Parameters:
  • src_diag_addr – : diag address of the diag server

  • tar_diag_addr – : diag address of the diag client

  • callback – : callback function

  • target_ip – : IP address of the diag server

Returns:

CALLBACK_HANDLE

BOOL UnregisterCallback(API_HANDLE, uint8_t src_diag_addr, uint8_t tar_diag_addr, CALLBACK_HANDLE callback, const char *target_ip)

stop listening on diag responses from a server with diag address tar_diag_addr to tester id src_diag_addr

Deprecated:

This function will be DELETED. Use UnregisterDiagnosticMessageCallback instead.

Parameters:
  • src_diag_addr – : diag address of the diag server

  • tar_diag_addr – : diag address of the diag client

  • callback – : callback function

  • target_ip – : IP address of the diag server

Returns:

BOOL

BOOL CloseDiagConnection(API_HANDLE, uint8_t tar_diag_addr, const char *target_ip)

shutdown diagnostic connection with given diag server

Deprecated:

This function will be DELETED. Use CloseDiagnosticSession instead.

Parameters:
  • tar_diag_addr – : server diagnostic address

  • target_ip – : server IP address

Returns:

BOOL

BOOL OpenDoIpSession(API_HANDLE, const DoIpSessionInfo *session_info)

Opens DoIP diagnostic session for a provided session info.

Deprecated:

This function will be DELETED. Use OpenDiagnosticSession instead.

Parameters:

session_info – Pointer to structure that contains session info. For more details refer to DoIpSessionInfo docs.

Returns:

BOOL Returns TRUE if session was successfully created and connection was established, otherwise FALSE.

BOOL CloseDoIpSession(API_HANDLE, const DoIpSessionInfo *session_info)

Closes DoIP diagnostic session for a provided session info.

Deprecated:

This function will be DELETED. Use CloseDiagnosticSession instead.

Parameters:

session_info – Pointer to structure that contains session info. For more details refer to DoIpSessionInfo docs.

Returns:

BOOL Returns TRUE if session was successfully closed (i.e., socket was closed), otherwise FALSE. If there is no such a session returns FALSE as well.

BOOL TransmitDoIpMessage(API_HANDLE, const DoIpSessionInfo *session_info, uint16_t tester_address, uint16_t target_address, const uint8_t *payload, size_t payload_size)

Transmit DoIP diagnostic message within the provided session info.

Deprecated:

This function will be DELETED. Use TransmitDiagnosticMessage instead.

Parameters:
  • session_info – Pointer to structure that contains session info. For more details refer to DoIpSessionInfo docs.

  • tester_address – Tester address (source_address in DoIP message).

  • target_address – Target address (target_address in DoIP message).

  • payload – Pointer to the buffer with message payload

  • payload_size – Length of the buffer

Returns:

BOOL Returns TRUE if the message was successfully transmitted, otherwise FALSE.

CALLBACK_HANDLE RegisterDoIpMessageCallback(API_HANDLE, const DoIpSessionInfo *session_info, uint16_t source_address, OnDoIpMessageCallback callback)

Registers callback for the provided session info and source address. Pay attention: callback will be executed in a separate thread, rather than caller’s thread!

Deprecated:

This function will be DELETED. Use RegisterDiagnosticMessageCallback instead.

Parameters:
  • session_info – Pointer to structure that contains session info. For more details refer to DoIpSessionInfo docs.

  • source_address – Logical address of sender (source_address field in DoIP message).

Returns:

CALLBACK_HANDLE Pointer to the callback if it was successfully registered, otherwise NULL. If such a callback is already registered returns NULL.

BOOL UnregisterDoIpMessageCallback(API_HANDLE, const DoIpSessionInfo *session_info, uint16_t source_address, CALLBACK_HANDLE callback)

Unregisters callback for the provided session info and source address.

Deprecated:

This function will be DELETED. Use UnregisterDiagnosticMessageCallback instead.

Parameters:
  • session_info – Pointer to structure that contains session info. For more details refer to DoIpSessionInfo docs.

  • source_address – Logical address of sender (source_address field in DoIP message).

  • callback – Handle to the callback

Returns:

BOOL Returns TRUE if callback was successfully unregistered, otherwise FALSE.

BOOL OpenDiagnosticSession(API_HANDLE, const DiagnosticSessionInfo *session_info)

Opens diagnostic session for a provided session info. Protocol is either DOIP or HSFZ (based on configuration).

Parameters:

session_info – Pointer to structure that contains session info. For more details refer to DiagnosticSessionInfo docs.

BOOL CloseDiagnosticSession(API_HANDLE, const DiagnosticSessionInfo *session_info)

Closes diagnostic session for a provided session info.

Parameters:

session_info – Pointer to structure that contains session info. For more details refer to DiagnosticSessionInfo docs.

Returns:

BOOL Returns TRUE if session was successfully closed (i.e., socket was closed), otherwise FALSE. If there is no such a session returns FALSE as well.

BOOL TransmitDiagnosticMessage(API_HANDLE, const DiagnosticSessionInfo *session_info, uint16_t tester_address, uint16_t target_address, const uint8_t *payload, size_t payload_size)
Parameters:
  • session_info – Pointer to structure that contains session info. For more details refer to DiagnosticSessionInfo docs.

  • tester_address – Tester address

  • target_address – Target address

  • payload – Pointer to the buffer with message payload

  • payload_size – Length of the buffer

Returns:

BOOL Returns TRUE if the message was successfully transmitted, otherwise FALSE.

CALLBACK_HANDLE RegisterDiagnosticMessageCallback(API_HANDLE, const DiagnosticSessionInfo *session_info, uint16_t source_address, OnDiagnosticMessageCallback callback)

Registers callback for the provided session info and source address. Pay attention: callback will be executed in a separate thread, rather than caller’s thread!

Parameters:
  • session_info – Pointer to structure that contains session info. For more details refer to DiagnosticSessionInfo docs.

  • source_address – Logical address of sender

Returns:

CALLBACK_HANDLE Pointer to the callback if it was successfully registered, otherwise NULL. If such a callback is already registered returns NULL.

BOOL UnregisterDiagnosticMessageCallback(API_HANDLE, const DiagnosticSessionInfo *session_info, uint16_t source_address, CALLBACK_HANDLE callback)
Parameters:
  • session_info – Pointer to structure that contains session info. For more details refer to DiagnosticSessionInfo docs.

  • source_address – Logical address of sender

  • callback – Handle to the callback

Returns:

BOOL Returns TRUE if callback was successfully unregistered, otherwise FALSE.

BOOL SetUpCanTpMsg(API_HANDLE, const char *channel_name, uint64_t rx_id, uint8_t source_address, uint64_t tx_id, uint8_t target_address)

Set the Up Can Tp Msg object, configure can tp message coupling to send on tx and receive on RX message.

Parameters:
  • channel_name – : can channel name like defined in the config file (*.yaml)

  • rx_id – : receiving message id

  • source_address – : source address

  • tx_id – : transmission message

  • target_address – : target address

Returns:

BOOL

BOOL ConfigureCanTpMsg(API_HANDLE, const char *channel_name, uint64_t rx_id, uint8_t source_address, uint64_t tx_id, uint8_t target_address, uint8_t protocol, uint8_t pdu_length, uint8_t padding_value, uint64_t flow_timeout)
BOOL ConfigureCanTpFlowControl(API_HANDLE, const char *channel_name, uint64_t rx_id, uint8_t source_address, uint8_t block_size, uint8_t separation_time)
CALLBACK_HANDLE RegisterCanTpListener(API_HANDLE, const char *channel_name, uint64_t frame_id, uint8_t target_address, OnMessageCallback callback)

listen on received can tp message after configuring the coupling with SetUpCanTpMsg

Parameters:
  • channel_name – : can channel name like defined in the config file (*.yaml)

  • frame_id – :RX frame id

  • target_address – :source address

  • callback – : function to be called when can tp message is received

Returns:

CALLBACK_HANDLE

BOOL UnregisterCanTpListener(API_HANDLE, const char *channel_name, uint64_t frame_id, uint8_t target_address, CALLBACK_HANDLE callback)

stop listening on can tp messages

Parameters:
  • channel_name – : can channel name like defined in the config file (*.yaml)

  • frame_id – :RX frame id

  • target_address – :source address

  • callback – : function like in RegisterCanTpListener

Returns:

BOOL

BOOL TransmitCanTpMessage(API_HANDLE, const char *channel_name, uint32_t frame_id, const uint8_t *payload, size_t payload_size, uint8_t target_address)

send can-tp message , message coupling (i.e fucntion SetUpCanTpMsg) and callback register (i.e fucntion RegisterCanTpListener) must be done before calling this function

Parameters:
  • channel_name – can channel name like defined in the config file (*.yaml)

  • frame_id – TX frame id used in the

  • payload – raw payload to be sent over can-tp

  • payload_size – payload size

  • target_address – target address

Returns:

BOOL