xentara-plugin v2.0.3
The Xentara Plugin Framework
|
A Xentara skill is represented by a global object of a skill class derived from xentara::skill::Skill::Class. You can derive xentara::skill::Skill::Class yourself, but it is easiest to use the template class xentara::skill::Skill::ConcreteClass, which implements all of the required callbacks using template parameters.
The skill class object must have static storage duration, i.e. it must be a static member variable or a global variable. Usually, it is most convenient to make the skill class object a static member of the actual skill object class (see below).
The skill class object does not contain any functionality. Instead, it provides the following meta information about the skill to Xentara:
The skill class object must also provide a callback to create the skill object itself, which contains the actual functionality.
The plugin framework provides a template class xentara::skill::Skill::ConcreteClass, which takes all of the required information as template parameters and implements all the callbacks for you.
The actual functionality of a skill is encapsulated is a custom class derived from xentara::skill::Skill. The skill should contain all the global functionality of the skill that is not directly tied to a specific element type.
The skill provides a callback to create top-level elements. A top-level element is an element that is not a child of another skill element, but that either have no parent element, or reside within an element group See Creating Skill Element Objects on how skill elements are created.
Each type of element (bus, device, data point, service, client etc.) supported by the skill is represented by a global object of a custom element class type derived from xentara::skill::Element::Class. You can derive xentara::skill::Element::Class yourself, but it is easiest to use the template class xentara::skill::Element::ConcreteClass, which implements all of the required callbacks using template parameters.
The element class object must have static storage duration, i.e. it must be a static member variable or a global variable. The element class should contain a static member function instance() that returns a the element class object, so that it can be used together with xentara::skill::Skill::ConcreteClass. If you use xentara::skill::Element::ConcreteClass instead of writing your own class, the global instance is created automatically. Otherwise, it is usually most convenient to make the element class object a static member variable of your custom class.
The element class object itself does not contain any functionality. Instead, it provides the following meta information about the element type to Xentara:
The actual elements themselves are created by the skill object, or by the parent element.
The plugin framework provides a template class xentara::skill::Element::ConcreteClass, which takes all of the required information as template parameters and implements all the callbacks for you. This class also implements the instance() method required to use the class together with xentara::skill::Skill::ConcreteClass.
The actual functionality of an element is provided by a custom class derived from xentara::skill::Element. This class should contain all element specific functionality.
A element will usually publish configuration and status attributes. See Publishing Attributes on how to publish attributes in general, and Publishing Config Parameters as Xentara Attributes on how to publish configuration attributes.
A element may also publish one or more events. See Publishing Events on how to publish events.
An element may also publish one or more tasks that can be scheuled in an execution pipeline. See Publishing Tasks on how to publish tasks.