- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster.offCommand()
方法的一些代码示例,展示了ZclOnOffCluster.offCommand()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZclOnOffCluster.offCommand()
方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster
类名称:ZclOnOffCluster
方法名:offCommand
[英]The Off Command
[中]关闭命令
代码示例来源:origin: openhab/org.openhab.binding.zigbee
@Override
public void handleCommand(final Command command) {
if (clusterOnOffServer == null) {
logger.warn("{}: OnOff converter is not linked to a server and cannot accept commands",
endpoint.getIeeeAddress());
return;
}
OnOffType cmdOnOff = null;
if (command instanceof PercentType) {
if (((PercentType) command).intValue() == 0) {
cmdOnOff = OnOffType.OFF;
} else {
cmdOnOff = OnOffType.ON;
}
} else if (command instanceof OnOffType) {
cmdOnOff = (OnOffType) command;
} else {
logger.warn("{}: OnOff converter only accepts PercentType and OnOffType - not {}",
endpoint.getIeeeAddress(), command.getClass().getSimpleName());
return;
}
if (cmdOnOff == OnOffType.ON) {
clusterOnOffServer.onCommand();
} else {
clusterOnOffServer.offCommand();
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
private void changeOnOff(OnOffType onoff) throws InterruptedException, ExecutionException {
boolean on = onoff == OnOffType.ON;
PercentType brightness = on ? PercentType.HUNDRED : PercentType.ZERO;
if (clusterLevelControl != null) {
changeBrightness(brightness);
return;
}
if (clusterOnOff == null) {
logger.warn("{}: ignoring on/off command", endpoint.getIeeeAddress());
return;
}
HSBType oldHSB = currentHSB;
currentHSB = new HSBType(oldHSB.getHue(), oldHSB.getSaturation(), brightness);
lastBrightness = brightness;
if (on) {
clusterOnOff.onCommand().get();
} else {
clusterOnOff.offCommand().get();
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
/**
* If we support the OnOff cluster then we should perform the same function as the SwitchOnoffConverter. Otherwise,
* interpret ON commands as moving to level 100%, and OFF commands as moving to level 0%.
*/
private void handleOnOffCommand(OnOffType cmdOnOff) {
if (clusterOnOff != null) {
if (cmdOnOff == OnOffType.ON) {
clusterOnOff.onCommand();
} else {
clusterOnOff.offCommand();
}
} else {
if (cmdOnOff == OnOffType.ON) {
moveToLevel(PercentType.HUNDRED);
} else {
moveToLevel(PercentType.ZERO);
}
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
private void moveToLevel(PercentType percent) {
if (clusterOnOff != null) {
if (percent.equals(PercentType.ZERO)) {
clusterOnOff.offCommand();
} else {
clusterLevelControl.moveToLevelWithOnOffCommand(percentToLevel(percent),
configLevelControl.getDefaultTransitionTime());
}
} else {
clusterLevelControl.moveToLevelCommand(percentToLevel(percent),
configLevelControl.getDefaultTransitionTime());
}
}
代码示例来源:origin: openhab/org.openhab.binding.zigbee
private void changeBrightness(PercentType brightness) throws InterruptedException, ExecutionException {
if (clusterLevelControl == null) {
if (clusterOnOff != null) {
changeOnOff(brightness.intValue() == 0 ? OnOffType.OFF : OnOffType.ON);
} else {
logger.warn("{}: ignoring brightness command", endpoint.getIeeeAddress());
}
return;
}
HSBType oldHSB = currentHSB;
currentHSB = new HSBType(oldHSB.getHue(), oldHSB.getSaturation(), brightness);
lastBrightness = brightness;
int level = percentToLevel(brightness);
if (clusterOnOff != null) {
if (brightness.equals(PercentType.ZERO)) {
clusterOnOff.offCommand();
} else {
clusterLevelControl.moveToLevelWithOnOffCommand(level, configLevelControl.getDefaultTransitionTime())
.get();
}
} else {
clusterLevelControl.moveToLevelCommand(level, configLevelControl.getDefaultTransitionTime()).get();
}
}
代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee
@Test
public void testNodeNetworkAddressUpdate() {
mockedTransport = Mockito.mock(ZigBeeTransportTransmit.class);
mockedApsFrameListener = ArgumentCaptor.forClass(ZigBeeApsFrame.class);
ZigBeeNetworkManager networkManager = new ZigBeeNetworkManager(mockedTransport);
ZigBeeNode node = new ZigBeeNode(networkManager, new IeeeAddress("12345678990ABCDEF"));
node.setNetworkAddress(12345);
ZigBeeEndpoint endpoint = new ZigBeeEndpoint(node, 1);
ZclOnOffCluster cluster = new ZclOnOffCluster(endpoint);
networkManager.setSerializer(DefaultSerializer.class, DefaultDeserializer.class);
Mockito.doNothing().when(mockedTransport).sendCommand(mockedApsFrameListener.capture());
cluster.onCommand();
assertEquals(12345, mockedApsFrameListener.getValue().getDestinationAddress());
node.setNetworkAddress(54321);
cluster.offCommand();
assertEquals(54321, mockedApsFrameListener.getValue().getDestinationAddress());
}
本文整理了Java中com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster.offCommand()方法的一些代码示例,展示了ZclOnOffClu
我是一名优秀的程序员,十分优秀!