Support Request #1039
closedADTF UI service function to access CAN data
Description
Supportanfrage
Hello,
I'm Vignesh from Bosch India.
I'm using ADTF2.13.3.
Could you please let me know if there is any function which can be used in an ADTF service to process the CAN message received via Vector_CAN_XL_Receiver.
I'm looking for a function similar to OnPinEvent() function (which we can override in a filter) in an ADTF service.
Is this possible? If not, Please let us know if there are any alternate approach to be followed.
My scenario:
I need a function to process a CAN message as an when it is received in an ADTF service because, I want to show an UI to the user(so I'm implementing a ADTF UI service) which should be displayed even before the ADTF configuration is activated.
User would provide details in the UI after which the configuration should be started and based on that inputs, the CAN messages received would be used to perform certain tasks.
Please let me know if more information is required.
Many thanks in advance!!!
Regards,
Vignesh
Lösung
To be able to read CAN signal values, you will need a can media coder which is responsible to decode the raw can data stream.
Please find the the below code snippet to get a first impression:
... // get can support service interface cObjectPtr<adtf_devicetb::ICANSupport> pCANSupport; _runtime->GetObject(OID_ADTF_CAN_SUPPORT, IID_ADTF_CAN_SUPPORT, (tVoid**) &pCANSupport); // create can coder for decoding cObjectPtr<adtf_devicetb::ICANMediaCoder> pCANDecoder; pCANSupport->CreateCoder(&pCANDecoder); // set raw data from media sample and its size to decode the message pCANDecoder->Begin(psample_data, sizeof(sample_size))); // get message information pCANDecoder->GetMessageInfo(&nChannel, &nMsgID, &bExtended)); // get desired signal id pCANDecoder->GetSignalID(nChannel, "signal name", &pSignalID); // get appropriate signal value relating to the signal id pCANDecoder->GetSignalValue(nSignalID, &sSignalValue))) // terminate coder activities for this message pCANDecoder->End(); ...