North plugin "operation" documentation is incorrect
jchabod opened this issue · comments
From https://fledge-iot.readthedocs.io/en/latest/plugin_developers_guide/04_north_plugins.html :
In section The plugin_register entry point
we can read the prototype for "operation" as:
void plugin_register(PLUGIN_HANDLE handle, (bool ( *write)(char *name, char *value, ControlDestination destination, ...), int (* operation)(char *operation, int paramCount, char *parameters[], ControlDestination destination, ...))
However, in north.cpp
we can see a different prototype.
static int controlOperation(char *operation, int paramCount, char *names[], char *parameters[], ControlDestination destination, ...)
It seems that "array-like" operation are now "object-like". Can you confirm (and update documentation?)
It seems very uncomfortable that the plugin API does not define an API version which could allow the plugin to check its compatibility.
For example, when looking to some specific implementations like https://github.com/fledge-power/fledge-north-iec104/ there is no way for the plugin to determine that the API changed and that the call to m_oper
will not lead a segfault. (this is the case)
At minimum the plugin_api.h
should provide the prototypes for every interfaces, including callbacks. (which would allow, at least to identify a prototype incompatibility, but clearly that is not enough), but clearly an interface version seems better
It looks like we have missed one of the arguments to the plugin_operation call in the documentation. This needs to be fixed.
The API version is contained within the block of data returned by plugin_info.
I will need to look into the prototypes, I thought that they were there.