Versions Compared

Key

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

The StringToMsg method transforms converts a String variable into an a MsgObject object.

Method call syntax

Syntax for method invocation:

Code Block
function StringToMsg(msg : String) : MsgObject

Method arguments:

  1. msg

...

  1. is a required argument.

...

  1. It specifies a variable of the String type

...

  1. that you want to convert into a MsgObject object.

...

  1. Possible values:

...

  1. variables of the String type that match the syntax of the MsgObject objects representation:

"objtype|id|action|param1<value1>,param2<value2>…", where

  • objtype

...

  • is a type of system object

...

  • ;
  • id

...

  • is an identification number of a system object;
  • action

...

  • is an event or

...

  • reaction of a system object;
  • param1<value1>,param2<value2>

...

  • is a list of parameters

...

  • with their values. Elements of the list are separated by commas

...

  • without spaces. If no parameters need to be specified, an empty string is used after the vertical line (|), for example:

...

  • "CAM|1|MD_START|"

Usage examples

Problem. Upon an alarm in Example. On alarm from Sensor 1 or and 3, start recording audio from Microphone 1. Upon an On alarm in from Sensor 2 or 4, start recording audio from Microphone 2.

Code Block
languagejavascript
 if (Event.SourceType == "GRAY" && Event.Action == "ALARM")
{
 var audioid;
 if (Event.SourceId == "1" || Event.SourceId == "3")
 {
  audioid = "1";
 }
 if (Event.SourceId == "2" || Event.SourceId == "4")
 {
  audioid = "2";
 }
 var str = "OLXA_LINE|"+audioid+"|ARM|";
 var msg = CreateMsg();
 msg.StringToMsg(str);
 NotifyEvent(msg);
}