Last Updated on : 2023-04-13 09:35:14download
API description
void addRoom(String name, IThingRoomResultCallback callback)
Parameters
Parameter | Description |
---|---|
name | The name of a room. |
callback | The callback. |
Example
ThingHomeSdk.newHomeInstance(10000).addRoom("Room name", new IThingRoomResultCallback() {
@Override
public void onSuccess(RoomBean bean) {
// do something
}
@Override
public void onError(String errorCode, String errorMsg) {
// do something
}
});
API description
void removeRoom(long roomId, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
roomId | The room ID. |
callback | The callback. |
Example
ThingHomeSdk.newHomeInstance(10000).removeRoom(roomId, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
API description
void sortRoom(List<Long> idList, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
idList | The list of room IDs |
callback | The callback. |
Example
ThingHomeSdk.newHomeInstance(10000).sortRoom(idList, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
API description
RoomBean getDeviceRoomBean(String devId)
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
Example
ThingHomeSdk.getDataInstance().getDeviceRoomBean("Device ID");
API description
void updateRoom(String name, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
name | The new room name. |
Example
ThingHomeSdk.newRoomInstance(10000).updateRoom(name, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
This API method is newly added to SDK v3.19.
Query image URL
Returns the URL of the background image of a room after this image is uploaded.
RoomBean roomBean = homeBean.rooms.get(index);
String roomBgImageurl = roomBean.iconUrl;
API description
void updateIcon(File file, IResultCallback callback);
Parameters
Parameter | Description |
---|---|
file | The image of the room. |
callback | The callback. |
Example
ThingHomeSdk.newRoomInstance(10000).updateIcon(file, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
API description
void addDevice(String devId, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
Example
ThingHomeSdk.newRoomInstance(10000).addDevice(devId, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
API description
void removeDevice(String devId, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
devId | The device ID. |
Example
ThingHomeSdk.newRoomInstance(10000).removeDevice(devId, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
API description
void addGroup(long groupId, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
groupId | The group ID. |
Example
ThingHomeSdk.newRoomInstance(10000).addGroup(groupId, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
API description
void removeGroup(Long groupId, IResultCallback resultCallback)
Parameters
Parameter | Description |
---|---|
groupId | The group ID. |
Example
ThingHomeSdk.newRoomInstance(10000).removeGroup(groupId, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
Transfers device groups in to or out of a room in bulk.
This API method can be called to sort devices in a room. Recommended procedure:
DeviceAndGroupInRoomBean
.HomeBean
that includes the list of all devices.HomeBean
by device ID to get the list of devices that are returned by moveDevGroupListFromRoom
.displayOrder
field in DeviceBean
.API description
void moveDevGroupListFromRoom(List<DeviceAndGroupInRoomBean> list, IResultCallback callback)
Parameters
Parameter | Description |
---|---|
List | The list of groups or devices. |
Data format of DeviceAndGroupInRoomBean
Parameter | Type | Description |
---|---|---|
id | String | The ID of the device or group. |
type | int | The type of data. Valid values:
|
Example
ThingHomeSdk.newRoomInstance(10000).moveDevGroupListFromRoom(list, new IResultCallback() {
@Override
public void onSuccess() {
// do something
}
@Override
public void onError(String code, String error) {
// do something
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback