Premise Use Flags to create better drivers.

Motorola Premise

123

Senior Member
When working with a native driver, ever notice that some objects cannot be deleted? Or you can't alter the object's name?

This behaviour is often seen in a native driver where the author has determined that it would be a bad idea to let the end-user rename "Port_1" to something else .. or delete it outright. Each object has a "Flags" property that defines its behaviour. The "Flags" property is accessible not only in native drivers, written in C++ with the HSDK, but also with Module-based drivers written in VBScript.

The list below is from the HSDK, and defines all possible attributes for the "Flags" property. The attributes are additive. If you want to prevent an end-user from renaming or deleting an object you add the following two attributes:
SVF_USER_NODELETE= 0x20000
SVF_USER_NOCHANGE_NAME= 0x100000
and use 0x120000 or 117968 (decimal)

Your code would use it like so:
Code:
' Assume oTmp is some object in your driver
oTmp.SetValue "Flags", 1179648

Code:
SVF_READONLY	= 0x1,
SVF_HIDDEN	= 0x2,
SVF_ARCHIVE	= 0x4,
SVF_SYSTEM	= 0x8,
SVF_DISABLED	= 0x10,
SVF_ALERTED	= 0x20,
SVF_LINK		= 0x40,
SVF_MODIFIED	= 0x80,
SVF_PROPERTY	= 0x100,
SVF_BINDABLE	= 0x200,
SVF_MOMENTARY	= 0x400,
SVF_PERSISTENT	= 0x800,
SVF_PERSISTENT_PROPERTY	= 0x800,
SVF_NONPERSISTENT_OBJECT	= 0x800,
SVF_TRACE	= 0x1000,
SVF_MARK	= 0x2000,
SVF_LOCAL	= 0x4000,
SVF_DEBUG	= 0x8000,
SVF_USER_NOCREATE	= 0x10000,
SVF_USER_NODELETE	= 0x20000,
SVF_USER_NOCOPY	= 0x40000,
SVF_USER_NOTRANSFORM	= 0x80000,
SVF_USER_NOCHANGE_NAME	= 0x100000,
SVF_USER_NOCHANGE_VALUE	= 0x200000,
SVF_USER_NOCHANGE_BINDABLE	= 0x400000,
SVF_USER_NOCHANGE_NONBINDABLE	= 0x800000,
SVF_SYSTEM_NOCREATE	= 0x1000000,
SVF_SYSTEM_NODELETE	= 0x2000000,
SVF_SYSTEM_NOCOPY	= 0x4000000,
SVF_SYSTEM_NOTRANSFORM	= 0x8000000,
SVF_SYSTEM_NOCHANGE_NAME	= 0x10000000,
SVF_SHARED_NODE	= 0x20000000,
SVF_FLAGS_ROOT		= 0x40000000,
SVF_PROPERTY_BAG	= 0x80000000

I've used "Flags" to prevent the end-user from renaming or deleting the single IR Receiver in the IRA driver and the 14 I/O Channels in the WeederTech driver. You don't have to use "Flags" but it can help to create a more robust driver.
 
Back
Top