Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce constants for the configuration values for flow control #183

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.smarthome.core.thing.binding.firmware.FirmwareUpdateHandler;
import org.eclipse.smarthome.core.thing.binding.firmware.ProgressCallback;
import org.eclipse.smarthome.core.thing.binding.firmware.ProgressStep;
import org.openhab.binding.zigbee.ZigBeeBindingConstants;
import org.openhab.binding.zigbee.ember.internal.EmberConfiguration;
import org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler;
import org.openhab.binding.zigbee.handler.ZigBeeSerialPort;
Expand Down Expand Up @@ -60,18 +61,14 @@ public void initialize() {
EmberConfiguration config = getConfigAs(EmberConfiguration.class);

FlowControl flowControl;
switch (config.zigbee_flowcontrol) {
case 1: // Hardware
flowControl = FlowControl.FLOWCONTROL_OUT_RTSCTS;
break;
case 2: // Software
flowControl = FlowControl.FLOWCONTROL_OUT_XONOFF;
break;
default:
flowControl = FlowControl.FLOWCONTROL_OUT_NONE;
break;
if (ZigBeeBindingConstants.FLOWCONTROL_CONFIG_HARDWARE_CTSRTS.equals(config.zigbee_flowcontrol)) {
flowControl = FlowControl.FLOWCONTROL_OUT_RTSCTS;
} else if (ZigBeeBindingConstants.FLOWCONTROL_CONFIG_SOFTWARE_XONXOFF.equals(config.zigbee_flowcontrol)) {
flowControl = FlowControl.FLOWCONTROL_OUT_XONOFF;
} else {
flowControl = FlowControl.FLOWCONTROL_OUT_NONE;
}

ZigBeePort serialPort = new ZigBeeSerialPort(config.zigbee_port, config.zigbee_baud, flowControl);
final ZigBeeTransportTransmit dongle = new ZigBeeDongleEzsp(serialPort);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
package org.openhab.binding.zigbee.xbee.handler;

import org.eclipse.smarthome.core.thing.Bridge;
import org.openhab.binding.zigbee.ZigBeeBindingConstants;
import org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler;
import org.openhab.binding.zigbee.handler.ZigBeeSerialPort;
import org.openhab.binding.zigbee.xbee.internal.XBeeConfiguration;
Expand Down Expand Up @@ -51,16 +52,12 @@ public void initialize() {
XBeeConfiguration config = getConfigAs(XBeeConfiguration.class);

FlowControl flowControl;
switch (config.zigbee_flowcontrol) {
case 1: // Hardware
flowControl = FlowControl.FLOWCONTROL_OUT_RTSCTS;
break;
case 2: // Software
flowControl = FlowControl.FLOWCONTROL_OUT_XONOFF;
break;
default:
flowControl = FlowControl.FLOWCONTROL_OUT_NONE;
break;
if (ZigBeeBindingConstants.FLOWCONTROL_CONFIG_HARDWARE_CTSRTS.equals(config.zigbee_flowcontrol)) {
flowControl = FlowControl.FLOWCONTROL_OUT_RTSCTS;
} else if (ZigBeeBindingConstants.FLOWCONTROL_CONFIG_SOFTWARE_XONXOFF.equals(config.zigbee_flowcontrol)) {
flowControl = FlowControl.FLOWCONTROL_OUT_XONOFF;
} else {
flowControl = FlowControl.FLOWCONTROL_OUT_NONE;
}

ZigBeePort serialPort = new ZigBeeSerialPort(config.zigbee_port, config.zigbee_baud, flowControl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public class ZigBeeBindingConstants {
public final static String OFFLINE_NO_ADDRESS = "@text/zigbee.status.offline_noaddress";
public final static String OFFLINE_NODE_NOT_FOUND = "@text/zigbee.status.offline_nodenotfound";
public final static String OFFLINE_DISCOVERY_INCOMPLETE = "@text/zigbee.status.offline_discoveryincomplete";

// List of configuration values for flow control
public final static Integer FLOWCONTROL_CONFIG_NONE = Integer.valueOf(0);
public final static Integer FLOWCONTROL_CONFIG_HARDWARE_CTSRTS = Integer.valueOf(1);
public final static Integer FLOWCONTROL_CONFIG_SOFTWARE_XONXOFF = Integer.valueOf(2);

/**
* Return an ISO 8601 combined date and time string for current date/time
Expand Down