Skip to content

Commit

Permalink
[ipcamera] Fix multiple WARNs when HIK camera does not support alarm …
Browse files Browse the repository at this point in the history
…inputs (openhab#13606)

* Fix never ending WARN when HIK camera does not support alarm inputs.
* Streamline code.

Signed-off-by: Matthew Skinner <matt@pcmus.com>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
  • Loading branch information
Skinah authored and andrasU committed Nov 12, 2022
1 parent d56aec2 commit 9122018
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import static org.openhab.binding.ipcamera.internal.IpCameraBindingConstants.*;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
Expand Down Expand Up @@ -423,12 +422,4 @@ public void handleCommand(ChannelUID channelUID, Command command) {
return;
}
}

// If a camera does not need to poll a request as often as snapshots, it can be
// added here. Binding steps through the list.
public ArrayList<String> getLowPriorityRequests() {
ArrayList<String> lowPriorityRequests = new ArrayList<String>(1);
lowPriorityRequests.add("/ISAPI/System/IO/inputs/" + nvrChannel + "/status"); // must stay in element 0.
return lowPriorityRequests;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1270,9 +1270,6 @@ public void handleCommand(ChannelUID channelUID, Command command) {
case HIKVISION_THING:
HikvisionHandler hikvisionHandler = new HikvisionHandler(getHandle(), cameraConfig.getNvrChannel());
hikvisionHandler.handleCommand(channelUID, command);
if (lowPriorityRequests.isEmpty()) {
lowPriorityRequests = hikvisionHandler.getLowPriorityRequests();
}
break;
case FOSCAM_THING:
FoscamHandler foscamHandler = new FoscamHandler(getHandle(), cameraConfig.getUser(),
Expand Down Expand Up @@ -1631,6 +1628,9 @@ public void initialize() {
if (snapshotUri.isEmpty()) {
snapshotUri = "/ISAPI/Streaming/channels/" + cameraConfig.getNvrChannel() + "01/picture";
}
if (lowPriorityRequests.isEmpty()) {
lowPriorityRequests.add("/ISAPI/System/IO/inputs/" + cameraConfig.getNvrChannel() + "/status");
}
break;
case INSTAR_THING:
if (snapshotUri.isEmpty()) {
Expand Down

0 comments on commit 9122018

Please sign in to comment.