![Lightware MMX4x2 Series Скачать руководство пользователя страница 85](http://html1.mh-extra.com/html/lightware/mmx4x2-series/mmx4x2-series_user-manual_1915430085.webp)
7. LW3 Programmers’ Reference
MMX4x2 series – User's Manual
85
Applied firmware package: v1.6.0b19 | LDC software: v2.5.13b5
7.3.7.
Escaping
DEFINITION:
An escape sequence is a sequence of characters that does not represent itself when used
inside a character or string literal, but is translated into another character or a sequence of characters.
Property values and method parameters can contain characters that are used as control characters in the
protocol. They must be escaped. The escape character is the backslash (‘\’) and escaping means injecting
a backslash before the character that should be escaped (like in C language).
Control characters are the following: \ { } # % ( ) \r \n \t
The
original
message:
CALL /MEDIA/UART/P1:sendMessage(Set(01))
The
escaped
message:
CALL /MEDIA/UART/P1:sendMessage(Set\(01\))
7.3.8.
Signature
DEFINITION:
The signature is a four-digit-long hexadecimal value that can be optionally placed before
every command to keep a command and the corresponding responses together as a group.
Each line is terminated with carriage return (Cr, ‘\r’) and line feed (Lf, ‘\n’) characters. In several cases the
number of the lines in the response cannot be determined in advance, e.g. the client intends to receive the
whole response and also wants to be sure that the received lines belong together and to the same command.
In these cases a special feature, the ‘signature’ can be used. The response to that particular command will
also be preceded by the signature, and the corresponding lines will be between brackets:
ç
1700#GET /EDID.*
æ
{1700
æ
pr /EDID.EdidStatus=F89:E1;D1:E2;D1:E3;D1:E4;F89:E5
æ
m- /EDID:copy
æ
m- /EDID:delete
æ
m- /EDID:reset
æ
m- /EDID:switch
æ
m- /EDID:switchAll
æ
}
INFO:
The lines of the signature are also Cr and Lf terminated.
7.3.9.
Subscription
DEFINITION:
Subscription to a node means that the user will get a notification if a property of the node
changes.
A user can subscribe to any node. These notifications are asynchronous messages and are useful to keep
the client application up to date, without having to periodically poll the node to detect a changed property.
When the user does not want to be informed about the changes anymore, he can simply unsubscribe from
the node.
ATTENTION!
The subscriptions are handled separately for connections. Hence, if the connection is
terminated, all registered subscriptions are deleted. After reopening a connection all subscribe commands
have to be sent in order to get the notifications of the changes on that connection.
Subscribe to a Node
ç
OPEN /MEDIA/VIDEO
æ
o- /MEDIA/VIDEO
Subscribe to Multiple Nodes
ç
OPEN /MEDIA/VIDEO/*
æ
o- /MEDIA/VIDEO/*
Get the Active Subscriptions
ç
OPEN
æ
o- /MEDIA/VIDEO
æ
o- /EDID
æ
o- /DISCOVERY
7.3.10. Notifications about the Changes of the Properties
When the value of a property is changed and the user is subscribed to the node that the property belongs to,
an asynchronous notification is generated. This notification is called the ‘change message’. The format of
such a message is very similar to the response for the
GET
command:
æ
CHG /EDID.EdidStatus=F48:E1
A Short Example of How to Use the Subscription
There are two independent users controlling the device through two independent connections (
Connection #1
and
Connection #2
). The events in the rows occur after each other.
ç
OPEN /MEDIA/AUDIO/O3
æ
o- /MEDIA/AUDIO/O3
ç
GET /MEDIA/AUDIO/O3.VolumePercent
æ
pw /MEDIA/AUDIO/O3.VolumePercent=100.00
ç
GET /MEDIA/AUDIO/O3.VolumePercent
æ
pw /MEDIA/AUDIO/O3.VolumePercent=100.00
ç
SET /MEDIA/AUDIO/O3.VolumePercent=50.00
æ
pw /MEDIA/AUDIO/O3.VolumePercent=50.00
æ
CHG /MEDIA/AUDIO/O3.VolumePercent=50.00
The first user (
Connection #1
) set a subscription to a node. Later the other user (
Connection #2
) made a change,
and thanks to the subscription, the first user got a notification about the change.
Unsubscribe from a Node
ç
CLOSE /MEDIA/VIDEO
æ
c- /MEDIA/VIDEO
Unsubscribe from Multiple Nodes
ç
CLOSE /MEDIA/VIDEO/*
æ
c- /MEDIA/VIDEO/*
Connection #1
Connection #2
Connection #1
}
}