Last Updated on : 2023-05-25 06:23:51
Sweeper SDK provides API requests and real-time channels to enable data queries.
API description
Query the latest cleaning task.
void queryLatestCleanRecord(String devId, String start, int size, IThingResultCallback<RecordDetaiBean> callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
start | The start row. The value in the first request is empty. In the follow-up requests, the value of startRow in the last response is required. |
size | The maximum number of entries to be returned in each call. The value is 500 . |
The following table lists the properties of RecordDetaiBean
.
Field | Type | Description |
---|---|---|
devId | String | The device ID. |
startRow | String | The start row. |
dataList | List<String> | The map data. |
subRecordId | int | The ID of the cleaning task. |
hasNext | boolean | Specifies whether to return the next page. |
startTime | long | The start time of the period to be queried. |
endTime | long | The end time of the period to be queried. |
Example
ThingOptimusSdk.getManager(IThingSweeperKitSdk.class).getGyroscopeAndVisualSweeperKit().queryLatestCleanRecord(devId, "", 500, new IThingResultCallback<RecordDetaiBean>() {
@Override
public void onSuccess(RecordDetaiBean result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
API description
Returns the historical data of cleaning tasks.
void getHistoryCleanRecordList(String devId, int offset, int limit, long startTime, long endTime, IThingResultCallback<HistoryResultBean> callback);
Parameters
Field | Type | Description |
---|---|---|
devId | String | The device ID. |
offset | int | The number of entries starting from which entries are returned. |
limit | int | The maximum number of entries returned on each page. |
startTime | long | The start time of the period to be queried. |
endTime | long | The end time of the period to be queried. |
The following table lists the properties of HistoryResultBean
.
Field | Type | Description |
---|---|---|
datas | List<RecordListBean> | The list of historical data. |
totalCount | int | The total number of entries. |
The following table lists the properties of RecordListBean
.
Field | Type | Description |
---|---|---|
recordId | String | The map ID. |
gid | long | The home group ID. |
dpId | int | The data point (DP) ID generated for the robot vacuum product on the Tuya IoT Development Platform. |
gmtCreate | long | The time when the cleaning record was created. |
value | String | The information about the map. The value is used to parse subRecordId . |
uuid | String | The device ID. |
Example
ThingOptimusSdk.getManager(IThingSweeperKitSdk.class).getGyroscopeAndVisualSweeperKit().getHistoryCleanRecordList(devId, 0, 10, 0, 0, new IThingResultCallback<HistoryResultBean>() {
@Override
public void onSuccess(HistoryResultBean result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
API description
Returns details of a historical cleaning task.
void getCleanRecordDetail(String devId, int subRecordId, String start, int size, IThingResultCallback<RecordDetaiBean> callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
subRecordId | The ID of the cleaning task to be queried. Parse the value parameter of the historical cleaning tasks to get the ID. The parsing rules vary depending on different data lengths. The following table describes the rules. |
start | The start row. The value in the first request is empty. In the follow-up requests, the value of startRow in the last response is required. |
size | The maximum number of entries to be returned in each call. The value is 500 . |
Protocol for parsing value
Record time 12 digits |
Cleaning time 3 digits |
Cleaning area 3 digits |
subRecordId 5 digits |
Example | Description |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | 20200319202500300200123 |
|
No | Yes | Yes | Yes | 00300200123 |
|
Yes | Yes | Yes | No | 202003192025003002 |
|
No | Yes | Yes | No | 003002 |
|
Example
ThingOptimusSdk.getManager(IThingSweeperKitSdk.class).getGyroscopeAndVisualSweeperKit().getCleanRecordDetail(devId, subRecordId, "", 2, new IThingResultCallback<RecordDetaiBean>() {
@Override
public void onSuccess(RecordDetaiBean result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
API description
The simple method that encapsulates the protocol to parse strings of value
type. You can choose between this method and the protocol for parsing value. Currently, only strings of value type are supported.
int getSubRecordId(String value);
Example
int subId = ThingOptimusSdk.getManager(IThingSweeperKitSdk.class).getGyroscopeAndVisualSweeperKit().getSubRecordId("20200319202500300200123");
API description
Up to 100 entries can be deleted in each call.
void deleteHistoryCleanRecord(String devId, List<String> recordIds, IResultCallback callback);
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
recordIds | The list of cleaning task IDs. You can call getHistoryCleanRecordList to get the IDs. |
Example
ThingOptimusSdk.getManager(IThingSweeperKitSdk.class).getGyroscopeAndVisualSweeperKit().deleteHistoryCleanRecord(devId, recodIds, new IResultCallback() {
@Override
public void onError(String code, String error) {
}
@Override
public void onSuccess() {
}
});
Real-time channels can be registered to listen for reported device data streams. Arrays are returned in the response and parsed into required data, such as the x-coordinate, y-coordinate, and color values, using the device protocol.
Access to API: ThingHomeSdk.getTransferInstance();
API description
void registerTransferDataListener(IThingDataCallback<TransferDataBean> callback);
Example
ThingHomeSdk.getTransferInstance().registerTransferDataListener(new IThingDataCallback<TransferDataBean>() {
@Override
public void onSuccess(TransferDataBean result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TransferDataBean
Field | Type | Description |
---|---|---|
data | byte[] |
|
devId | String | The device ID. |
API description
void unRegisterTransferDataListener(IThingDataCallback<TransferDataBean> callback);
Example
ThingHomeSdk.getTransferInstance().unRegisterTransferDataListener(this);
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback