Class: Alert

Alert

Alerts allow defining a critical information to be raised and sent by email.

There are several types of Alert for (remote) devices:
  • Device disconnected: Communication with the RFID board is lost
  • Door open delay: Device has been open for too long
  • Temperature: A temperature measure is out of the defined limits
  • Thief finger: Device has been open with an anti-thief finger

Constructor

new Alert(alertType, to, cc, bcc, emailSubject, emailContent, enabled)

Alert default constructor.
Parameters:
Name Type Description
alertType AlertType Type of Alert (AlertType value).
to string List of email addresses (split with commas) to send the alert to.
cc string List of "Cc" recipients (split with commas).
bcc string List of "Bcc" recipients (split with commas).
emailSubject string Subject of the email to be sent.
emailContent string Content of the email to be sent.
enabled boolean If false, the alert will not be used by the device.

Methods

(static) deserialize(xmlData) → {Alert|AlertTemperature|null}

Create a new Alert (or AlertTemperature) instance from a serialized one.
Parameters:
Name Type Description
xmlData Serialized Alert (xml format).
Returns:
Deserialized Alert. Or null if the serialized data is invalid.
Type
Alert | AlertTemperature | null

getAlertType() → {AlertType}

Returns:
Alert type.
Type
AlertType

getBccList() → {string}

Returns:
"Bcc" recipients list.
Type
string

getCcList() → {string}

Returns:
"Cc" recipients list.
Type
string

getEmailContent() → {string}

Returns:
Email content.
Type
string

getEmailSubject() → {string}

Returns:
Email subject.
Type
string

getToList() → {string}

Returns:
"To" recipients list.
Type
string

isEnabled() → {boolean}

Returns:
True if the alert is enabled, false otherwise.
Type
boolean

serialize() → {string}

Format the internal data as an XML string and encode it with base64.
Returns:
The base64 encoded XML Alert.
Type
string

setBccList(list)

Change the list of recipients for the "Bcc" field.
Parameters:
Name Type Description
list string List of recipients, separated by commas.

setCcList(list)

Change the list of recipients for the "Cc" field.
Parameters:
Name Type Description
list string List of recipients, separated by commas.

setEmailContent(content)

Change the content of the email sent when the alert is raised.
Parameters:
Name Type Description
content string New content

setEmailSubject(subject)

Change the subject of the email sent when the alert is raised.
Parameters:
Name Type Description
subject string New subject

setEnabled(isEnabled)

Allow enabling/disabling an alert.
Parameters:
Name Type Description
isEnabled boolean If true, enables the alert. If false, disables the alert.

setToList(list)

Change the list of recipients for the "To" field.
Parameters:
Name Type Description
list string List of recipients, separated by commas.