Changes

4,340 bytes added ,  09:11, 23 August 2021
Created page with "===Example of description in XML=== <syntaxhighlight lang="xml" line> <item addr="100:245" back-rgba="0xff7100ff" iw-="1" length="5" name="aa" prf="prf('A: %d\10B: %ds dhjhfg..."
===Example of description in XML===

<syntaxhighlight lang="xml" line>
<item addr="100:245" back-rgba="0xff7100ff" iw-="1" length="5" name="aa" prf="prf('A: %d\10B: %ds dhjhfg hdfj dfhdfh', device(100, 247).status(0) $ 7, status(1))" sub-type="prf" text-rgb="0xffffff" title-rgb="0xff00" type="virtual"/>
</syntaxhighlight>

===Parameters===
{|class="wikitable"
|-
|-
!Name!!type and variety!!Description
|-
|iw||number;<br>1, 2, 3..||The width of text field
|-
|back-rgba||number;<br>0xRRGGBBAA||Text field background setting. RR – red saturation, 0..0хFF; GG – green saturation, 0..0xFF; BB – blue saturation, 0..0xFF; AA – background saturation, 0..0xFF
|-
|text-rgb||number;<br>0xRRGGBB||Text colour setting. RR – red saturation, 0..0хFF; GG – green saturation, 0..0xFF; BB – blue saturation, 0..0xFF.
|-
|title-rgb||number;<br>0xRRGGBB ||RR – red saturation, 0..0хFF; GG – green saturation, 0..0xFF; BB – blue saturation, 0..0xFF
|-
|prf||string;||Device status description.<br>Status is formatted as sprintf.<br>Status size should not exceed 256 bytes.<br>Only specified data is stored in the device, the text is not kept in the status. Detailed <br>description is below.
|}

===prf attribute description===

prf="prf('TEXT %[flags][wigth][.precision]type', STATUS)"

*TEXT – unchangeable text to be displayed;
*flags, wigth, precision, type – status formatting description, see sprintf.
*STATUS – status description
**id() – device id, u16
**subId() – device subId, u8
**addr() – device address, u32
**addrString() – device address textually
**statusStringHex() – device status string as hexadecimal notation
**statusString() – string with the device status
**statusString(u32 byteOffset = 0) – string with the device status with byteOffset offset
**statusString(u32 byteOffset=0, u32 len=0) – string with the device status with byteOffset offset and length len
**status() – device status, i8
**status(u32 byteOffset = 0) – device status with byteOffset offset, i8
**statusU() – device status, u8
**statusBit1Count() – number of status bit(?)
**statusRgb() – RGB status, 0xRRGGBB
**statusU16(u32 byteOffset=0) – device status, u16
**statusU32(u32 byteOffset=0) – device status, u32
**statusBit(u32 byteOffset=0, u32 bitOffset=0) – state of status bit with bitOffset offset, with byteOffset byte offset,
**statusBit(u32 bitOffset=0) – state of status bit with bitOffset offset
**statusBits(u32 byteOffset=0, u32 bitOffset=0, u32 len=0) – len bit status starting from bitOffset of byteOffset byte
**statusBits(u32 bitOffset=0, u32 len=0) – len bit status starting from bitOffset
**statusFloat() – status fractional (status/250)
**statusFloat() – status unsigned fractional (status/250)
**statusFloat2(u32 byteOffset=0) – status fractional (status/256)
**statusFloat2U(u32 byteOffset=0) – status unsigned fractional (status/256) with byteOffset offset
**statusFloat(u32 byteOffset=0) – status fractional (status/250) with byteOffset offset
**statusLevel() – level (for example, dimmer)
**statusFloatString() – string with status fractional (status/250)
**statusFloatString(u32 byteOffset = 0) – string with status fractional (status/250) with byteOffset offset
**statusFloatString2() – string with status fractional (status/256)
**statusFloatString2(u32 byteOffset=0) – string with status fractional (status/256) with byteOffset offset


It is also possible to specify the conditions, for example:

prf=" prf('Text%s', status(0)?'Yes':'No')

if status(0) is true "Text Yes" will be displayed, otherwise "Text No" appears

Or receive the devices status. For example, there is a curtain 343:22 and a lamp 299:1:

<syntaxhighlight lang="cpp" line>
prf="string a[] ={'Closed', 'Open', 'Is closing', 'Is opening'}; prf('Curtain%s\10Data %d \10Status: %s\10 String%s',a[device(343:22)->status(0)], status(0), (device(299:21)->status(0) $7)?'On':'Off',statusString(1))"
</syntaxhighlight>

Status setting for such an element is the following: setStatus(299:201,{134,"Text"});

After status setting in the text field the following will be displayed:

"Curtain is opening
Data 134
Status On
String Text"

"Curtain" will depend on curtain status,

"Status" will be "Off" if 0 byte with mask of 7 status 299:21 equals to zero, otherwise "Status" will be "On"