Class AbstractTriggerType2
public abstract class AbstractTriggerType2 : AbstractTriggerType
Inherited Members
Namespace: HomeSeer.PluginSdk.Events
Assembly: PluginSdk.dll
The base implementation of a plugin trigger type available for users to select in HomeSeer
The difference between AbstractTriggerType2 and AbstractTriggerType, is that with AbstractTriggerType2 only a collection of view Id/Value pairs is stored in database whereas with AbstractTriggerType the whole ConfigPage is stored. This allows the plugin to build the views in OnInstantiateTrigger(Dictionary<String, String>) every time a trigger is instantiated.
Inherit from this class to define your own trigger types and store them in your plugin's TriggerTypeCollection
Constructors
View SourceAbstractTriggerType2()
Initialize a new, unconfigured AbstractTriggerType2
This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.
Declaration
protected AbstractTriggerType2()
AbstractTriggerType2(TrigActInfo, TriggerTypeCollection.ITriggerTypeListener, Boolean)
Initialize a new AbstractTriggerType2 from a TrigActInfo and with the specified listener, and logDebug flag.
The byte array in trigInfo
will be automatically parsed to a collection of view Id/Value pairs,
and OnInstantiateTrigger(Dictionary<String, String>) will be called.
This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.
You MUST implement one of these constructor signatures in any class that derives from AbstractTriggerType2
Declaration
protected AbstractTriggerType2(TrigActInfo trigInfo, TriggerTypeCollection.ITriggerTypeListener listener, bool logDebug = false)
Parameters
Type | Name | Description |
---|---|---|
TrigActInfo | trigInfo | The TrigActInfo containing all the trigger information |
TriggerTypeCollection.ITriggerTypeListener | listener | The listener that facilitates the communication with AbstractPlugin |
System.Boolean | logDebug | If true debug messages will be written to the console |
AbstractTriggerType2(Int32, Int32, Int32, Byte[], TriggerTypeCollection.ITriggerTypeListener)
Initialize a new AbstractTriggerType2 with the specified ID, Event Ref, Data byte array and listener. The byte array will be automatically parsed to a collection of view Id/Value pairs, and OnInstantiateTrigger(Dictionary<String, String>) will be called.
This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.
You MUST implement one of these constructor signatures in any class that derives from AbstractTriggerType2
Declaration
protected AbstractTriggerType2(int id, int eventRef, int selectedSubTriggerIndex, byte[] dataIn, TriggerTypeCollection.ITriggerTypeListener listener)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The unique ID of this trigger in HomeSeer |
System.Int32 | eventRef | The event reference ID that this trigger is associated with in HomeSeer |
System.Int32 | selectedSubTriggerIndex | The 0 based index of the sub-trigger type selected for this trigger |
System.Byte[] | dataIn | A byte array containing the definition for a Page |
TriggerTypeCollection.ITriggerTypeListener | listener | The listener that facilitates the communication with AbstractPlugin |
AbstractTriggerType2(Int32, Int32, Int32, Byte[], TriggerTypeCollection.ITriggerTypeListener, Boolean)
Initialize a new AbstractTriggerType2 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 OnInstantiateTrigger(Dictionary<String, String>) will be called.
This is called through reflection by the TriggerTypeCollection class if a class that derives from this type is added to its list.
You MUST implement one of these constructor signatures in any class that derives from AbstractTriggerType2
Declaration
protected AbstractTriggerType2(int id, int eventRef, int selectedSubTriggerIndex, byte[] dataIn, TriggerTypeCollection.ITriggerTypeListener listener, bool logDebug = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | The unique ID of this trigger in HomeSeer |
System.Int32 | eventRef | The event reference ID that this trigger is associated with in HomeSeer |
System.Int32 | selectedSubTriggerIndex | The 0 based index of the sub-trigger type selected for this trigger |
System.Byte[] | dataIn | A byte array containing the definition for a Page |
TriggerTypeCollection.ITriggerTypeListener | listener | The listener that facilitates the communication with AbstractPlugin |
System.Boolean | logDebug | If true debug messages will be written to the console |
Methods
View SourceGetData()
Declaration
override byte[] GetData()
Returns
Type | Description |
---|---|
System.Byte[] |
Overrides
View SourceOnInstantiateTrigger(Dictionary<String, String>)
Called when a trigger 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 trigger, so initialize the ConfigPage to the trigger'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 triggerDeclaration
protected abstract void OnInstantiateTrigger(Dictionary<string, string> viewIdValuePairs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | viewIdValuePairs |
OnNewTrigger()
Called when a new trigger of this type is being created. Initialize the ConfigPage to the trigger's starting state so users can begin configuring it.
You must create a new Page with a unique ID provided by PageId and be of the type EventTrigger. 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.
If no page is set, a blank page will be auto initialized.
Declaration
protected override void OnNewTrigger()
Overrides
Remarks
With AbstractTriggerType2 there is no need to override this method. OnInstantiateTrigger(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[] |