Members
disable
Disable event triggers. The default state of the event trigger is true.
Example
var { Trigger } = require("sigma/trigger");
// Create listener function for event trigger
function callback1() {
print("this is test");
}
// Create an event trigger with type "tcConst.TC_START" and name "T_Start_Trigger".
var t = new Trigger(tcConst.TC_START, "T_Start_Trigger");
// Call listener function
t.setCallback(callback1);
// Enable event triggers.
t.enable();
// Disable event triggers.
t.disable();
// Get the status of the event trigger.
var mode = t.getMode();
print("The state of the trigger is: " + mode);
// If it executes successfully, it will return:
The state of the trigger is: false
enable
Enable event triggers. The default state of the event trigger is true.
Example
var { Trigger } = require("sigma/trigger");
// Create listener function for event trigger
function callback1() {
print("this is test");
}
// Create an event trigger with type "tcConst.TC_START" and name "T_Start_Trigger".
var t = new Trigger(tcConst.TC_START, "T_Start_Trigger");
// Call listener function
t.setCallback(callback1);
// Enable event triggers.
t.enable();
// Get the status of the event trigger.
var mode = t.getMode();
print("The state of the trigger is: " + mode);
// If it executes successfully, it will return:
The state of the trigger is: true
getMode
Gets the state of the event trigger. The default state of the event trigger is true.
Example
var { Trigger } = require("sigma/trigger");
// Create listener function for event trigger
function callback1() {
print("this is test");
}
// Create an event trigger with type "tcConst.TC_START" and name "T_Start_Trigger".
var t = new Trigger(tcConst.TC_START, "T_Start_Trigger");
// Call listener function
t.setCallback(callback1);
// Enable event triggers.
t.enable();
// Disable event triggers.
t.disable();
// Get the status of the event trigger.
var mode = t.getMode();
print("The state of the trigger is: " + mode);
// If it executes successfully, it will return:
The state of the trigger is: false
getName
Get the name of the event trigger. This name must be globally unique to the Total Control system.
Example
var { Trigger } = require("sigma/trigger");
// Create listener function for event trigger
function callback1() {
print("this is test");
}
// Create an event trigger object of type "tcConst.TC_START".
var t = new Trigger(tcConst.TC_START);
// Call listener function
t.setCallback(callback1);
// Set the name of the event trigger to ' T_Start_Trigger'.
t.setName("T_Start_Trigger");
// Get the name of the event trigger.
var name = t.getName();
print("Trigger name is :" + name);
// If it executes successfully, it will return:
Trigger name is :T_Start_Trigger
getSubtype
Get the event type of the trigger.
Example
var { Trigger } = require("sigma/trigger");
// Create listener function for event trigger
function callback1() {
print("this is test");
}
// Create an event trigger with type "tcConst.TC_START" and name "T_Start_Trigger".
var t = new Trigger(tcConst.TC_START, "T_Start_Trigger");
// Call listener function
t.setCallback(callback1);
// Get the event type of the event trigger.
var subtype= t.getSubtype();
print("The type of the trigger is: " + subtype);
// If it executes successfully, it will return:
The type of the trigger is: TC_START
setCallback
Add an event trigger listener function.
Example
// Example:The function callTest1, callTest2 is called when Total Control is connected to the phone.
var { Trigger } = require("sigma/trigger");
// Function: callTest1
function callTest1(device) {
print('callTest1: device ' + device.name + ' connect');
}
// Function: callTest2
function callTest2(device) {
print('callTest2: device ' + device.name + ' connect');
}
// Create an event trigger object of type "tcConst.DEV_CONNECT" with name "DeviceConnectTrigger".
var t = new Trigger(tcConst.DEV_CONNECT,"DeviceConnectTrigger");
// Call the function callTest1
t.setCallback(callTest1);
// Call the function callTest2
t.setCallback(callTest2);
// If it executes successfully, it will return:
callTest2: device HUAWEI-HUAWEI P7-L07 connect
callTest1: device HUAWEI-HUAWEI P7-L07 connect
setName
Set the event trigger name. This name must be globally unique to the Total Control system.
Example
var { Trigger } = require("sigma/trigger");
// Create listener function for event trigger
function callback1() {
print("this is test");
}
// Create an event trigger object of type "tcConst.TC_START".
var t = new Trigger(tcConst.TC_START);
// Call listener function
t.setCallback(callback1);
// Set the name of the event trigger to " my_T_Start_Trigger ".
t.setName("my_T_Start_Trigger");