Last Updated on : 2024-04-03 16:31:01download
API description
ILightingStandardAreaDpsManager areaDpsManager = ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
ILightingStandardAreaDpsManager areaDpsManager = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance();
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getDps();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
String areaDps = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getDps();
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getSwitchStatus()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
boolean switchOn = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getSwitchStatus()
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getBrightPercent()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
int brightnessPercent = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getBrightPercent()
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getTemperaturePercent()
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
int temperaturePercent = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getTemperaturePercent();
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getColorData();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
String colorData = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getColorData();
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getSceneStatus();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
LightDefaultSceneType sceneType = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getSceneStatus();
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.getCurrentMode();
Parameter description
| Parameter | Description |
|---|---|
| projectId | The project ID. |
| areaId | The area ID. |
Example
AreaDpMode areaDpMode = ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.getCurrentMode();
This feature allows users to control the devices in a specific area in one go. The control supports on/off, brightness, mode, and color temperature. These features can be controlled after ThingCommercialLightingArea#newAreaInstance#getSubAreaList is called to get the AreaBean of the current area.
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishSwitchStatus(boolean status, final IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| status | The on/off status.
|
| callback | The callback. |
Example
ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishSwitchStatus(true,new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
API description
Three light modes are supported: white light, colored light, and scene, corresponding to the MODE_WHITE_LIGHT, MDOE_COLORFUL_LIGHT, and MODE_SCENE in AreaDpMode.
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishWorkMode(AreaDpMode mode, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| mode | The light mode. Valid values:
|
| callback | The callback. |
Example
ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishWorkMode(AreaDpMode.MODE_WHITE_LIGHT, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
This operation only applies to the white light mode.
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishTemperaturePercent(int value, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| value | The color temperature, ranging from 0 to 1,000. |
| callback | The callback. |
Example
ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishTemperaturePercent(50, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
This operation only applies to the scene mode.
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishSceneStatus(LightDefaultSceneType type, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| type | The scene type:
|
| callback | The callback. |
Example
ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishSceneStatus(LightDefaultSceneType.WORK, new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
This operation only applies to the colored light mode.
Get the data for the colored light mode through getColorData. This 12-bit data is formatted as hhhhssssvvvv.
hhhh represents the hue value in hex format.ssss represents the saturation value in hex format.vvvv represents the brightness value in hex format.You can convert colorData into HSV values through stringToHSV, as shown below:
public static float[] stringToHSV(String hsv){
int h = Integer.valueOf(hsv.substring(0,4),16);
int s = Integer.valueOf(hsv.substring(4,8),16);
int v = Integer.valueOf(hsv.substring(8,12),16);
return new float[]{(float)h,(float)s,(float)v};
}
You can convert HSV values into colorData through hsvToString, as shown below:
public static String hsvToString(int[] hsv) {
String h = numToHex4(hsv[0]);
String s = numToHex4(hsv[1]);
String v = numToHex4(hsv[2]);
String hhhhssssvvvv = h + s + v;
return hhhhssssvvvv;
}
public static String numToHex4(int num) {
return String.format("%04x", num);
}
API description
ThingCommercialLightingArea
.newAreaInstance(long projectId,long areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishColors(String color, IResultCallback callback);
Parameter description
| Parameter | Description |
|---|---|
| color | The color value, a 16-bit string, in the format of hhhhssssvvvv. |
| callback | The callback. |
Example
ThingCommercialLightingArea
.newAreaInstance(projectId,areaId)
.getLightingStandardAreaDpsManagerInstance()
.publishColors("hhhhssssvvvv", new IResultCallback() {
@Override
public void onError(String errorCode, String errorMsg) {
if (callback != null) {
callback.onError(errorCode, errorMsg);
}
}
@Override
public void onSuccess() {
if (callback != null) {
callback.onSuccess();
}
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback