SendMessage: To send custom message

Called to send a custom message through the named device with the contents in the data array.

Custom messages can be sent through the scripting API to send messages that do not conform to the standard Sym3messages structures. The data field is defined as an ASCII array.

Function

void SendMessage(deviceName: string, data: array);

Parameters

Name Type Description
deviceName String The name of the device to send this message
data Array ASCII array containing the message to be sent
deviceID integer A shortcut is available with SendMessage where it is not necessary to provide a Header, specifying the Device ID number instead.

Return Value

None

Example

SendMessage("A2E", StringToArray("Hello"));

// Convert a string to an array of ASCII value
// example: "ABC" will return [65, 66, 67]
function StringToArray(str) {
    var arr = str.split(''); 
    var result = new Array();
    for (var i = 0; i < arr.length; i++) {
        var ascii = arr[i].charCodeAt(0);
        result.push(ascii);
    }
    return result;
}