diff --git a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeJSerialCommPort.java b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeJSerialCommPort.java index dfceb8c0..9e3c9c6c 100644 --- a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeJSerialCommPort.java +++ b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeJSerialCommPort.java @@ -26,6 +26,7 @@ package se.hal.plugin.zigbee; import com.fazecast.jSerialComm.SerialPort; import com.zsmartsystems.zigbee.transport.ZigBeePort; +import com.zsmartsystems.zigbee.zcl.field.ByteArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -192,6 +193,19 @@ public class ZigBeeJSerialCommPort implements ZigBeePort { } } + //@Override + public void write(int[] bytes) { + if (serialOutputStream == null) + throw new RuntimeException("Unable to write, Serial port is not open."); + + try { + ByteArray arr = new ByteArray(bytes); + serialOutputStream.write(arr.get()); + } catch (IOException e) { + logger.error("Was unable to write byte array to serial port.", e); + } + } + @Override public int read() { return read(0);