Class AbstractActionType2
public abstract class AbstractActionType2 : AbstractActionType
Inherited Members
Namespace: HomeSeer.PluginSdk.Events
Assembly: PluginSdk.dll
The base implementation of a plugin action type available for users to select in HomeSeer
The difference between AbstractActionType2 and AbstractActionType, is that with AbstractActionType2 only a collection of view Id/Value pairs is stored in database whereas with AbstractActionType the whole ConfigPage is stored. This allows the plugin to build the views in OnInstantiateAction(Dictionary<String, String>) every time an action is instantiated.
Inherit from this class to define your own action types and store them in your plugin's ActionTypeCollection
Constructors
View SourceAbstractActionType2()
Initialize a new, unconfigured AbstractActionType2
This is called through reflection by the ActionTypeCollection class if a class that derives from this type is added to its list.
Declaration
protected AbstractActionType2()
AbstractActionType2(Int32, Int32, Byte[], ActionTypeCollection.IActionTypeListener)
Initialize a new AbstractActionType2 with the specified ID, Event Ref, and Data byte array. The byte array will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateAction(Dictionary<String, String>) will be called.
This is called through reflection by the ActionTypeCollection class if a class that derives from this type is added to its list.
You MUST implement one of these constructors in any class that derives from AbstractActionType2
Declaration
protected AbstractActionType2(int id, int eventRef, byte[] dataIn, ActionTypeCollection.IActionTypeListener listener)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The unique ID of this action in HomeSeer |
System.Int32 | eventRef | The event reference ID that this action is associated with in HomeSeer |
System.Byte[] | dataIn | A byte array containing a collection of view Id/Value pairs |
ActionTypeCollection.IActionTypeListener | listener | The listener that facilitates the communication with AbstractPlugin |
AbstractActionType2(Int32, Int32, Byte[], ActionTypeCollection.IActionTypeListener, Boolean)
Initialize a new AbstractActionType2 with the specified ID, Event Ref, Data byte array, listener, and logDebug flag. The byte array will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateAction(Dictionary<String, String>) will be called
This is called through reflection by the ActionTypeCollection class if a class that derives from this type is added to its list.
You MUST implement one of these constructors in any class that derives from AbstractActionType2
Declaration
protected AbstractActionType2(int id, int eventRef, byte[] dataIn, ActionTypeCollection.IActionTypeListener listener, bool logDebug = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The unique ID of this action in HomeSeer |
System.Int32 | eventRef | The event reference ID that this action is associated with in HomeSeer |
System.Byte[] | dataIn | A byte array containing a collection of view Id/Value pairs |
ActionTypeCollection.IActionTypeListener | listener | The listener that facilitates the communication with AbstractPlugin |
System.Boolean | logDebug | If true debug messages will be written to the console |
AbstractActionType2(Int32, Int32, Int32, Byte[], ActionTypeCollection.IActionTypeListener)
Initialize a new AbstractActionType2 with the specified ID, SubType number, Event Ref, Data byte array and listener. The byte array will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateAction(Dictionary<String, String>) will be called
This is called through reflection by the ActionTypeCollection class if a class that derives from this type is added to its list.
You MUST implement one of these constructors in any class that derives from AbstractActionType2
Declaration
protected AbstractActionType2(int id, int subTypeNumber, int eventRef, byte[] dataIn, ActionTypeCollection.IActionTypeListener listener)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The unique ID of this action in HomeSeer |
System.Int32 | subTypeNumber | The action subtype number |
System.Int32 | eventRef | The event reference ID that this action is associated with in HomeSeer |
System.Byte[] | dataIn | A byte array containing a collection of view Id/Value pairs |
ActionTypeCollection.IActionTypeListener | listener | The listener that facilitates the communication with AbstractPlugin |
Methods
View SourceGetData()
Declaration
override byte[] GetData()
Returns
Type | Description |
---|---|
System.Byte[] |
Overrides
View SourceOnInstantiateAction(Dictionary<String, String>)
Called when an action of this type is being instantiated. Create the ConfigPage according to the values passed as parameters. If no value is passed it means it's a new action, so initialize the ConfigPage to the action's starting state so users can begin configuring it.
Any JUI view added to the ConfigPage must use a unique ID as it will be displayed on an event page that could also be housing HTML from other plugins. It is recommended to use the PageId as a prefix for all views added to ensure that their IDs are unique.
View Id/Value pairs containing the existing values for this actionDeclaration
protected abstract void OnInstantiateAction(Dictionary<string, string> viewIdValuePairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | viewIdValuePairs |
OnNewAction()
Called when a new action of this type is being created. Initialize the ConfigPage to the action's starting state so users can begin configuring it.
Initialize a new ConfigPage and add views to it so the user can configure the trigger. Any JUI view added to the ConfigPage must use a unique ID as it will be displayed on an event page that could also be housing HTML from other plugins. It is recommended to use the PageId as a prefix for all views added to ensure that their IDs are unique.
Declaration
protected override void OnNewAction()
Overrides
Remarks
With AbstractActionType2 there is no need to override this method. OnInstantiateAction(Dictionary<String, String>) will be called instead, with an empty Dictionary as parameter.
ProcessData(Byte[])
Declaration
override byte[] ProcessData(byte[] inData)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | inData |
Returns
Type | Description |
---|---|
System.Byte[] |