7. LW3 Programmers’ Reference
MMX4x2 series – User's Manual
111
Applied firmware package: v1.6.0b19 | LDC software: v2.5.13b5
7.11.5.
Scanning and Storing
This command can be used to get the value (or a part of the value) of an LW3 property. The defined path will
be scanned according to the pattern and the result will be the value of the variable (number or string type).
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:scanf(
<path>
.
<property>
;
<pattern>
)
æ
mO·/CTRL/VARS/V
<loc>
:scanf
Parameters
Parameter
Parameter description
Value
<loc>
The location of the variable
1-30
<path>
.
<property>
The LW3 property with node
<pattern>
The pattern that scans the property for the desired result
see below
Pattern options
Pattern
Pattern description
%s
String of characters stopping at the first whitespace character
%
<number>
s
The next <number> of characters (string) stopping at the first whitespace
%c
One character
%
<number>
c
The next <number> of characters
%[
<characters>
]
Defined characterset, specified between brackets
%[^
<characters>
]
Negated characterset, specified between brackets which will be skipped
%*
Ignored part
<custom_text>
User-defined text
The patterns can be combined to get the desired result as shown in the examples.
ATTENTION!
Do not forget to escape the % character as shown in below example.
Examples
ç
CALL /CTRL/VARS/V1:scanf(/MEDIA/AUDIO/XP.SourcePortStatus;\%5c)
æ
mO /CTRL/VARS/V1:scanf
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=T00AA
A simple pattern has been applied: we need the first five characters from the property value.
Further Examples
<path>.<property>
Property Value
<pattern>
Scanned result
/MANAGEMENT/STATUS.CpuTemperature 42 C; 0;75; 0;7
%s
42
/MANAGEMENT/STATUS.CpuFirmware
1.6.0b10 r96
%12s
1.6.0b10
/MEDIA/VIDEO/XP.DestinationPortStatus
T00AA;T00AF
%6c
T00AA
/MEDIA/UART/P1.Rs232Configuration
57600, 8N1
%*[^,], %s
8N1
/MEDIA/AUDIO/XP.SourcePortStatus
T000A;T000B;T000F
%*6c%5c
T000B
/MANAGEMENT/NETWORK.HostName
lightware-00005031
lightware-%[0-9]
00005031
7.11.6.
Reformatting a Value
The value of the variable can be changed by adding text as prefix and/or postfix.
ATTENTION!
Think about the length of the value: 15 characters are allowed, the others are truncated.
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:printf(
<prefix>
%s
<postfix>
)
æ
mO·/CTRL/VARS/V
<loc>
:printf
Parameters
Parameter
Parameter description
Value Value description
<loc>
The location of the variable
1-30
<prefix>
The text before the original value of the property (optional)
Custom
ASCII characters
%s
The original value of the variable
<postfix>
The text following the original value of the property (optional)
Custom
ASCII characters
Example
ç
GET /CTRL/VARS/V1.Value
ç
pw /CTRL/VARS/V1.Value=01
ç
CALL /CTRL/VARS/V1:printf(PWR%s)
æ
mO /CTRL/VARS/V1:printf
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=PWR01
The 'PWR' string has been inserted before the original value.