Introducing the Plugin Developer Documenter Plugin
This Indigo 6.0+ plugin allows plugin developers to examine and follow the lifecycle of calls that are available when developing an Indigo Plugin. The plugin is meant as a demonstration and learning tool for both new and experienced developers alike -- I learned a few new things just in doing this exercise, as was the point.
I have tried to thoroughly document the plugin's code so that you may easily follow what is going on and how to use a feature/callback in your own plugin should you find the need. I have attempted to document in the code where you must be sure to call the base class implementation lest you inadvertently break the lifecycle.
Usage
The plugin, by default, will simply log each function call / event that is executed within the plugin. To see the order of events simply use the plugin - create a new plugin device, open/close dialogs, press buttons within the dialogs, etc. This level of logging is fairly low since, as long as you are not actively using the plugin and devices, there are not many function calls.
If you want more details, you may turn on additional logging options in the plugin configuration dialog -- such as the parameter values for each of those function calls. Be warned, though, this will dump a LOT of data to your log when things such as devices are passed in to routines. You will want to use this when learning/debugging and then shut it off for normal use.
The plugin also demonstrates, and logs, the calls that you may receive when other Indigo objects (outside of your plugin) change, such as variables. These options may be turned on and off from the plugin configuration dialog as well. There is no way to unsubscribe to these changes, so when you are ready to stop subscribing to, say, all Indigo Variable changes, you will need to uncheck this box, save the change and then reload the plugin.
Plugin Devices / Dialogs
The plugin defines a single, custom device type and a nonsense device configuration just to demonstrate the various options that affect the lifecycle of the plugin. You will want to create one of these in order to view the lifecycle of calls around creation, starting, configuring, etc. a device. This device supports a couple of actions, again meant to allow you to trace the lifecycle that occurs when a plugin action executes.
A single event is also available that will allow you to examine how to create, register and execute custom Events and what that lifecycle entails.
Review / Improvement / Modification
If anyone sees anything missing from the documentation and plugin, some incorrectly documented information or has any other suggestions for improvement then please let me know! I will leave this thread open for discussion since I don't anticipate announcements of changes being a particularly big deal for this due to its intended audience.
I fully expect developers to take this plugin and change it to their needs or even use it as a basis of other plugins when learning or trying out new features... feel free to do so!
UPDATES
v1.1 - 5/29/2015
- Added population of the Address column in the device listing
- Added line numbers to debug output
- Added a Queue to handle asynchronous command / communication with the background thread