Last Updated on : 2024-06-05 03:14:35download
This topic describes additional methods that can be used to integrate Tuya’s panel SDK into your native app.
The schedule feature implemented by TYSdk.native.gotoDpAlarm
does not support the raw
type of data points (DPs) that are specified by dpId
.
API name
TYSdk.native.gotoDpAlarm()
API description
Navigates to the schedule page of a panel.
Request parameter
Parameter | Data type | Description | Required |
---|---|---|---|
category | string |
The type of schedule. | Yes |
repeat | number |
|
Yes |
data | data |
The data of the DP that applies the schedule. | Yes |
Sample request
/**
* @desc navigates to the schedule page of a panel.
* @param {string} category: customizes the type of schedule.
* @param {string | number} dpId: returns the DP that applies the schedule.
* @param {string} dpName: the name of the DP.
* @param {string[] | number[]} rangeKeys: the keys that specify the value range of the DP.
* @param {string[]} rangeValues: The details of the DP value range. The details are the values that match the keys specified by `rangeKeys`.
*/
const dpId = TYSdk.device.getDpIdByCode(dpCode);
const dpName = Strings.getDpLang(dpCode);
const category = "schedule";
TYSdk.native.gotoDpAlarm({
category,
repeat: 0, // 0: repeats the schedule. 1: does not repeat the schedule.
data: [
{
dpId,
dpName,
selected: 0, // The index of the default DP value.
rangeKeys: [true, false],
rangeValues: [dpValue1, dpValue2], // The array of DP values of string type.
},
],
});
API name
TYSdk.native.showDeviceMenu()
API description
Navigates to the device details page.
Sample request
/**
* @desc navigates to the device details page.
*/
TYSdk.native.showDeviceMenu();
API name
TYSdk.native.isBTCapabilitySupport()
API description
Checks whether the current device supports Bluetooth.
Request parameter
Parameter | Data type | Description | Required |
---|---|---|---|
deviceId | string |
The device ID. | Yes |
Sample request
TYSdk.native.isBTCapabilitySupport('YOUR_DEVICE_ID')
.then(data => console.log('data: ', data))
.catch(err => console.log('err: ', err));
API name
TYSdk.native.getBTInfo()
API description
Returns information about device’s Bluetooth by device ID.
Request parameter
Parameter | Data type | Description | Required |
---|---|---|---|
deviceId | string |
The device ID. | Yes |
Sample request
TYSdk.native.getBTInfo('YOUR_DEVICE_ID')
.then(data => console.log('data: ', data))
.catch(err => console.log('err: ', err));
API name
TYSdk.native.createBTbond()
API description
Opens the dialog box for pairing a Bluetooth device based on the MAC address of the device. This feature applies to Android mobile devices only.
Request parameter
Parameter | Data type | Description | Required |
---|---|---|---|
mac | string |
The MAC address of the Bluetooth device. | Yes |
Sample request
TYSdk.native.createBTbond('YOUR_DEVICE_MAC')
.then(data => console.log('data: ', data))
.catch(err => console.log('err: ', err));
API name
TYSdk.native.removeBTbond()
API description
Removes a connection to a Bluetooth device based on the MAC address of the device. This feature applies to Android mobile devices only.
Request parameter
Parameter | Data type | Description | Required |
---|---|---|---|
mac | string |
The MAC address of the Bluetooth device. | Yes |
Sample request
TYSdk.native.removeBTbond('YOUR_DEVICE_MAC')
.then(data => console.log('data: ', data))
.catch(err => console.log('err: ', err));
API name
TYSdk.native.jumpToSettingPage()
API description
Navigates to the system settings page. This feature applies to iOS mobile devices only.
Request parameter
None
Sample request
TYSdk.native.jumpToSettingPage();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback