bbfdm/docs/guide/libbbfdm-api_vendor.md
2024-01-25 11:36:30 +01:00

4.5 KiB

BBFDM Vendor

The bbfdm library offers functionality for vendors to define their vendor extensions. This allows them to extend the core Data Model by introducing new objects/parameters/operates/events, overwrite and exclude existing ones.

How to Add a New Vendor

1. Create a Vendor Folder

To add a new vendor, simply create a new folder under 'dmtree/vendor/' which contains all files related to the vendor. Ensure that the folder name matches the vendor name specified in BBF_VENDOR_LIST macro.

2. Populate the tDynamicObj Table

For extending, overwriting, and excluding objects/parameters/operates/events from the core tree, it's mandatory to have a tDynamicObj table. This table should be defined using DM_MAP_OBJ structure, which has three arguments:

Argument Description
parentobj A string representing the parent object name from which to extend/exclude/overwrite the required items. Example: "Device.IP.Diagnostics.", "Device.WiFi.Radio."
nextobject Pointer to a DMOBJ array containing a list of child objects to extend/exclude/overwrite
parameter Pointer to a DMLEAF array containing a list of child parameters to extend/exclude/overwrite
  • The parentobj must be a string path of an object available in the core tree. If it doesn't exist, it will be skipped during parsing of the tDynamicObj table.

  • To extend the Data Model tree, fill the nextobject and parameter arguments with the required objects/parameters/operates/events not supported by the core tree.

  • To overwrite existing objects/parameters/operates/events in the core tree, fill the nextobject and parameter arguments with the same items defined in the core tree, along with new add/del/get/set/browse APIs needed by the vendor.

  • To exclude existing objects/parameters/operates/events in the core tree, fill the nextobject and parameter arguments with the same items defined in the core tree, and setting bbfdm_type to BBFDM_NONE.

3. Enable vendor

To enable the new vendor:

  • Add the vendor to the list in BBF_VENDOR_LIST macro.

  • Define the vendor prefix using BBF_VENDOR_PREFIX macro.

Example Configuration Options:

BBF_VENDOR_LIST="iopsys,xxxx"
BBF_VENDOR_PREFIX="X_IOPSYS_EU_"

Example how to Extend, Overwrite and Exclude the Data Model tree

In the test/vendor_test/ directory, you'll find an example implementation for test vendor. This implementation demonstrates how to extend, overwrite, and exclude objects/parameters/operates/events from the core tree.

1. Extend Data Model

2. Overwrite Data Model

3. Exclude Data Model

Note1: The libbbfdm vendor list can support multiple vendors, separated by commas.

Note2: If multi vendors are supported and there is an objects/parameters/operates/events implemented differently by different vendors, the implementation of the last vendor name in BBF_VENDOR_LIST will be considered.

Note3: In the JSON plugin, there is no way to extend, overwrite and exclude parameters/operates/events that have an existing object in the core tree.