Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info
iconfalse

Download the Solution Example here:

https://partners.tatsoft.com/dl/QkxlpsZ0Zy

AlarmTextToSpeech.dbsln


  
  • Solution Name: Alarm Text To Speech
Name: AlarmEmailAndSMS
  • Software Version:
10.1
  • v10
  • Keywords: Alarm. Text to Speech.

Summary

Alarms can be connected linked to scripts to run customized code whenever they are triggered. This solution example shows how to use scripts to voice an Alarm message.

Image Added


Technical Information

Every AlarmItem belongs to an AlarmGroup that specifies how Alarms are supposed to be presented

Each AlarmItem is part of an AlarmGroup, which defines how alarms should be displayed and acknowledged.

This

In this example

has two AlarmItems

, both

belonging to AlarmGroup Critical. To see how this AlarmGroup is configured, go

AlarmItems belong to the 'Critical' AlarmGroup. To view the configuration for this group, navigate to the Alarms

/ Groups table.

We

You can define a custom message to better describe the meaning of an AlarmItem. To do so, go to the Alarms

/ Items table and change the values in the Message column. In order to audibly play the custom message whenever an

AlarmItem

Alarm is triggered,

we

you first need to create a method with

our

your custom text-to-speech code. To do

this

so, go to Scripts

/ Classes and create a new class with the desired method. In this example, we have class ATSNotification set up with the following code:


Code Block
languagec#
//Pay attention to the function's parameter.
//It has to be like this to correctly connect with the AlarmGroup.
public void AlarmCustom(AlarmEventInfo[] items)
{
	if (items[0].State == 1)
	{
	    SpeechSynthesizer synth = new SpeechSynthesizer();
	
	    // Configure the audio output. 
	    synth.SetOutputToDefaultAudioDevice();
	
	    // Speak the message associated with the AlarmItem.
	    synth.Speak(items[0].Message);
    }
}


To make this method run whenever

one of the AlarmItems

an Alarm is triggered, you can go to the Alarms

/ Groups table, right-click the column titles and enable the NotificationMethod column. Then,

change

set its value to the method you created, which is ATSNotification.AlarmCustom in this case.


Reference Information

→ See Alarms (Audit Trail and Alerts) for more information on Alarms and how to set them up.

→ See Scripts (Tasks and Classes) to find out how scripts work and what more you can do with them.


In this section:

Page Tree
root@parent
spacesV10