ADTF  3.13.0
Using Runtime Hooks


With the help of the Runtime Hook mechanism it is possible to react upon changes happening within the runtime.

For a complete list of hook locations and the information provided by those hooks see IRuntime::tRuntimeHookId.

Please keep in mind that this is a very advanced interaction with the ADTF System that is rarely required. Most Problems can be easily resolved without resorting to this techinque. Always consider the following options first:

  • Use a specific initialisation order of filters to ciricumvent dependency problems.
  • Use the IService::ServiceEvent method whenever possible instead of this method.

Important Notes

  • If you implement hook functionality in a filter make sure that you never transmit samples when your filters Start method has not been called, i.e. transmission of samples is only allowed during the running state.

Example usage

The following example shows an example IRuntimeHook implementation.

tResult cMyObject::RuntimeHook(tHookInfo* psHookInfo, const iobject_ptr<IObject>& pObject)
{
if (IRuntime::RHI_RunLevelPostIncrement == psHookInfo->idHook &&
adtf::base::tADTFRunLevel::RL_Running == psHookInfo->ui32Param1)
{
LOG_INFO("Runlevel RL_Running has been reached");
}
else if (IRuntime::RHI_RunLevelPreDecrement == psHookInfo->idHook &&
adtf::base::tADTFRunLevel::RL_Running == psHookInfo->ui32Param1)
{
LOG_INFO("Runlevel is going to be decreased to RL_Application");
}
else if (IRuntime::RHI_RegisterObject == psHookInfo->idHook)
{
LOG_INFO(cString::Format("Object '%s' has been registered.", reinterpret_cast<const tChar*>(psHookInfo->pvData)));
}
}

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Tue Sep 28 2021 by doxygen 1.8.14)