Common mistakes when creating a custom plugin.

by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero Employee</font></font> </a> dprodrig on ‎01-30-2015 04:39 PM - edited on ‎04-12-2017 05:28 PM by <a href="http://community.silabs.com/t5/Welcome-and-Announcements/Community-Ranking-System-and-Recognition-Program/m-p/140490#U140490"><font color="#000000"><font size="2">Hero Employee</font></font> </a> yuxiao

Question

Common mistakes for creating a custom plugin.

Answer

There is often a unique issue that comes up with a custom stack status callback for cluster related custom plugins. In the plugin.properties file you can implement a client stack status callback. However, you have to make sure that the name of this callback relates to the name of the plugin. For instance, if the plugin folder is called "custom-plugin", the stack status callback must be named "emberAfPluginCustomPluginStackStatusCallback".

 

In addition, if your custom plugin includes an init callback, the name of the init callback must relate to the name of the plugin. For example, if the plugin folder is called "custom-plugin", the plugin init callback function must be named "emberAfPluginCustomPluginInitCallback".

 

Some information on dependsOnClusterClient and dependsOnClusterServer:

 

* dependsOnClusterClient - comma separated list of client clusters required for this plugin to be enabled; if more than one cluster is listed, all of the clusters must be present for the plugin to be enabled; if server clusters are also defined, all client and server clusters must be included


* dependsOnClusterServer - comma separated list of server clusters required for this plugin to be enabled; if more than one cluster is listed, all of the clusters must be present for the plugin to be enabled; if client clusters are also defined, all client and server clusters must be included

 

When including non-custom callbacks for a custom plugin based off an already defined cluster you must use "emberAf" prefix for these callbacks in the callback.xml.
e.g
Will not work: myPrefixCustomPluginTunnelingClusterServerInitCallback, myPrefixCustomPluginTunnelingClusterServerTickCallback, myPrefixCustomPluginTunnelingClusterServerAttributeChangedCallback
Will work: emberAfCustomPluginTunnelingClusterServerInitCallback, emberAfCustomPluginTunnelingClusterServerTickCallback, emberAfCustomPluginTunnelingClusterServerAttributeChangedCallback