The aim of a capacity is to describe an equipment feature.
Plugin objective: the plugin (like WindowsSystemInformation) declare a device nammed "cpu" which capacity is to provide the cpu temperature and the cpu load
The plugin describe the device cpu having the capacity of providing a temperature. Each data is identified by the keyword tempcpu0 (or Processor temperature) and will be a decimal value with °C as units.
In the textual description, we have all important words in bold
From the plugin, using yPluginApi
yPluginApi->declareKeyword("cpu", "tempcpu0", shared::CStandardCapacities::Temperature, EKeywordAccessMode::kReadOnly, EKeywordType::kDecimal, shared::CStandardUnits::DegreesCelcius);
The plugin describe the device cpu having the capacity of providing a cpuload. Each data is identified by the keyword loadcpu0 (or Processor load) and will be a integer value with % as units.
In the textual description, we have all important words in bold
From the plugin, using yPluginApi
yPluginApi->declareKeyword("cpu", "loadcpu0", "cpuload", EKeywordAccessMode::kReadOnly, EKeywordType::kInteger, shared::CStandardUnits::Percent);
When a new data should be saved in database, the plugin should just use such a code
yPluginApi->historizeData("cpu", "tempcpu0", 45.2);
yPluginApi->historizeData("cpu", "loadcpu0", 85);
The plugin describe the device switch-0x12346 having the capacity of controlling a switch. Each data is identified by the keyword switch01 (or Kitchen switch) and will be a string value (on, off).
In the textual description, we have all important words in bold
From the plugin, using yPluginApi
yPluginApi->declareKeyword("cpu", "switch01", "switch", EKeywordAccessMode::kWriteOnly, EKeywordType::kString);
Finally we write what we want for reporting capacity.
The concept of standard capacity allows to unify the data point of the widget view.
Indeed a widget that displays a temperature will use the data of "temperature" capacity.
For a widget that displays the cpu load; it should just select only the "cpuload" capacity