 |
ALPHA-VISION® Functions: aci.Obj_GetFlag
|
aci.Obj_GetFlag
SUMMARY
Read single bits of a data object (status= or value) defined by a mask.
SYNTAX
aci.Obj_GetFlag(
(<object number>|<point id>),
<attr>,
<bitmask>)
ARGUMENTS
- object number (type:number)
-
A data object number
- point id (type:string)
-
The name of a data object
- attr (type:integer)
-
An identifier for the required attribute.
Use the global table DOATTR.
The names elements of DOATTR have the same names as the attributes in the display editor.
For a list of attributes see aci.Obj_QueryAttr.
- bitmask (type:integer)
-
Specifies the bits that shall be read.
RETURN VALUES
- 1 (type:integer)
-
Calculates a bitwise AND of the value of the requested attribute and the bitmask.
Then the significance of the LSD-Bit of the mask is set to bit 0 and the result is returned.
ERROR HANDLING
The function will fail and terminate script execution if strict error checking is enabled (see
aci.SetStrictMode()) and
one of the following conditions is met:
-
The given data object does not exist.
-
The value of the attribute cannot be retrieved.
The normal reason for this is that the data object does not have such an attribute.
If this occurs and strict checking is disabled the function returns
nil.
EXAMPLES
Bit 3 and bit 5 are retrieved and right-shifted
aci.Obj_SetVal("TEST_1", 49)
aci.Wait(1000)
assert(aci.Obj_GetFlag("TEST_1", DOATTR.Value, 40) == 4)
-- 49 = 00110001 Value
-- 40 = 00101000 Bit mask
-- 00100000 result befor redefining the significance.
-- 4 = 00000100 result after redefining the significance.
Syntax Notation
- [aaa]
- aaa is optional (zero or one occurences)
- (aaa|bbb)
- aaa exclusive or bbb
- (aaa)*
- aaa may occur indefinitely often or may be omitted
- (aaa)+
- aaa may occur indefinitely often but at least once
- (aaa)m..n
- aaa may occur from m to n times