We provide clients with the capability to customize agent configuration through the use of callbacks. Clients can override these callbacks to seamlessly execute specific actions or retrieve essential data during the agent configuration process. At runtime, whenever a configuration change occurs (either during the initial loading of the configuration or an over-the-air update), a callback function named onConfigurationChangedCallback is invoked just before completing your custom agents’s setup. This callback can be overridden in both C++ SDK and Python SDK, enabling users to integrate additional operations during the setup process. For further insights, please consult the provided sample. Notably, this callback functionality is applicable to both Monitors and Recorders.

onConfigurationChangedCallback

In the following example of the onConfigurationChangedCallback function, we get and print out the constantValues and the valueConfigurations that will configure the given agent (For more information, please refer to the configuration by value page).
This sample shows mainly the potential of this function, being that any logic can be added at setup time, modifying configuration, run additional code based on values…etc

//! [Sample Key Feature] Callback function that shall be called during each configuration change (called in onConfigurationChanged)
void Heex::Sample::sampleRecorderConfChangeCallback::onConfigurationChangedCallback()
{
  // NOTE: This function allows user to run commands every time the recorder has been reconfigured, right before it starts working again.
  // NOTE: In this sample, we shall get the recorder's new constant values and valueConfigurations, and print them out, but many other use cases are possible.
  // Let's get the new ValueCOnfigurations and Constant Values
  std::vector<ValueConfiguration*> valueConfs                           = this->getValueConfigurations();
  std::unordered_map<std::string, std::vector<std::string>> constValues = this->getConstantValues();

  // Now we print out all the ValueCOnfigurations if there are any
  if (valueConfs.size() > 0)
  {
    HEEX_LOG(info) << "\nRecorder's value confs are: " << std::endl;
    for (int i = 0; i < valueConfs.size(); i++)
    {
      HEEX_LOG(info) << "\nValue Configuration " << i << " :" << std::endl;
      HEEX_LOG(info) << " - Name     : " << valueConfs[i]->getName() << std::endl;
      HEEX_LOG(info) << " - Type     : " << valueConfs[i]->getType() << std::endl;
      HEEX_LOG(info) << " - UUID     : " << valueConfs[i]->getUuid() << std::endl;
      HEEX_LOG(info) << " - IsValid? : " << valueConfs[i]->isValid() << std::endl;
    }
  }

  // And finally we print out the Constant Values if there are any
  if (constValues.size() > 0)
  {
    HEEX_LOG(info) << "\nRecorder's constant values are: " << std::endl;
    for (auto& it : constValues)
    {
      HEEX_LOG(info) << " - " << it.first << " : ";
      for (auto val : it.second)
      {
        HEEX_LOG(info) << val << "  -  ";
      }
      HEEX_LOG(info) << std::endl;
    }
  }
}