Moved out the pan id configuration

This commit is contained in:
Ziver Koc 2021-01-01 22:20:17 +01:00
parent ee485c4466
commit 3dbd626aee
3 changed files with 9 additions and 5 deletions

View file

@ -26,6 +26,7 @@ hal.http_port=8080
## Zigbee plugin ## Zigbee plugin
#zigbee.com_port=COM4 #zigbee.com_port=COM4
#zigbee.pan_id=-6480
## ZWave plugin ## ZWave plugin
#zwave.com_port=COM4 #zwave.com_port=COM4

View file

@ -3,6 +3,7 @@
|Config Parameter |Value |Description | |Config Parameter |Value |Description |
|-----------------|-----------------------------|------------| |-----------------|-----------------------------|------------|
|zwave.com_port |Name or location of com port |The port where radio dongle is connected| |zwave.com_port |Name or location of com port |The port where radio dongle is connected|
|zigbee.pan_id |Integer |The PAN ID for the radio module|
# Hardware # Hardware

View file

@ -19,6 +19,7 @@ public class HalZigbeeController implements HalSensorController, HalEventControl
private static final Logger logger = LogUtil.getLogger(); private static final Logger logger = LogUtil.getLogger();
private static final String CONFIG_ZIGBEE_PORT = "zigbee.com_port"; private static final String CONFIG_ZIGBEE_PORT = "zigbee.com_port";
private static final String CONFIG_ZIGBEE_PANID = "zigbee.pan_id";
private SerialPort port; private SerialPort port;
private ZigBeeApiDongleImpl zigbeeApi; private ZigBeeApiDongleImpl zigbeeApi;
@ -33,13 +34,16 @@ public class HalZigbeeController implements HalSensorController, HalEventControl
@Override @Override
public boolean isAvailable() { public boolean isAvailable() {
return HalContext.containsProperty(CONFIG_ZIGBEE_PORT); return HalContext.containsProperty(CONFIG_ZIGBEE_PORT) &&
HalContext.containsProperty(CONFIG_ZIGBEE_PANID);
} }
@Override @Override
public void initialize() { public void initialize() {
initialize(HalContext.getStringProperty(CONFIG_ZIGBEE_PORT)); initialize(
HalContext.getStringProperty(CONFIG_ZIGBEE_PORT),
HalContext.getIntegerProperty(CONFIG_ZIGBEE_PANID));
} }
public void initialize(String comPort) { public void initialize(String comPort, int panId) {
byte[] networkKey = null; // Default network key byte[] networkKey = null; // Default network key
port = new SerialPortJSC(comPort); port = new SerialPortJSC(comPort);
zigbeeApi = new ZigBeeApiDongleImpl( zigbeeApi = new ZigBeeApiDongleImpl(
@ -102,6 +106,4 @@ public class HalZigbeeController implements HalSensorController, HalEventControl
public void setListener(HalSensorReportListener listener) { public void setListener(HalSensorReportListener listener) {
sensorListener = listener; sensorListener = listener;
} }
} }