ADTF_DEVICE_TOOLBOX  3.12.1 (ADTF 3.18.3)
ICANCoderabstract
Inheritance diagram for ICANCoder:
[legend]

Public Member Functions

 ADTF_IID (ICANCoder, "can_coder.axle.can.sdk.devicetb.adtf.iid")
 
virtual tResult Begin (const adtf::streaming::ant::ISampleBuffer *pData)=0
 Sets the CAN message buffer the coder operates on. More...
 
virtual tResult Begin (const void *pData, int64_t nSize)=0
 Sets the CAN message buffer the coder operates on. More...
 
virtual tResult End ()=0
 Releases the the message which was acquired by any of the Begin() functions. More...
 
virtual tResult SetMessageInfo (tChannelID nChannel, tMessageID nMsgID, bool bExtended)=0
 Inits a new CAN message. More...
 
virtual tResult GetMessageInfo (tChannelID *pnChannel, tMessageID *pnMsgID, bool *pbExtended)=0
 Returns information about the CAN message. More...
 
virtual tResult Set (const char *strValueID, const void *pValue)=0
 Sets the value, which is defined with strValueID. More...
 
virtual tResult Get (const char *strValueID, void *pValue)=0
 Gets the value, which is defined with strValueID. More...
 
virtual tResult SetSignalValue (tSignalID nSignalID, const tSignalValue *pSignalValue)=0
 Sets the value of one CAN signal in the data area given by ICANCoder::Begin To set the raw value directly, the field tSignalValue::nTypeTag has to be set to TAG_RAW_VALUE and the field tSignalValue::n64RawValue to the new raw value. More...
 
virtual tResult GetSignalValue (tSignalID nSignalID, tSignalValue *pSignalValue) const =0
 Returns the decoded value of one CAN signal from the data area given by Begin() On return the field tSignalValue::nTypeTag and the corresponding field in the union will be filled with the appropriate value. More...
 
virtual tResult SetRawData (const uint8_t *pData, uint8_t nLength)=0
 Copies the given raw data to the raw data of the message given by Begin(). More...
 
virtual tResult GetRawData (const uint8_t **pData, uint8_t *nLength) const =0
 Returns the the raw data and the length of the message given by Begin() More...
 
virtual tResult GetSignalID (tChannelID nChannel, const char *strValueID, tSignalID *pSignalID) const =0
 Returns the value ID of a given CAN signal name for the specified channel. More...
 
virtual tResult GetDatabase (tChannelID nChannel, adtf::ucom::ant::iobject_ptr< ICANDatabase > &pCANDatabase) const =0
 Returns the CAN Database for the channel. More...
 
virtual tResult SetDatabase (tChannelID nChannel, const char *strFileName)=0
 Loads the DBC file and uses it for (de-)coding of signal values for the specified channel. More...
 

Detailed Description

Definition at line 42 of file can_coder_intf.h.

Member Function Documentation

◆ Begin() [1/2]

virtual tResult Begin ( const adtf::streaming::ant::ISampleBuffer *  pData)
pure virtual

Sets the CAN message buffer the coder operates on.

Parameters
[in]pDataThe sample buffer to operate on.
Returns
A tResult.

◆ Begin() [2/2]

virtual tResult Begin ( const void *  pData,
int64_t  nSize 
)
pure virtual

Sets the CAN message buffer the coder operates on.

Parameters
[in]pDataThe raw message to operate on.
[in]nSizeThe size of the passed message buffer.
Returns
A tResult.

◆ End()

virtual tResult End ( )
pure virtual

Releases the the message which was acquired by any of the Begin() functions.

Returns
A tResult.

◆ Get()

virtual tResult Get ( const char *  strValueID,
void *  pValue 
)
pure virtual

Gets the value, which is defined with strValueID.

This value is defined within the data area of the stream. The real data area is the buffer allocated by the given by the data pointer of Begin method. The data will be copied in the pValue.

Attention
You need to allocate the memory of pValue with the right size!
Parameters
[in]strValueIDThe value ID specified in the stream (NULL terminated).
[out]pValuePointer to the value to get, this is a reference to the memory area within the given pData by Begin.
Return values
ERR_NOERRORNo Error.
ERR_MEMORYThe buffer area of the given data by Begin has no valid size.
ERR_INVALID_ARGThe given strValueID is not specified.

◆ GetDatabase()

virtual tResult GetDatabase ( tChannelID  nChannel,
adtf::ucom::ant::iobject_ptr< ICANDatabase > &  pCANDatabase 
) const
pure virtual

Returns the CAN Database for the channel.

Parameters
[in]nChannelCAN Channel number
[out]pCANDatabasePointer to CAN database
Return values
ERR_NOERRORNo Error.
ERR_NOT_FOUNDFor the given channel no CAN database is defined

◆ GetMessageInfo()

virtual tResult GetMessageInfo ( tChannelID *  pnChannel,
tMessageID *  pnMsgID,
bool *  pbExtended 
)
pure virtual

Returns information about the CAN message.

Parameters
[in,out]pnChannelPointer to variable to receive the CAN channel number
[in,out]pnMsgIDPointer to variable to receive the CAN message ID
[in,out]pbExtendedPointer to variable to receive the CAN message type
Return values
ERR_NOERRORNo Error.
ERR_MEMORYThe buffer area of the data given by Begin() has no valid size for this message.
ERR_NOT_FOUNDThe given nMsgID is not valid.

◆ GetRawData()

virtual tResult GetRawData ( const uint8_t **  pData,
uint8_t *  nLength 
) const
pure virtual

Returns the the raw data and the length of the message given by Begin()

Parameters
[out]pDataPointer of pointer to raw message data
[out]nLengthLength of raw message data
Return values
ERR_NOERRORNo Error.

◆ GetSignalID()

virtual tResult GetSignalID ( tChannelID  nChannel,
const char *  strValueID,
tSignalID *  pSignalID 
) const
pure virtual

Returns the value ID of a given CAN signal name for the specified channel.

Parameters
[in]nChannelCAN Channel number
[in]strValueIDName of CAN signal
[in,out]pSignalIDPointer to variable which receives the ID
Note
Relevant value id strings for gettings specific signal ids within a CAN message. In these cases the nChannel is negligible:
"ui8Tag" - returns CAN_SIGNALID_HEADER_TAG
"ui8Channel" - returns CAN_SIGNALID_HEADER_CHANNEL
"tmTimeStamp" - returns CAN_SIGNALID_HEADER_HWTIME
Return values
ERR_NOERRORNo Error.
ERR_NOT_FOUNDThe given Name is not valid.

◆ GetSignalValue()

virtual tResult GetSignalValue ( tSignalID  nSignalID,
tSignalValue pSignalValue 
) const
pure virtual

Returns the decoded value of one CAN signal from the data area given by Begin() On return the field tSignalValue::nTypeTag and the corresponding field in the union will be filled with the appropriate value.

To get the signal raw value, the field tSignalValue::nTypeTag has to be set to TAG_RAW_VALUE before calling this method.

Parameters
[in]nSignalIDValue ID
[in,out]pSignalValuePointer to structure which receives the value
Return values
ERR_NOERRORNo Error.
ERR_MEMORYThe buffer area of the data given by Begin() has no valid size for this message.
ERR_NOT_FOUNDThe given nSignalID is not in the current CAN message.
ERR_INVALID_INDEXThe signal is not in the actual multiplexor group

◆ Set()

virtual tResult Set ( const char *  strValueID,
const void *  pValue 
)
pure virtual

Sets the value, which is defined with strValueID.

The content of pValue will be copied. This value is defined within the data area of the coder. The real data area is the buffer allocated by the given by the Begin method. If no data is given by Begin then the setValue failed.

Parameters
[in]strValueIDThe value ID specified in the stream (NULL terminated).
[in]pValuePointer to the value to set.
Return values
ERR_NOERRORNo Error.
ERR_MEMORYThe buffer area of the data given by Begin has no valid size for this coder.
ERR_NOT_FOUNDThe given strValueID is not specified.

◆ SetDatabase()

virtual tResult SetDatabase ( tChannelID  nChannel,
const char *  strFileName 
)
pure virtual

Loads the DBC file and uses it for (de-)coding of signal values for the specified channel.

Parameters
[in]nChannelCAN Channel number
[in]strFileNameName of dbc file to be loaded
Return values
ERR_NOERRORNo Error.
ERR_NOT_FOUNDThe given file is not valid.

◆ SetMessageInfo()

virtual tResult SetMessageInfo ( tChannelID  nChannel,
tMessageID  nMsgID,
bool  bExtended 
)
pure virtual

Inits a new CAN message.

The length of the CAN message will be set automatically. This method has to be called if a new CAN message has to be created.

Parameters
[in]nChannelCAN channel number
[in]nMsgIDCAN message ID
[in]bExtendedTrue if message is an extended CAN message
Return values
ERR_NOERRORNo Error.
ERR_MEMORYThe buffer area of the data given by Begin() has no valid size for this message.
ERR_NOT_FOUNDThe given nMsgID is not valid.

◆ SetRawData()

virtual tResult SetRawData ( const uint8_t *  pData,
uint8_t  nLength 
)
pure virtual

Copies the given raw data to the raw data of the message given by Begin().

Parameters
[in]pDataPoint of raw message data to set
[in]nLengthLength of raw message data
Return values
ERR_NOERRORNo Error.
ERR_INVALID_ARGThe specified length of the message given by Begin() and nLength does not match.

◆ SetSignalValue()

virtual tResult SetSignalValue ( tSignalID  nSignalID,
const tSignalValue pSignalValue 
)
pure virtual

Sets the value of one CAN signal in the data area given by ICANCoder::Begin To set the raw value directly, the field tSignalValue::nTypeTag has to be set to TAG_RAW_VALUE and the field tSignalValue::n64RawValue to the new raw value.

Parameters
[in]nSignalIDValue ID
[in]pSignalValueValue to be written to CAN message
Note
Relevant signal ids for setting specific values within a CAN message:
CAN_SIGNALID_HEADER_TAG - specifying the hardware tag
CAN_SIGNALID_HEADER_CHANNEL - specifying the hardware channel
CAN_SIGNALID_HEADER_HWTIME - specifying the hardware time
Return values
ERR_NOERRORNo Error.
ERR_MEMORYThe buffer area of the data given by Begin() has no valid size for this message.
ERR_NOT_FOUNDThe given nSignalID is not in the current CAN message.
ERR_INVALID_INDEXThe signal is not in the actual multiplexor group