Actions

Tetra - Text Alarms from AlphaCom

From Zenitel Wiki

AI.png
Sending text alarms to Tetra handsets via AlphaCom

This article describes how alarm inputs on a TKIE-2 kit (or inputs from any other device connected to the AlphaCom) can generate text messages/alarms in Tetra radios.

When an input is activated, AlphaCom will send AT commands via the EDO port to the Tetra gateway radio.

Tetra PEI AT commands

Communication between the AlphaCom and the Tetra Gateway radio is by serial link RS232, 9600 baud, No Parity, 1 Stop bit.

To send an SDS message these steps are needed:

  • Set the message type to SDS
  • Send the message

To set the message type, the command "AT+CTSDS" must be used. The following command sets the message type to TL-4 (AI service type 12), the "Called party ident type" to SSI (0):

at+ctsds=12,0


If we want to send the text "Hello world!" to ISSI 1001, we need to submit these commands:

at+cmgs=1001,128<CR><LF>


8202010148656C6C6F20776F726C6421<Ctrl-Z>


The first line "at+cmgs=1001,128" tells the radio that we want to send an SDS of 128 bits (= 16 bytes) to subsctiber 1001. The line must be terminated with CR + LF.

The second line in the data including TL-4 header:

  • "82020101" is the 4-byte TL-4 header:
    • 0x82: Protocol Identifier
    • 0x02: Message type: SDS-TRANSFER, Delivery report request: No DR requested, Service selection: Group or individual service, Store/forward control: No storage/forward
    • 0x01: Message reference number (should be upcounting with each new message, value from 0x00-0xff)
    • 0x01: Validity period: No validity period, Forward address type: SSI
  • "48656C6C6F20776F726C6421" is the text "Hello world!" in hex format. The line must be terminated with Ctrl+Z (0x1A).


AlphaCom configuration

The configuration is best described using the example from the drawing at the top of this article.

Four inputs on an TKIE-2 should generate the following messages:

  • Input 1: Fire Alarm
  • Input 2: Bilge Alarm
  • Input 3: Stat-X Alarm
  • Input 4: ICMS

The message should be sent to 12 different handsets, with ISSI numbers 10001 - 10012. The message must be sent to one handset at a time, with minimum 2 seconds interval between each message. The TKIE unit has directory number 102.


Note icon The LOG statements in the events below are included for debugging puposes only, and can be removed.



Serial port configuration

Configure the EDO port in Exchange & System > Serial ports:

Serial port setup: 9600 baud, No Parity, 8 data bits, 1 stop bit



Initialization at AlphaCom startup

When the AlphaCom is starting up after reboot/reset, initialization data is sent to the radio gateway. In addition the ISSI numbers (ID numbers) of the radio handsets are stored in UDD 1 and upwards. And a 60 second timer is started.

Event 27/65 is triggered when AlphaCom starts up


Action commands:

EDO 1 "AT+CTSDS=12,0\r\n"
WUDD 1 10001
WUDD 2 10002
WUDD 3 10003
WUDD 4 10004
WUDD 5 10005
WUDD 6 10006
WUDD 7 10007
WUDD 8 10008
WUDD 9 10009
WUDD 10 10010
WUDD 11 10011
WUDD 12 10012
$ST L102 W600 L9000
LOG "AlphaCom startup. Send initiation data to Tetra: AT+CTSDS=12,0. Store ISSI numbers in UDDs"



When the 60 second timer times out, it will again send initialization data to the radio gateway. This will repeat until the AlphaCom receives an "AT OK" message from the radio, which is a confirmation that the initialization was successful.

Resend initialization data every 60 seconds


Action commands:

EDO 1 "AT+CTSDS=12,0\r\n"
$ST L102 W600 L9000
LOG "Sending initialization data to the radio gateway"



The timer will be stopped when AlphaCom receives an "AT OK" message from the radio, and no further initialization data will be sent until next time the AlphaCom is reset. After a reset the initialization process will be repeated.

When "AT OK" is received from the radio gateway, stop the timer that triggers resending of initialization data


Action commands:

LOG "Received from Tetra: %scutc(%edi,0,100)...."
IF %scmp(%scutc(%edi,0,2),OK)
LOG "AT OK received from Tetra. Stopping initialization of radio"
$ST L102 W0 L9000
ENDIF


Input event

The inputs of the TKIE-2 will trigger event 30, subevent 11-14, when activated.

Event triggered by input activation


Action commands:

$ST L102 W1 L%sev01
LOG "Input %SEV %chg(ON,OFF)"



%sev returns the input number (11 - 14). The event will trigger a 0.1 sec timer, with a "Counter" value ("Related To Number") 1101, 1201, 1301 or 1401, depending on which input was triggered.

When the timer times out, it will trigger Event 21 in the next section.

Sending AT commands

Before the AT Commands can be entered in the event handler, we need to calculate the number of bits in each of the text messages. The number of bits (found in the rightmost column below) is used as a parameter in the "at+cmgs" command to the radio.

TKIE Input DAK # Counter Alarm text Alarm text - Ascii hex # bytes (bits) in alarm text # bits, incl 4-byte (32 bits) TL-4 header
1 11 1101-1112 Fire Alarm 4669726520416C61726D 10 (80) 112
2 12 1201-1212 Bilge Alarm 42696C676520416C61726D 11 (88) 120
3 13 1301-1312 Stat-X Alarm 537461742D5820416C61726D 12 (96) 128
4 14 1401-1412 ICMS 49434D53 4 (32) 64


The following event will loop at 2.5 seconds intervals, one time for each handset. For every loop the "Counter" is increased by 1. The ISSI number is fetched from the UDD according to the last two digits of the counter.

Event triggered by input activation


Action commands:

IF %op(%2.dir,>=,1101)
IF %op(%2.dir,<=,1112)
EDO 1 "AT+CMGS=%udd(%2.dir(2)),112\r\n"
EDO 1 "8202%2.dir(2)014669726520416C61726D\x1A"
LOG "AT+CMGS=%udd(%2.dir(2)),112\r\n"
LOG "8202%2.dir(2)014669726520416C61726D\x1A"
IF %op(%op(%2.dir(2),+,1),>,12)
LOG "Finished sending FIRE ALARM to all 12 radios"
STOP
ENDIF
LOG "Sending to next radio #%udd(%op(%2.dir(2),+,1)) in 2.5 seconds"
$ST L%1.dir W25 L%op(%2.dir,+,1)
ENDIF
ENDIF
IF %op(%2.dir,>=,1201)
IF %op(%2.dir,<=,1212)
EDO 1 "AT+CMGS=%udd(%2.dir(2)),120\r\n"
EDO 1 "8202%2.dir(2)0142696C676520416C61726D\x1A"
LOG "AT+CMGS=%udd(%2.dir(2)),120\r\n"
LOG "8202%2.dir(2)0142696C676520416C61726D\x1A"
IF %op(%op(%2.dir(2),+,1),>,12)
LOG "Finished sending BILGE ALARM to all 12 radios"
STOP
ENDIF
LOG "Sending to next radio #%udd(%op(%2.dir(2),+,1)) in 2.5 seconds"
$ST L%1.dir W25 L%op(%2.dir,+,1)
ENDIF
ENDIF
IF %op(%2.dir,>=,1301)
IF %op(%2.dir,<=,1312)
EDO 1 "AT+CMGS=%udd(%2.dir(2)),128\r\n"
EDO 1 "8202%2.dir(2)01537461742D5820416C61726D\x1A"
LOG "AT+CMGS=%udd(%2.dir(2)),128\r\n"
LOG "8202%2.dir(2)01537461742D5820416C61726D\x1A"
IF %op(%op(%2.dir(2),+,1),>,12)
LOG "Finished sending STAT-X ALARM to all 12 radios"
STOP
ENDIF
LOG "Sending to next radio #%udd(%op(%2.dir(2),+,1)) in 2.5 seconds"
$ST L%1.dir W25 L%op(%2.dir,+,1)
ENDIF
ENDIF
IF %op(%2.dir,>=,1401)
IF %op(%2.dir,<=,1412)
EDO 1 "AT+CMGS=%udd(%2.dir(2)),64\r\n"
EDO 1 "8202%2.dir(2)0149434D53\x1A"
LOG "AT+CMGS=%udd(%2.dir(2)),64\r\n"
LOG "8202%2.dir(2)0149434D53\x1A"
IF %op(%op(%2.dir(2),+,1),>,12)
LOG "Finished sending ICMS to all 12 radios"
STOP
ENDIF
LOG "Sending to next radio #%udd(%op(%2.dir(2),+,1)) in 2.5 seconds"
$ST L%1.dir W25 L%op(%2.dir,+,1)
ENDIF
ENDIF