Premise Use "Transformable" to allow an object to morph.

Motorola Premise

123

Senior Member
There's a very useful behaviour in Premise drivers that took me awhile to figure out how it's done. I'm referring to the ability to allow an end-user to choose an object's class. For example, the attached image shows that you can choose if the object "X10_A_01" is an X10_Button, or X10_Motion_Sensor, or X10_Appliance, or etc.

How do you code your driver to allow the end-user to change an object's class? Well, there's nothing in Builder that lets you do that!

I'll use the WeederTech driver as an example. An I/O Channel can be either an Input or an Output. In Builder, you define the Channel class as Virtual (i.e. it is a base class that other classes inherit). You define the Input and Output to inherit from the Channel class. So far so good, but how do let the Channel class know that it can be either an Input or an Output? As I said, not from within Builder!

Export your Module and open the XDO with a text-editor. Find your base class, that's Channel in this example, and append the following property to its definition: Transformable="-1"
Here's a fragment of the WeederTech XDO file showing the Channel class and the Transformable property:
Code:
<Object ID="{9A046AC2-55E4-447E-AA75-6A13CD942C7D}" Name="Channel" Class="sys://Schema/System/Class" Description="Base class for all PLCDevices" Virtual="-1" Transformable="-1" >

I used the same technique in my ELK M1 driver. A PLCDevice can be either a Dimmer or an Appliance. Dimmer and Appliance inherit from the base class PLCDevice and it is tagged as being Transformable.
 

Attachments

  • Select_Class.png
    Select_Class.png
    51.9 KB · Views: 29
Back
Top