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

[oppo] rollforward a few review changes from sister bindings and fix a title #8335

Merged
merged 14 commits into from
Aug 26, 2020
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<features name="org.openhab.binding.oppo-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-oppo" description="Oppo Whole House Audio Binding" version="${project.version}">
<feature name="openhab-binding-oppo" description="Oppo Blu-ray Player Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-serial</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.oppo/${project.version}</bundle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public enum OppoCommand {
SET_INPUT_SOURCE("SIS"),
NO_OP("NOP");

private String value;
private final String value;

public static final Set<OppoCommand> INITIAL_COMMANDS = new HashSet<>(
Arrays.asList(QUERY_POWER_STATUS, QUERY_FIRMWARE_VERSION, QUERY_VOLUME, QUERY_HDMI_RESOLUTION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public abstract class OppoConnector {

private @Nullable Thread readerThread;

private List<OppoMessageEventListener> listeners = new ArrayList<>();
private final List<OppoMessageEventListener> listeners = new ArrayList<>();

/**
* Called when using direct IP connection for 83/93/95/103/105
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
public class OppoMessageEvent extends EventObject {

private static final long serialVersionUID = 1L;
private String key;
private String value;
private final String key;
private final String value;

public OppoMessageEvent(Object source, String key, String value) {
super(source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class OppoReaderThread extends Thread {
* @param connector the object that should handle the received message
*/
public OppoReaderThread(OppoConnector connector, String uid) {
super(OppoBindingConstants.BINDING_ID + "-" + uid);
super("OH-binding-" + OppoBindingConstants.BINDING_ID + "-" + uid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You do not need the binding id as already included in uid (thing uid).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable was named poorly so I corrected it. The idea was to help identify the particular connection (IP+ port or serial port name) in the case of multiple instances of the binding being used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at #8216, you are not following the new thread naming convention. You have to replace binding id by thing uid. Then having the serial port name as custom part in the name is ok.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, it should be fixed now.

this.connector = connector;
setDaemon(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
public class OppoSerialConnector extends OppoConnector {
private final Logger logger = LoggerFactory.getLogger(OppoSerialConnector.class);

private String serialPortName;
private SerialPortManager serialPortManager;
private final String serialPortName;
private final SerialPortManager serialPortManager;

private @Nullable SerialPort serialPort;

Expand Down