This module provides system-level device control functionalities for Total Control environments.
It enables interaction with Android devices via JavaScript, offering APIs for device status querying, system configuration, screen control, and command execution.
Key Features:
- Retrieve device properties: name, battery, screen orientation, IP, clipboard, brightness, volume, etc.
- Modify device settings: clipboard content, brightness, input method, volume levels, and Wi-Fi state.
- Control screen behavior: lock, unlock, sleep, wakeup.
- Execute shell and ADB commands on connected devices.
- Support for both single device and multiple device operations (
DeviceandDeviceArray). - Utility functions for getting cursor coordinates, SD card path, temp path, and display mode.
ADB Integration:
- Automatically detects and executes ADB commands via configured path.
- Supports SN-based device targeting and command chaining.
Basic Usage:
- Import the module via
require("sigma/system"). - Get a device object using
Device.getMain()orDevice.searchObject(). - Use methods like
get(),set(),exec(),adb()directly on the device instance.
Example APIs:
device.get("text:clipboard"): Read clipboard contentdevice.set("wifi:enable", true): Enable Wi-Fidevice.exec("ls /sdcard"): Execute a shell commanddevice.adb("shell pm list packages"): Run an ADB commanddevice.sleep(),device.unlock(),device.wakeup(): Manage device screen state
This module attaches methods to Device.prototype and DeviceArray.prototype,
and exposes ADB functions separately.
Methods
(static) adb(adbCommand) → {string|null}
Executes an ADB command on the current device.
Example
// Example: List all installed package names on the device
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.adb("shell pm list packages");
if (ret != null) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value:
package:com.huawei.camera
package:com.huawei.android.launcher
package:com.android.mediacenter
...
Parameters:
| Name | Type | Description |
|---|---|---|
adbCommand |
string | The adb shell command to be executed (e.g., |
Returns:
Successfully returns the result of executing the adb command; if the execution fails, you can get the specific error information through the lastError() function.
- Type
- string | null
(static) displayMode() → {number|null}
Get the display mode of the device, that is, whether the device is in the Total Control or the window mode.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
// Execute this JS API
var ret = sigmaDevice.displayMode();
if (ret === 1 || ret === 2) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
Returns:
Returns 1 or 2 on success:
1: means WDM mode, window mode;2: means MDCC mode, multi-control center;
Returnsnullon failure. UselastError()to get the error message.
- Type
- number | null
(static) exec(command, timeoutopt) → {string|null}
The command is executed synchronously on the device shell console. A synchronous call is a command execution method that can be executed in a short time and does not require user interaction. Such as ls, cat, etc.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
// Execute a shell command
var ret = sigmaDevice.exec("ls -l /sdcard/aa/", 3000);
if (ret != null) {
print("Congratulations, this API executes successfully.\nReturn value: \n" + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result Example:
-rwxrwx--- root sdcard_r 79749 2019-04-16 13:15 image0.png
-rwxrwx--- root sdcard_r 54699 2019-04-16 13:15 image10.jpg
-rwxrwx--- root sdcard_r 34 2019-04-29 10:53 test2.txt
-rwxrwx--- root sdcard_r 17 2019-04-29 10:53 test3.txt
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
command |
string | The command that needs to be executed. (e.g., |
|
timeout |
number |
<optional> |
Timeout (milliseconds). |
Returns:
Successfully returns the result of executing the command; if the execution fails, you can get the specific error information through the lastError() function.
- Type
- string | null
(static) get(type) → {*}
Gets system or device information by a specific type key.
This method supports querying a wide range of runtime values such as clipboard content,
network information, volume level, brightness, IME list, and device display or build properties.
-
- Get the contents of the device clipboard
String, returns the contents of the clipboard
- Get the contents of the device clipboard
-
- Get the IP of the device
String, returns the IP of the device
- Get the IP of the device
-
- Get the device wireless communication
Boolean: returns true or false, false means off, true means on.
- Get the device wireless communication
-
- Get device volume
Int, returns the volume value of the specified type
- Get device volume
-
- Get device brightness
Int, return device
- Get device brightness
-
- Get device ime
An array of strings, returns the ime name.
- Get device ime
-
- Get the acceleration mode of the device
Int, returns acceleration mode of the device, the details are as follows:
1 – indicates that the device acceleration is HA1;
2 – indicates that the device acceleration is HA2;
3 – indicates that the device acceleration is Comp;
- Get the acceleration mode of the device
-
- Get the display quality of the device
Constant value, returns the display quality of the device, the details are as follows:
1 - High
2 - Medium
3 - Low
- Get the display quality of the device
-
- Get computer acceleration mode
Constant value, returns computer acceleration mode, the details are as follows:
1 – GDI
2 – DirectX
3 - OpenGL
- Get computer acceleration mode
-
- Get whether to use hardware decoding
Int, returns whether to use hardware decoding, the details are as follows:
1 – Yes
0 – No
- Get whether to use hardware decoding
-
- Get the resolution mode displayed by the device
Int, returns resolution mode, the details are as follows:
1 - 480p
2 - 640p
3 - 720p
4 - 1080p
- Get the resolution mode displayed by the device
-
- Get the display direction of the device
Int, returns the display direction of the device, the details are as follows:
1 – Portrait; (vertical screen)
2 – Landscape; (horizontal screen)
- Get the display direction of the device
-
- Get the width and height of the device screen
String, returns the width and height of the device screen, for example: {h: 1920, w: 1080}
- Get the width and height of the device screen
-
- Get H.264 configuration file name and level
Only the acceleration mode 1 and acceleration mode 2 of the device are H.264. When the device's acceleration mode is "High Compatibility", it is not H.264, the value cannot be obtained, null is returned, and error message can be obtained through lastError()
Int, returns the H.264 configuration file name and level, the details are as follows:
1 - base;
2 - main;
8 - high;
- Get H.264 configuration file name and level
-
- Get build type
String, returns build type, the details are as follows:
cn - China
us - international
- Get build type
Example
// Example 1: Get clipboard content
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var ret = sigmaDevice.get("text:clipboard");
if (ret != null) {
print("The contents of the clipboard are \"" + ret + "\"");
} else {
print("Failed to get. Error: " + lastError());
}
// Example 2: Get device IP
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var ip = sigmaDevice.get("Network:IP");
print("The device IP is \"" + ip + "\"");
// Example 3: Check if Wi-Fi is enabled
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var wifiStatus = sigmaDevice.get("wifi:enable");
print(wifiStatus === true ? "The wifi is open" : "The wifi is close");
// Example 4: Get ring volume
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var volume = sigmaDevice.get("sound:volume:ring");
print("The ring volume is " + volume);
// Example 5: Get brightness
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var brightness = sigmaDevice.get("display:brightness");
print("The brightness is " + brightness);
// Example 6: Get IME list
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var imeList = sigmaDevice.get("ime:allList");
print("Input methods:\n" + imeList);
// Example 7: Get device display info
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
print("Display mode: " + sigmaDevice.get(tcConst.DisplayMode));
print("Display quality: " + sigmaDevice.get(tcConst.DisplayQuality));
var resolution = sigmaDevice.get(tcConst.DisplayResolution);
print("Screen size: " + resolution.w + "x" + resolution.h);
// Example 8: Get build country code
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var countryCode = sigmaDevice.get(tcConst.BuildCountryCode);
print("Build country code: " + countryCode);
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The key specifying what value to get. |
Returns:
The queried value. Type depends on the query:
- string for text values (clipboard, IP, IME list, build info)
- number for numeric values (volume, brightness, display quality)
- boolean for flags (Wi-Fi enabled)
- object for complex data (e.g., resolution { w, h }, H.264 profile { name, level })
- null if the query fails. Use lastError() for details.
- Type
- *
(static) getAcceleration() → {number}
Get the rendering mode used by the device.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
// Execute this JS API
var ret = sigmaDevice.getAcceleration();
if (ret !== -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
//Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 1
Returns:
Successfully returns the rendering mode(0,1,2) of the device:
0: means "GDI";1: means "D3D";2: means "OpenGL".
If the execution fails, you can get the specific error information through the lastError() function.
- Type
- number
(static) getCursorPos(type) → {Object|null}
Get the position of the mouse on the computer screen, you can get the absolute coordinates of the mouse relative to the computer screen, or the absolute coordinates of the mouse relative to the phone window, or the relative coordinates of the mouse relative to the phone window.
Example
// Get relative cursor position on the device (0.0–1.0 range)
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getCursorPos(tcConst.DeviceRelCoor);
if (ret != null) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret.x + "/" + ret.y);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return (example with relative coordinates):
Congratulations, this API executes successfully.
Return value: 0.7458000183105469/0.7070000171661377
Parameters:
| Name | Type | Description |
|---|---|---|
type |
number | The coordinate type constant. Acceptable values:
|
Returns:
If it succeeds, it returns the coordinate object. You can use [coordinate object.x] and [coordinate object.y] to get the coordinate value of the mouse. If it fails, it returns NULL, you can get the specific error information through the lastError() function.
- Type
- Object | null
(static) getName() → {string|null}
Get the name of the device. If the alias of the device is not set, the physical name of the device is returned; if the alias of the device is set, the device alias is returned.
Note: Only the Professional Edition can set an alias on the interface.
Lite can only set an alias via the interface "setName".
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getName();
if (ret != null) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: HUAWEI-HUAWEI P7-L07
Returns:
The device name if successful, or null on failure.
Use lastError() to retrieve error details.
- Type
- string | null
(static) getNo() → {number}
Get the serial number of the device, for example: 5.
This number indicates the device's position in the list of connected devices.
The first device is usually indexed as 0.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getNo();
if (ret !== -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Returns:
In the multi-control center (MDCC), return the device serial number, such as 1, 2, 3; Not in the multi-control center, always returns 0.
- Type
- number
(static) getOrientation() → {number}
Get the rotation direction of the device's screen.
0: Screen rotation 0°, portrait (vertical screen)1: Screen rotation 90°2: Screen rotation 180°, landscape (horizontal screen)3: Screen rotation 270°
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getOrientation();
if (ret !== -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Returns:
The direction of rotation of the device's screen.
- Type
- number
(static) getRemainingBattery() → {number}
Get the remaining battery of the device.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getRemainingBattery();
if (ret !== -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 90
Returns:
Device power (percentage).
- Type
- number
(static) getSDPath() → {string|null}
Get the SD card directory path of the device.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getSDPath();
if (ret != null) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: /sdcard
Returns:
The path name of the sdcard.
- Type
- string | null
(static) getSetting(type) → {Object|string|null}
Retrieves Total Control configuration properties or device-level settings.
This API is used to get various system or device-level parameters based on the specified type.
It supports both global system calls (e.g., installation paths) and device-specific settings (when called via device.getSetting(type)).
Example
// Example 1: Get the installation, working address and adb path of Total Control
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var ret = sigmaDevice.getSetting(tcConst.Pathname);
if (ret != null) {
print("Get the properties of Total Control successfully, the value is:\n" + JSON.stringify(ret));
} else {
print("Failed to get. The error is : " + lastError());
}
// Example 2: Get the build type of Total Control (called from device)
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var ret = sigmaDevice.getSetting(tcConst.BuildCountryCode);
if (ret != null) {
print("Get build type successfully, the value is: " + ret);
} else {
print("Failed to get. The error is : " + lastError());
}
// Example 3: Get the AAI status of Total Control
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var ret = sigmaDevice.getSetting(tcConst.aaiAvailable);
if (ret == true) {
print("AAI is turned on.");
} else {
print("AAI is turned off.");
}
// Operation Result:
// If it executes successfully, it may return:
// Example 1:
{
"installPath": "C:\\Program Files\\Sigma-RT\\Total Control",
"workingPath": "C:\\Users\\xiaofu\\Documents\\Scripts",
"adbPath": "C:\\Program Files\\Sigma-RT\\Total Control\\adb\\adb2.exe"
}
// Example 2:
Get build type successfully, the value is: cn
// Example 3:
AAI is turned on.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The type of setting to retrieve. For example:
|
Returns:
Returns the setting value.
- If
tcConst.Pathnameis used, returns an object withinstallPath,workingPath, andadbPath. - If requesting a device-level property (e.g.,
BuildCountryCode), returns a string, and the corresponding meaning of the value is as follows:
cn - China
en - International
Returns null on failure; use lastError() for more details.
- Type
- Object | string | null
(static) getTmpPath() → {string|null}
Get the temporary file directory on the device memory card.
Example
// Example: Get the temporary path of the current device
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getTmpPath();
if (ret != null) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: /data/local/tmp
Returns:
Returns the absolute path to the temporary directory on the device (e.g., /data/local/tmp).
Returns null if the operation fails. Use lastError() to retrieve error details.
- Type
- string | null
(static) getWidth() → {number|null}
Retrieves the screen width (in pixels) of the connected Android device.
This method returns the current width of the device display, which is useful for layout calculations,
coordinate scaling, or screen size validations.
Example
// Example: Get the screen width of the connected device
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.getWidth();
if (ret != -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 720
Returns:
Returns the screen width in pixels (e.g., 720).
Returns -1 or null if the operation fails. Use lastError() to retrieve error details.
- Type
- number | null
(static) lock(timeout) → {number|null}
lock(timeout)
Locks the device screen for the specified amount of time.
This method is often used in automation to prevent user interaction during a script execution phase.
Example
// Example: Lock the device for 60 seconds
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.lock(60000);
if (ret != -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Parameters:
| Name | Type | Description |
|---|---|---|
timeout |
number | Duration to lock the device in milliseconds. For example, |
Returns:
Returns 0 on success.
Returns -1 or null on failure. Use lastError() to get detailed error information.
- Type
- number | null
(static) set(type, value) → {boolean|null}
Set device properties, supports setting multiple devices at the same time. When setting multiple devices, you can use devices.set(type, value), when setting only one device, you can use device.set(type, value).
Example
// Example 1: Set clipboard to "Hi"
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
var ret = sigmaDevice.set("text:clipboard", "Hi");
if (ret === true) {
print("Set successfully");
} else if (ret === false) {
print("Execute API successfully but failed to set.");
} else {
print("Failed to execute API, the error is: " + lastError());
}
// Example 2: Enable Wi-Fi
sigmaDevice.set("wifi:enable", true);
// Example 3: Set volume to 50%
sigmaDevice.set("sound:volume:all", 50);
// Example 4: Set screen brightness
sigmaDevice.set("display:brightness", 100);
// Example 5: Set IME
sigmaDevice.set("ime:set", "com.sigma_rt.totalcontrol/.ap.service.SigmaIME");
// Example 6: Multi-device set
var sigmaDevices = Device.searchObject(sigmaConst.DevAll);
sigmaDevices.set("ime:set", "sigma");
// Example 7: Disable IME
sigmaDevice.set("ime:disable", "com.sigma_rt.totalcontrol/.ap.service.SigmaIME");
// Operation Result:
// If it executes successfully, it will return:
Set successfully
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The target setting to modify. Supported formats include:
|
value |
* | The value to set. Its type depends on the
|
Returns:
Returns:
trueon successful settingfalseif API executed but setting failednullif the API execution itself failed (checklastError())
- Type
- boolean | null
(static) setName(name) → {number}
Sets the display name of the current device instance in Total Control.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.setName("mobile2");
if (ret !== -1) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | The new name to assign to the device (e.g. "mobile2"). |
Returns:
Returns:
0if the name was set successfully-1if the operation failed (checklastError()for details)
- Type
- number
(static) sleep() → {number}
Puts the device into sleep mode (turns off the screen).
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.sleep();
if (ret === 0) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Returns:
Returns:
0if the operation succeeds-1if the operation fails (checklastError()for details)
- Type
- number
(static) unlock() → {number}
Unlock the "Total Control" control interface.
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.unlock();
if (ret === 0) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Returns:
Returns:
0if the operation succeeds-1if the operation fails (checklastError()for error details)
- Type
- number
(static) wakeup() → {number}
Wakes up the device screen (simulates pressing the power button to turn on the screen).
Example
var { Device } = require("sigma/device");
var system = require("sigma/system");
// Get the current master device object
var sigmaDevice = Device.getMain();
if (sigmaDevice != null) {
var ret = sigmaDevice.wakeup();
if (ret === 0) {
print("Congratulations, this API executes successfully.\nReturn value: " + ret);
} else {
print("Sorry! " + lastError() + "\nReturn value: " + ret);
}
} else {
print("Failed to get the master device object");
}
// Operation Result:
// If it executes successfully, it will return:
Congratulations, this API executes successfully.
Return value: 0
Returns:
Returns:
0if the operation succeeds-1if the operation fails (checklastError()for error details)
- Type
- number