Last Updated on : 2023-05-22 06:38:31download
Data points (DPs) are configured to implement smart device control between the app and cloud. Standard DPs apply to interactions between devices and the app.
The component com.tuya.smart:tuyasmart-ipc-devicecontrol
has been deprecated. You can use your own logic to implement capabilities as mentioned in Device Control and Device Management.
implementation 'com.tuya.smart:tuyasmart-ipc-devicecontrol:3.17.0r139'
ITuyaCameraDevice
provides the capabilities to transmit device information. For example, send control commands and query DP data of the current device.
API description
Initializes the device control class by device ID.
ITuyaCameraDevice getCameraDeviceInstance(String devId)
Example
ITuyaCameraDevice tuyaCameraDevice = TuyaCameraDeviceControlSDK.getCameraDeviceInstance(devId);
API description
Checks whether a specific DP is supported by a device. If the DP is not supported, the API requests to send and query DP data will fail. The request parameter is the DP ID of the device.
boolean isSupportCameraDps(String dpCodeID);
Example
boolean isSupportDpBasicFlip = mTuyaCameraDevice.isSupportCameraDps(DpBasicFlip.ID);
API description
Returns device DPs from cached data. This API method applies to the Value type of data.
int queryIntegerCurrentCameraDps(String dpCodeID);
Example
int dpvalue = mTuyaCameraDevice.queryIntegerCurrentCameraDps(DpSDStatus.ID);
API description
Returns device DPs from cached data. This API method applies to the Enum, Value, Boolean, String types of data.
Object queryObjectCameraDps(String dpCodeID);
Example
Object dpValue = mTuyaCameraDevice.queryObjectCameraDps(DpBasicFlip.ID);
If queryObjectCameraDps
is used for the query, data types must be distinguished.
API description
Returns device DPs from cached data. This API method applies to the String and Enum types of data.
String queryStringCurrentCameraDps(String dpCodeID);
Example
String mode = mTuyaCameraDevice.queryStringCurrentCameraDps(DpMotionSensitivity.ID);
API description
Returns device DPs from cached data. This API method applies to the Boolean type of data.
boolean queryBooleanCameraDps(String dpCodeID);
Example
boolean dpValue = mTuyaCameraDevice.queryBooleanCameraDps(DpBasicFlip.ID);
API description
Sends DPs over a local area network (LAN) or from the cloud.
void publishCameraDps(String dpCode, Object value);
Example
// If the return value is `Boolean`, the callback can be executed to set the Boolean type of data. If the return value is `Enum/String`, the callback can be executed to set the String type of data. If the return value is `Value`, the callback can be executed to set the Integer type of data.
mTuyaCameraDevice.registorTuyaCameraDeviceControlCallback(DpBasicFlip.ID, new ITuyaCameraDeviceControlCallback<Boolean>() {
@Override
public void onSuccess(String s, DpNotifyModel.ACTION action, DpNotifyModel.SUB_ACTION sub_action, Boolean o) {
showPublishTxt.setText("LAN/Cloud query result: " + o);
}
@Override
public void onFailure(String s, DpNotifyModel.ACTION action, DpNotifyModel.SUB_ACTION sub_action, String s1, String s2) {
}
});
mTuyaCameraDevice.publishCameraDps(DpBasicFlip.ID, true);
The class ITuyaCameraDeviceControlCallback
provides the callback for device information and for device responses after commands are sent from the app.
Boolean
, the callback can be executed to set the Boolean type of data.Enum
, the callback can be executed to set the String type of data.Value
, the callback can be executed to set the Integer type of data.public interface ITuyaCameraDeviceControlCallback<E> {
// The success callback.
void onSuccess(String devId, ACTION action, SUB_ACTION subAction, E o);
// The failure callback.
void onFailure(String devId, ACTION action, SUB_ACTION subAction, String errorCode, String errorString);
}
Supported data types
Data type | Description |
---|---|
Boolean | Boolean |
String | String and Enum |
Value | Value |
DP | DP ID | Data type | Value | Description | Function definition |
---|---|---|---|---|---|
DpBasicIndicator.ID |
101 | Boolean |
|
Status indicator | Turns an indicator on or off in the normal state to avoid light pollution at night. In the case of pairing, troubleshooting, or other conditions, the indicator must show the device status as expected. |
DpBasicFlip.ID |
103 | Boolean |
|
Video flipping | Enables or disables vertical flipping of video images. It is used to adjust video orientations when the device is inversely installed. |
DpBasicOSD.ID |
104 | Boolean |
|
Time watermark | Specifies whether to enable or disable time watermarks on live video screens. |
DpBasicPrivate.ID |
105 | Boolean |
|
Private mode | Enables or disables the private mode. Audio and videos are not collected in sleep mode. In this case, live video streaming and video recording and storage cannot be performed on the device. |
DpBasicNightvision.ID |
108 | Enum |
|
Infrared night vision | Sets infrared night vision to the on, off, or automatic state. |
DP | DP ID | Data type | Value | Description | Function definition |
---|---|---|---|---|---|
DpPIRSwitch.ID |
152 | Enum |
|
Passive infrared (PIR) switch and sensitivity | Sets infrared night vision to the off, low sensitivity, medium sensitivity, or high sensitivity state. |
DpMotionSwitch.ID |
134 | Boolean |
|
Switch of motion detection alerts | Enables or disables motion detection alerts. In the enabled state, the device will report all motion events detected to the server. |
DpMotionSensitivity.ID |
106 | Enum |
|
Sensitivity of motion detection | Sets the sensitivity of motion detection. |
DP | DP ID | Data type | Value | Description | Function definition |
---|---|---|---|---|---|
DpDecibelSwitch.ID |
139 | Boolean |
|
Switch of sound detection alerts | Enables or disables sound detection alerts. In the enabled state, the device will report all sound events detected to the server. |
DpDecibelSensitivity.ID |
140 | Enum |
|
Sensitivity of sound detection | Sets the sensitivity of sound detection. |
DP | DP ID | Data type | Value | Description | Function definition |
---|---|---|---|---|---|
DpSDStatus.ID |
110 | Value |
|
SD card status | Reports the current SD card status to the cloud, for example, normal, exceptional, and insufficient space. |
DpSDStorage.ID |
109 | String | String | Status of SD card capacity | Reports the current capacity status of the memory card, including total capacity, used capacity, and remaining capacity. |
DpSDFormat.ID |
111 | Boolean | Boolean | Storage card formatting | Sends a command to format an SD card and reports the progress and other status details of the ongoing formatting task. |
DpSDFormatStatus.ID |
117 | Value | A positive value from 0 to 100 indicates the progress of formatting. |
Progress and other status details of SD card formatting | A positive value from 0 to 100 indicates the progress of formatting. Formatting is finished when the value is 100 . Error codes:
|
DpSDRecordSwitch.ID |
150 | Boolean |
|
Switch of local recording | Enables or disables SD card-stored video recording on a mobile phone. If this feature is disabled, video records will not be saved to the SD card. |
DpRecordMode.ID |
151 | Enum |
|
Local recording mode selection | After the local recording feature is enabled, users can choose between the recording modes event-triggered and continuous recording. |
DP | DP ID | Data type | Value | Description | Function definition |
---|---|---|---|---|---|
DpPTZControl.ID |
119 | Enum |
|
PTZ direction control | Starts PTZ control and determines the rotation direction. |
DpPTZStop.ID |
116 | Boolean | Boolean, used to stop PTZ control without a request parameter | Stop PTZ control | Stops PTZ control without a request parameter. |
DP | DP ID | Data type | Value | Description | Function definition |
---|---|---|---|---|---|
DpWirelessElectricity.ID |
145 | Value | Device battery level, an integer from 0 to 100 |
Battery and device status | Reports the current battery level of a device regularly or when the battery level is changed, and meanwhile, reports the current sleep or wake-up state to the cloud. |
DpWirelessLowpower.ID |
147 | Value | Value | Low battery alert threshold | Users can set a threshold on the app. An alert is reported in the case of dp145≤dp147 . |
DpWirelessBatterylock.ID |
153 | Boolean |
|
battery lock | Locks a battery or releases the battery lock. |
DpWirelessPowermode.ID |
146 | Enum |
|
Power supply mode | Reports the current power supply mode regularly or when the power supply status is changed. |
The value range of String and Enum types of DPs. The IPC SDK defines String and Enum types of DP constants, as listed in the following table.
DP | Enum value |
---|---|
DpMotionSensitivity |
MotionSensitivityMode |
DpBasicNightvision |
NightStatusMode |
DpPIRSwitch |
PIRMode |
DpRecordMode |
RecordMode |
DpDecibelSensitivity |
SoundSensitivityMode |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback