STM32Cube Expansion Pack CAN Stack

a class to handle the IsoTp protocol More...

#include <IsoTP.h>

Inheritance diagram for IsoTp:
Collaboration diagram for IsoTp:

Public Member Functions

 IsoTp (IsoTp_ObjectConfig initConfig)
 constructor with connection to a communication controller interface
 
Std_ReturnType Init (const IsoTP_ConfigType *ptr2Config)
 This function initializes the object according the background configuration. More...
 
Std_ReturnType Init (IsoTP_RxTxStatus SendOrReceive=IsoTP_RxTxStatus::IsoTP_SendIdle)
 
IsoTP_RxPduType GetRxPduName (void)
 Get the name of the linked rx PDU. More...
 
IsoTP_TxPduType GetTxPduName (void)
 Get the name of the linked rx PDU. More...
 
IsoTP_StatesType GetState (void)
 to get the module state
 
Std_ReturnType Transmit (const IsoTp_TxBufferType *ptr2TxBuffer)
 the transmit function More...
 
Std_ReturnType Transmit (uint8_t payload[], uint16_t size)
 the transmit function More...
 
Std_ReturnType RxIndication (ComStack_PduType rxPduId, const ComStack_CanMessageType *ptr2Sdu)
 overwrite the function prototype supported by the CanIfUpperLayer class More...
 
Std_ReturnType Task (void)
 to handle the protocol More...
 
- Public Member Functions inherited from CanIfUpperLayer
virtual Std_ReturnType RxIndication (ComStack_PduType rxPduId, REF2CONST(ComStack_CanMsgHeader, AUTOMATIC) CanMsgHeader, REF2CONST(ComStack_PduInfoType, AUTOMATIC) PduInfo)
 virtual function declaration to have an indication function in all upper layer classes More...
 

Private Member Functions

Std_ReturnType InitHandle (void)
 initialize the object handle
 
Std_ReturnType SendFlowControl (IsoTP_FlowStatus FlowStatus)
 the flow controll message will be send
 
Std_ReturnType SendSingleFrame (void)
 this function gives the data stored inside the IsoTp object to the communication controller interface
 
Std_ReturnType SendFirstFrame (void)
 this function gives the data stored inside the IsoTp object to the communication controller interface
 
Std_ReturnType SendConsecutiveFrame (void)
 this function gives the data stored inside the IsoTp object to the communication controller interface
 
Std_ReturnType ReceiveFlowControl (const CanIsoTP_8ByteData *ptr2FlowControlFrame)
 do the work on a flow control message
 
Std_ReturnType ReceiveSingleFrame (const CanIsoTP_8ByteData *ptr2SingleFrame)
 do the work on a received single frame message
 
Std_ReturnType ReceiveFirstFrame (const CanIsoTP_8ByteData *ptr2FirstFrame)
 do the work on a received first frame message
 
Std_ReturnType ReceiveConsecutiveFrame (const CanIsoTP_8ByteData *ptr2ConsFrame, uint8_t len)
 do the work on a received consecutive frame message
 
uint8_t ms_to_st_min (uint8_t ms)
 
uint8_t st_min_to_ms (uint8_t st_min)
 
uint32_t GetMillisecond (void)
 
- Private Member Functions inherited from TME_VersionInfo
 TME_VersionInfo (uint16_t Module, uint16_t Version, uint16_t Patch)
 constructor to set version Ids
 
 TME_VersionInfo (uint16_t Vendor, uint16_t Module, uint16_t Version, uint16_t Patch)
 constructor to set version Ids including the vendor
 
 TME_VersionInfo (const TME_VersionInfo &other)
 copy constructor
 
Std_ReturnType GetVersionInfo (uint32_t BufferLength, const uint8_t *Ptr2Buffer)
 Copies the VersionIinfo to a 8byte buffer. More...
 

Private Attributes

IsoTP_HandlingType objectHandle = { .ModuleState = IsoTP_StatesType::IsoTP_OFF }
 to handle the object lifetime
 
IsoTp_ObjectConfig objectConfig
 to hold the object configuration More...
 

Detailed Description

a class to handle the IsoTp protocol

  • We start to implement the ECU/slave side of communication
  • we must response on functional (0x7DF/0x18DB33F1) and physical addressing (0x7E0, 0x7E1... / 0x18DAXXF1 )
  • every time response is on physical addressing (

Definition at line 217 of file IsoTP.h.

Member Function Documentation

◆ GetMillisecond()

uint32_t IsoTp::GetMillisecond ( void  )
private

To get the actual millisecond of the system

Definition at line 788 of file IsoTP.cpp.

References objectHandle, and IsoTP_HandlingType::TaskTicks.

◆ GetRxPduName()

IsoTP_RxPduType IsoTp::GetRxPduName ( void  )

Get the name of the linked rx PDU.

Todo:
we should add a virtual function to the CanIfUpperLayer class
Todo:
we should add a virtual function to the CanIfUpperLayer class

Definition at line 88 of file IsoTP.cpp.

References objectConfig, and IsoTp_ObjectConfig::rxPduName.

◆ GetTxPduName()

IsoTP_TxPduType IsoTp::GetTxPduName ( void  )

Get the name of the linked rx PDU.

Todo:
we should add a virtual function to the CanIfUpperLayer class
Todo:
we should add a virtual function to the CanIfUpperLayer class

Definition at line 92 of file IsoTP.cpp.

References objectConfig, and IsoTp_ObjectConfig::txPduName.

◆ Init()

Std_ReturnType IsoTp::Init ( const IsoTP_ConfigType *  ptr2Config)

This function initializes the object according the background configuration.

returns E_NOT_OK if there is a problem on the config

See also
TM_ISOTP_INIT_ID
Parameters
[in]ptr2Configpointer to hold configuration
Returns
Std_ReturnType
Version
04.2022

Definition at line 113 of file IsoTP.cpp.

References AUTOMATIC, E_NOT_OK, E_OK, ISOTP_DET_REPORTERROR, IsoTP_ON, IsoTP_HandlingType::ModuleState, NULL_PTR, objectHandle, and VAR.

◆ ms_to_st_min()

uint8_t IsoTp::ms_to_st_min ( uint8_t  ms)
private

convert millisecond to STmin value

Definition at line 760 of file IsoTP.cpp.

◆ RxIndication()

Std_ReturnType IsoTp::RxIndication ( ComStack_PduType  rxPduId,
const ComStack_CanMessageType ptr2Sdu 
)
virtual

overwrite the function prototype supported by the CanIfUpperLayer class

Parameters
[in]rxPduIdnaming the incoming message
[in]ptr2Sdupointer to the data unit
Warning
this should removed from CAN Rx Interrupt !!!!
this should removed from CAN Rx Interrupt !!!!
this should removed from CAN Rx Interrupt !!!!

Reimplemented from CanIfUpperLayer.

Definition at line 638 of file IsoTP.cpp.

References E_NOT_OK, GetState(), ISOTP_DET_REPORTERROR, ISOTP_E_UNINIT, and IsoTP_ON.

Here is the call graph for this function:

◆ st_min_to_ms()

uint8_t IsoTp::st_min_to_ms ( uint8_t  st_min)
private

convert STmin value to millisecond

Definition at line 773 of file IsoTP.cpp.

◆ Task()

◆ Transmit() [1/2]

Std_ReturnType IsoTp::Transmit ( const IsoTp_TxBufferType ptr2TxBuffer)

the transmit function

Parameters
[in]ptr2TxBufferpointer to the data array structure including the size

Definition at line 148 of file IsoTP.cpp.

References E_NOT_OK, IsoTP_HandlingType::FlowControl, objectHandle, and IsoTP_ControlType::ProtocolStatus.

◆ Transmit() [2/2]

Std_ReturnType IsoTp::Transmit ( uint8_t  payload[],
uint16_t  size 
)

the transmit function

Parameters
[in]payloadpointer to the data array
[in]sizebyte count

Member Data Documentation

◆ objectConfig

IsoTp_ObjectConfig IsoTp::objectConfig
private
Initial value:
= { .rxPduName = IsoTP_Rx_unknownPdu,
.txPduName = IsoTP_Tx_unknownPdu,
.ptr2Config = &IsoTP_DefaultConfig,
.p2ControllerInterface = NULL_PTR,
}

to hold the object configuration

Definition at line 339 of file IsoTP.h.

Referenced by GetRxPduName(), GetTxPduName(), SendFirstFrame(), and SendSingleFrame().


The documentation for this class was generated from the following files:
NULL_PTR
#define NULL_PTR
Definition: TM_Compiler.h:45