ADTF  3.18.2
Source Code for Demo Interface Binding Plugin
Location
./src/examples/src/adtf/filters/standard_filters/interface_binding_filter/
Namespace for entire ADTF SDK.
Build Environment
To see how to set up the build environment have a look at ADTF CMake Environment
this implementation shows:
Server Header
#pragma once
#include "print_intf.h"
class cPrinter : public adtf::ucom::object<IPrintInterface>
{
public:
virtual void Print(const char* strString);
};
class cInterfaceBindingServerFilter: public adtf::filter::cFilter
{
public:
ADTF_CLASS_ID_NAME(cInterfaceBindingServerFilter,
"demo_interface_binding_server.filter.adtf.cid",
"Demo Interface Binding Server");
cInterfaceBindingServerFilter();
private:
// this is our exppose server object
};
Copyright © Audi Electronics Venture GmbH.
#define ADTF_CLASS_ID_NAME(_class, _strcid, _strclabel)
Common macro to enable correct treatment of class identifier AND Class Name by IClassInfo.
Definition: class_id.h:33
Object pointer implementation used for reference counting on objects of type IObject.
Definition: object_ptr.h:163
Use this template if you want to implement an ucom::ant::IObject based Interface and/or subclass an e...
Definition: object.h:379
Server Implementation
#include "demo_interface_binding_server_filter.h"
using namespace adtf::util;
using namespace adtf::ucom;
using namespace adtf::base;
using namespace adtf::streaming;
using namespace adtf::filter;
void cPrinter::Print(const char* strString)
{
LOG_INFO("%s", strString);
}
cInterfaceBindingServerFilter::cInterfaceBindingServerFilter()
{
m_pPrinter = make_object_ptr<cPrinter>();
CreateInterfaceServer<IPrintInterface>("printer_server", m_pPrinter);
SetDescription("printer_server", "Interface server to provide access to a function for printing");
// sets a short description for the component
SetDescription("Use this Filter to provide a server for a printer Interface (e.g. used by 'Demo Interface Binding Client', see Filters");
// set help link to jump to documentation from ADTF Configuration Editor
SetHelpLink("$(ADTF_DIR)/doc/adtf_html/page_demo_interface_binding_filter.html");
}
Namespace for the ADTF Base SDK.
Namespace for the ADTF Filter SDK.
Namespace for the ADTF Streaming SDK.
Namespace for the ADTF uCOM3 SDK.
alias namespace for the A_UTILS Library.
Client Header
#pragma once
#include "print_intf.h"
// define a trigger function
class cInterfaceBindingClientFilter: public adtf::filter::cFilter
{
public:
ADTF_CLASS_ID_NAME(cInterfaceBindingClientFilter,
"demo_interface_binding.filter.adtf.cid",
"Demo Interface Binding Client");
cInterfaceBindingClientFilter();
adtf::streaming::IRunner* pRunner) override;
private:
};
virtual tResult Process(base::flash::tNanoSeconds tmTrigger, streaming::ant::IRunner *pRunner)
The default Runner function of the graph object.
Helper class that wraps a streaming::ant::IBindingClient.
Definition: graph_object.h:67
The Interface defines a runnable item of the GraphObjects providing a IRuntimeBehaviour.
Definition: runner_intf.h:24
Client Implementation
#include "demo_interface_binding_client_filter.h"
#include <cinttypes>
using namespace adtf::util;
using namespace adtf::ucom;
using namespace adtf::base;
using namespace adtf::streaming;
using namespace adtf::filter;
cInterfaceBindingClientFilter::cInterfaceBindingClientFilter()
{
m_oInterfaceClient = CreateInterfaceClient<IPrintInterface>("printer_client");
SetDescription("printer_client", "Interface client to call a printer function from a server");
CreateRunner("trigger", cTimerTriggerHint(std::chrono::seconds{1}));
SetDescription("trigger", "Runner to periodically trigger the function which prints the timestamp of the trigger");
// sets a short description for the component
SetDescription("Use this filter to provide a client which accesses the printer interface from Demo Interface Printer (see Streaming Sources).");
// set help link to jump to documentation from ADTF Configuration Editor
SetHelpLink("$(ADTF_DIR)/doc/adtf_html/page_demo_interface_binding_filter.html");
}
tResult cInterfaceBindingClientFilter::Process(tNanoSeconds tmTimeOfTrigger, IRunner * /*pRunner*/)
{
m_oInterfaceClient->Print(cString::Format("time is %" PRIi64, tmTimeOfTrigger.nCount));
}
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.