Article contents:


Logic schemes are used to program automatic actions in the system depending on the events occurring.

Logic control is possible only with the permission of "logic" or "all" in the profile of the user performing the request.

Description of logic schemes

When you send a request for a change or creation of a logical scheme, a scheme description is sent. The format of this description is as follows:

(SENSORID OLDSTATE-NEWSTATE OPERATOR ...){SENSORID1:TIMEOUT,[REPEAT] NEWSTATE2 OPERATOR2 ...}
Where:

State codes:

Operator Codes:

Logic scheme management


For management of logic schemes, the following types of requests are used (passed in the querytype field):


addlogic - add / change logic. Extra options are:

If the new logic scheme is successfully created, the response contains the identifier of the created element (field id) and the identifier of the logical scheme (field num), and looks like:

<error type="no error" id="503001" num="3" />

When creating a new logical scheme (id is not specified), all the listed parameters are mandatory. When changing, only modifiable parameters can be specified. Empty parameters are not allowed.


getelement - reading of the element is associated with the logic scheme. Required parameters:

The answer contains information about the element:

<element id="503001" module="2001" num="1" clas="devirt" type="logic" name="logik1" state="normal" desc="(100 4-4){301001:0 5}" timeout="0" disabled="0" />

It contains the following fields:


getlogic - get information about the logical scheme. Extra options are:


Example of a response to a query of a logic scheme with the identifier '3':


<syslogic>
    <logic id="3" name="Logic scheme My" disabled="0">
        <if element="201010" old="alarm" new="alarm" operator="and"></if>
        <if element="301011" old="not connected" new="not connected" operator="end"></if>
        <then element="401004" new="pulse" timeout="0"></then>
        <then element="501003" new="on" timeout="30"></then>
    </logic>
</syslogic>


dellogic - delete information about the logical scheme. Extra options are:


disablelogic - disable the execution of the logical scheme. Extra options are:


onlogics - enable the execution of all logical schemes. Extra options are:


offlogics - disable execution of all logical schemes. Extra options are:


Element "System" in logic schemes

The "System" element corresponds to the state of the entire system. It can be used in logic schemes. The identifier of this element is fixed and equal to "100". When using this element in conditions for logic schemes, state codes can be as follows:

Code 'on' means turning on the system (system start).

When using the "System" element to perform the forced reboot task, the status code is: