Actions

Difference between revisions of "External Data Input"

From Zenitel Wiki

(Additional information)
 
(42 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
{{AI}}
 +
The EDI ports are defined in AlphaPro: [[Exchange_%26_System_%28AlphaPro%29#Serial_Ports|Exchange & System -> Serial Ports]].
 +
* The input message must have a termination character
 +
* Maximum 128 characters. If longer strings, the first 128 characters will be returned, the rest will be ignored.
 +
* Parsing the content is done in the action string in the Event Handler
 +
 
==Event description==
 
==Event description==
 
+
{|
{| border="1" cellpadding="4"
+
|-
! align="left"|[[Event Owner]]:  
+
|width="200pt"|'''Event Owner''':
| EDI Text Config
+
|width="300pt"|EDI Text Config
 
|-
 
|-
! align="left"|[[Event Handler#Events Types - Grouped by Function|Event type]]:  
+
|'''Event type''': || 28 - External Data Input
| External Data Input
 
 
|-
 
|-
! align="left"|[[Sub-Event (Event Handler)|Sub-Event]]:
+
|'''Subevent''': || 1 – 10: specifies which EDI port<br>0: matches all ports
| 1 – 4: specifies which EDI port. 0: matches all ports
 
 
|-
 
|-
! align="left"|[[When Change to (Event Handler)|When Change to ON]]:  
+
|'''When change to ON''': || When valid data is received on EDI port
| When valid data is received on EDI port
 
 
|-
 
|-
! align="left"|[[When Change to (Event Handler)|When Change to OFF]]:  
+
|'''When change to OFF''': || N/A
| N/A
 
 
|-
 
|-
! align="left"|[[When Related to (Event Handler)|When Related to]]:
+
|'''When related to''': || N/A
| N/A
 
 
|-
 
|-
 
|}
 
|}
 +
<br>
  
*Input message
+
==Additional information==
:- The EDI port is defined in the ‘Serial Ports’ Setup
 
:- The input message must have a termination character. Max 128 char.
 
:- Parsing the content is done in the action string
 
 
 
 
*Context parameters
 
*Context parameters
:- %edi is the input text where termination character is excluded
+
:- [[edi (macro)|%edi]] is the input text where termination character is excluded
:- %sev is the EDI port (sub-event)
+
:- [[%sev]] is the EDI port (sub-event)
 
 
*Operator macros
 
:- %scutc(string,start-pos,lenght)
 
::* Extract substring by byte (character) position
 
::* Example: %scutc(0123456789,2,3) returns 234
 
::* Example: %scutc(%edi,4,3) returns 3 characters from the input string, starting from char 5
 
  
:- %scutf(string, delimiter, field-no)
+
*Useful macros and statements
::* Extract field, fields defined by delimiter character
+
:* [[%scutc]] - Extract substring by byte (character) position
::* delimiter is a single char, possibly escaped.  Example: Tab= \t  ‘,’ = \,
+
:* [[%scutf]] - Extract field, fields defined by delimiter character
::* Optionally followed by + sign to indicate that more than one delimiter character is allowed between fields
+
:* [[%strlen]] - Return length of string
::* field-no is a integer number, counting starts from zero!
+
:* [[%sscan]] - Scan for string, extract rest of string after first match
::* Example: %scutf(%edi, +,3) extract field number 3; fields separated by any number of spaces
+
:* [[%scmp]]  - Compare strings
::* Example: %scutf(%edi,\,,3)extract field number 3; fields separated by commas
+
:* [[Tmp_statement|TMP]]  - Set temporary variable
 +
:* [[%tmp]]  - Read temporary variable
  
:- %sscan(string, search-string)
+
{{note| The NUL character (ASCII 0x00) cannot be used in the EDI string. The processing of the string will be terminated when receiving NUL.}}
::* Scan for string, extract rest of string after first match
 
::* Example: If %sscan(%edi,connect) Check if text has the string “connect”
 
  
:- %scmp(string1,string2)
+
== Example ==
Compare strings. Return “1” if equal, empty string if not
+
When receiving the text string "Start alarm 3", terminated by Line Feed character, play alarm message 3 (8193) to group 85:
  
*Temporary variables
+
[[Image:EDI example.PNG|thumb|left|1200px|Trigger event by text string from external device]]
:-Temporary variables (strings), numbered 0 to 9
+
<br style="clear:both;" />
:-Lives only within the action string
 
:-Set temporary variable:      TMP 0 "<string>"
 
:-Read temporary variable:  %tmp(0)
 
  
*The rules below will allow you to issue commands to EDI port like this:
 
*connect,101,103
 
:-Generates internal <br\>command $CALL <br\>L101 L103
 
  
*disconnect,101,103
+
[[Category:Event Handler]]
:-Generates internal <br\>command $C L101 <br\>and $C L103
+
[[Category:Event types]]

Latest revision as of 09:39, 10 October 2023

AI.png

The EDI ports are defined in AlphaPro: Exchange & System -> Serial Ports.

  • The input message must have a termination character
  • Maximum 128 characters. If longer strings, the first 128 characters will be returned, the rest will be ignored.
  • Parsing the content is done in the action string in the Event Handler

Event description

Event Owner: EDI Text Config
Event type: 28 - External Data Input
Subevent: 1 – 10: specifies which EDI port
0: matches all ports
When change to ON: When valid data is received on EDI port
When change to OFF: N/A
When related to: N/A


Additional information

  • Context parameters
- %edi is the input text where termination character is excluded
- %sev is the EDI port (sub-event)
  • Useful macros and statements
  • %scutc - Extract substring by byte (character) position
  • %scutf - Extract field, fields defined by delimiter character
  • %strlen - Return length of string
  • %sscan - Scan for string, extract rest of string after first match
  • %scmp - Compare strings
  • TMP - Set temporary variable
  • %tmp - Read temporary variable
Note icon The NUL character (ASCII 0x00) cannot be used in the EDI string. The processing of the string will be terminated when receiving NUL.


Example

When receiving the text string "Start alarm 3", terminated by Line Feed character, play alarm message 3 (8193) to group 85:

Trigger event by text string from external device