| | |
| | | /** |
| | | * @param lightLevel 亮度等级 [0,100] |
| | | */ |
| | | public A5LightBrightnessReqInnerFrame(Integer lightLevel) { |
| | | String destinationAddress = "FFFF"; |
| | | public A5LightBrightnessReqInnerFrame(Integer lightLevel, String lightAddress) { |
| | | String destinationAddress; |
| | | if (lightAddress == null || (!lightAddress.equals("0001") && !lightAddress.equals("0002"))) { |
| | | destinationAddress = "FFFF"; |
| | | } else { |
| | | destinationAddress = lightAddress; |
| | | } |
| | | // 将整型亮度转换为Hex |
| | | if (lightLevel < 0) { |
| | | lightLevel = 0; |
| | | } else if (lightLevel > 100) { |
| | | lightLevel = 100; |
| | | } |
| | | payload = destinationAddress + SupplementUtils.suppleZero(Integer.toHexString(lightLevel), 2); |
| | | payload = destinationAddress + SupplementUtils.suppleZero(Integer.toHexString(lightLevel).toUpperCase(), 2); |
| | | } |
| | | |
| | | @Override |