ADTF_DEVICE_TOOLBOX  3.12.1 (ADTF 3.18.3)
FlexRay Fibex Support Service
Note
Using this service will automatic load the adtffileplugin for deserialization and extend the support for recordings containg data from ADTF Device Toolbox 2.x, there is no need to add the devtb2 support service as well. See ADTF Device Toolbox 2.x Support.

Plugin Information
Plugin Filenameflexray.adtfplugin
Plugin Descriptionflexray.plugindescription
Plugin NameFlexRay Fibex Support Service Plugin
LicenseADTF
Support Mailsupport@digitalwerk.net
Homepage URLwww.digitalwerk.net
Plugin Versions
Plugin Version3.12.1
Plugin File Version1.0
adtf::devicetb3.12.1
adtf3.18.3
adtf::ucom3.1.0
Component Information
NameFlexRay Fibex Support Service
CIDflexray.service.devicetb.cid
DescriptionUse this service to extend the ADTF System with FlexRay support using fibex database.
TypeService
Default Runlevelsession
Properties
NameValueTypeDescriptionSubproperties
flexray_channel_1cFilenameListDatabase for mapped FlexRay channel 1
flexray_channel_1_cluster_namecStringCluster name for mapped FlexRay channel 1
flexray_channel_2cFilenameListDatabase for mapped FlexRay channel 2
flexray_channel_2_cluster_namecStringCluster name for mapped FlexRay channel 2
flexray_channel_3cFilenameListDatabase for mapped FlexRay channel 3
flexray_channel_3_cluster_namecStringCluster name for mapped FlexRay channel 3
flexray_channel_4cFilenameListDatabase for mapped FlexRay channel 4
flexray_channel_4_cluster_namecStringCluster name for mapped FlexRay channel 4
flexray_channel_5cFilenameListDatabase for mapped FlexRay channel 5
flexray_channel_5_cluster_namecStringCluster name for mapped FlexRay channel 5
flexray_channel_6cFilenameListDatabase for mapped FlexRay channel 6
flexray_channel_6_cluster_namecStringCluster name for mapped FlexRay channel 6
flexray_channel_7cFilenameListDatabase for mapped FlexRay channel 7
flexray_channel_7_cluster_namecStringCluster name for mapped FlexRay channel 7
flexray_channel_8cFilenameListDatabase for mapped FlexRay channel 8
flexray_channel_8_cluster_namecStringCluster name for mapped FlexRay channel 8
flexray_channel_9cFilenameListDatabase for mapped FlexRay channel 9
flexray_channel_9_cluster_namecStringCluster name for mapped FlexRay channel 9
updatebit_behavior0tInt32If the PDU update-bits check is disabled (set to false), set this property how a PDU update is handled. For more information see chapter "FlexRay Service" in the SDK documentation.
use_legacy_updatebitsfalsetBoolCheck the update-bits in the PDU.
Required Interfaces
IID
flexray_xml.parser.flexray.sdk.devicetb.adtf.iid
macroresolver.ant.base.adtf.iid
adtf_file_objects.devil.services.adtf.iid
Provided Interfaces
IID
bus_database_registry.axle.sdk.devicetb.adtf.iid
flexray.axle.flexray.sdk.devicetb.adtf.iid
flexray_database.axle.flexray.sdk.devicetb.adtf.iid
flexray_coder.axle.flexray.sdk.devicetb.adtf.iid

Working with the FlexRay Stream Type

The Pins for receiving or sending new FlexRay Samples must be from a FlexRay Stream Type. The following code shows how to create an Output Pin with this type:

adtf::streaming::ISampleWriter* m_pWriter = CreateOutputPin("flexray_output", adtf::devicetb::sdk::flexray::stream_meta_type_flexray());
adtf::streaming::ISampleReader* m_pReader = CreateInputPin("flexray_input", adtf::devicetb::sdk::flexray::stream_meta_type_flexray());
Definition of Stream Meta Type FlexRay Messages.

All samples which are transmitted on these pins are assumed to be from a FlexRay Stream Type.

Low level FlexRay data handling

FlexRay data is stored in specific ADTF media samples of the type adtf::devicetb::sdk::flexray::stream_meta_type_flexray. The data structure used to store FlexRay frames is adtf::devicetb::sdk::flexray::tFlexRayData. Inside the media sample a vector of this frames is stored, which can be easily accessed by using the class adtf::devicetb::sdk::flexray::cFlexRayFrameVector. The following example shows the handling of a FlexRay media samples like it may be implemented by the OnPinEvent method of an ADTF filter:

tResult cMyFlexRayFilter::ProcessInput(adtf::base::tNanoSeconds /*tmTrigger*/,
adtf::streaming::ISampleReader* pReader)
{
object_ptr<const ISample> pReadSample;
if(IS_OK(pReader->GetNextSample(pReadSample))
{
object_ptr_shared_locked<const ISampleBuffer> oSampleBuffer;
RETURN_IF_FAILED(pReadSample->Lock(oSampleBuffer));
if(oSampleBuffer)
{
adtf::devicetb::sdk::flexray::cFlexRayFrameVector oFrameVector(oSampleBuffer->GetPtr(), oSampleBuffer->GetSize());
for (cFlexRayFrameVector::cIterator it = oFrameVector.GetFirst(); it.IsValid(); ++it)
{
const tFlexRayData* pData =it;
switch (pData->nTag)
{
case tFlexRayData::FR_TAG_PDU:
{
...
}
case tFlexRayData::FR_TAG_FRAME:
{
...
}
default:
break;
}
}
}
oSampleBuffer->Unlock();
}
RETURN_NOERROR;
}

An example for creating flexray data is provided within the flexray-randomgenerator-example.

Fibex database access

The configuration of the FlexRay communication parameters and scheduling is stored in the Fibex database. To access this database the flexray service should be used. This service implements the adtf::devicetb::sdk::flexray::IFlexRaySupport interface. The corresponding nChannelID handles the requested property variable (further information here: subsection_flx_channel_properties). To get access to this database the following code sequence can be used:

// Query FlexRay service object
object_ptr<adtf::devicetb::sdk::flexray::IFlexRaySupport> poFlexRayService;
RETURN_IF_FAILED(_runtime->GetObject(poFlexRayService));
object_ptr<adtf::devicetb::sdk::flexray::IFlexRayDatabase> poFIBEXDatabase;
RETURN_IF_FAILED(poFlexRayService->GetDatabase(nChannelId, poFIBEXDatabase)));

ADTF provides the possibility to load Fibex Files via the flexray service. If you enter a Fibex file here, it will be parsed and loaded into the cache after playing your configuration.

Note
If you play a configuration, the Fibex file (as specified in the property "flexray_channel") will be parsed and loaded into the cache. If the Fibex file has changed during your ADTF session, it will be parsed and loaded again (If you play your configuration after the file has changed!). The old version of this file will then be removed from the cache. If you change the value of "flexray_channel" to another Fibex file and play the configuration again, this Fibex file will also be loaded into the cache. This is because ADTF checks the filename and alteration date of the given Fibex file. Please keep in mind that your sytem memory can increase significantly, if you repeat this many times!

High level signal handling

To handle signal values on a high level abstraction the FlexRay coder objects can be used. Objects of this type can be created by the FlexRay service. They implement the interface adtf::devicetb::sdk::flexray::IFlexRayCoder. Signals and PDUs are identified by IDs. These IDs are assigned by the FlexRay service during runtime. They can be used during the lifetime of filter modules.

Note
The value of IDs may change on the next start of the configuration. IDs should not be stored in the DAT file.

The decoding of signal values can be achieved on two different ways:

Note
It is recommended to use different instances of a FlexRay coder for transmitting and receiving events. Otherwise setting a signal for transmission might interfere with getting a signal in a concurrently performed receive operation.

Both ways are influenced by the property flexray_updatebit_behavior. According to the settings of this property, PDUs and signal groups are processed differently:

  • DO_NOT_UPDATE
    The coder will not process the PDU or signal. Data buffers will not be updated with received values and hence their content is undefined.
  • SAMPLE_AND_HOLD
    The coder will stick to the last valid receive value. That means data buffers are not updated with the reveived values but remain in the state of the last valid received PDU/signal value. Valid denotes in this case the last receive operation with update bit set.
  • USE_RECEIVED_VALUE
    The coder updates data buffers with the received values no matter if the update bit has been set or not.

Whenever data buffers are updated on receive, PDU or signal values may be read using adtf::devicetb::sdk::flexray::IFlexRayCoder::GetSignalValue().

Note
The API adtf::devicetb::sdk::flexray::IFlexRayCoder::GetPDUStatus() is not intended to get the status of received PDUs as one might guess. It is only relevant for PDU transmission, to have an indication if a PDU has indeed been updated and needs to be transmitted again. Indication is set when adtf::devicetb::sdk::flexray::IFlexRayCoder::SetSignalValue() has been called.

If the update bit is used according to the configuration of property flexray_updatebit_behavior the user will in any way get only valid PDUs and signals, but there is no access to the update bit itself. If this information is vital to your implementation feel free to access the raw values of a FlexRay frame as explained in Low level FlexRay data handling