mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-26 15:21:41 +01:00
fix mjpeg does not work if overridden (#17544)
Signed-off-by: Matthew Skinner <matt@pcmus.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
05399bd819
commit
0133881465
@ -20,6 +20,7 @@ import java.util.regex.Pattern;
|
|||||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
import org.eclipse.jdt.annotation.Nullable;
|
import org.eclipse.jdt.annotation.Nullable;
|
||||||
import org.openhab.binding.ipcamera.internal.handler.IpCameraHandler;
|
import org.openhab.binding.ipcamera.internal.handler.IpCameraHandler;
|
||||||
|
import org.openhab.binding.ipcamera.internal.onvif.OnvifConnection.RequestType;
|
||||||
import org.openhab.core.library.types.DecimalType;
|
import org.openhab.core.library.types.DecimalType;
|
||||||
import org.openhab.core.library.types.OnOffType;
|
import org.openhab.core.library.types.OnOffType;
|
||||||
import org.openhab.core.library.types.PercentType;
|
import org.openhab.core.library.types.PercentType;
|
||||||
@ -156,6 +157,7 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
|||||||
ipCameraHandler.setChannelState(CHANNEL_TOO_DARK_ALARM, OnOffType.OFF);
|
ipCameraHandler.setChannelState(CHANNEL_TOO_DARK_ALARM, OnOffType.OFF);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "SceneChange":
|
||||||
case "VideoAbnormalDetection":
|
case "VideoAbnormalDetection":
|
||||||
if ("Start".equals(action)) {
|
if ("Start".equals(action)) {
|
||||||
ipCameraHandler.setChannelState(CHANNEL_SCENE_CHANGE_ALARM, OnOffType.ON);
|
ipCameraHandler.setChannelState(CHANNEL_SCENE_CHANGE_ALARM, OnOffType.ON);
|
||||||
@ -191,10 +193,14 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
|||||||
case "LensMaskClose":
|
case "LensMaskClose":
|
||||||
ipCameraHandler.setChannelState(CHANNEL_ENABLE_PRIVACY_MODE, OnOffType.OFF);
|
ipCameraHandler.setChannelState(CHANNEL_ENABLE_PRIVACY_MODE, OnOffType.OFF);
|
||||||
break;
|
break;
|
||||||
// Skip these so they are not logged.
|
|
||||||
case "TimeChange":
|
case "TimeChange":
|
||||||
|
// Check updated time matches openHAB's and store the offset which is needed for ONVIF
|
||||||
|
ipCameraHandler.onvifCamera.sendOnvifRequest(RequestType.GetSystemDateAndTime,
|
||||||
|
ipCameraHandler.onvifCamera.deviceXAddr);
|
||||||
|
break;
|
||||||
|
// Skip these so they are not logged.
|
||||||
|
case "NTPAdjustTime": // will trigger a TimeChange event no need to check twice
|
||||||
case "IntelliFrame":
|
case "IntelliFrame":
|
||||||
case "NTPAdjustTime":
|
|
||||||
case "StorageChange":
|
case "StorageChange":
|
||||||
case "Reboot":
|
case "Reboot":
|
||||||
case "NewFile":
|
case "NewFile":
|
||||||
@ -202,6 +208,7 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
|||||||
case "RtspSessionDisconnect":
|
case "RtspSessionDisconnect":
|
||||||
case "LeFunctionStatusSync":
|
case "LeFunctionStatusSync":
|
||||||
case "RecordDelete":
|
case "RecordDelete":
|
||||||
|
case "InterVideoAccess":
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ipCameraHandler.logger.debug("Unrecognised Dahua event, Code={}, action={}", code, action);
|
ipCameraHandler.logger.debug("Unrecognised Dahua event, Code={}, action={}", code, action);
|
||||||
@ -324,7 +331,7 @@ public class DahuaHandler extends ChannelDuplexHandler {
|
|||||||
} else if (command instanceof PercentType percentCommand) {
|
} else if (command instanceof PercentType percentCommand) {
|
||||||
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2["
|
ipCameraHandler.sendHttpGET("/cgi-bin/configManager.cgi?action=setConfig&Lighting_V2["
|
||||||
+ nvrChannelAdjusted + "][0][1].Mode=Manual&Lighting_V2[" + nvrChannelAdjusted
|
+ nvrChannelAdjusted + "][0][1].Mode=Manual&Lighting_V2[" + nvrChannelAdjusted
|
||||||
+ "][0][1].NearLight[0].Light=" + command.toString());
|
+ "][0][1].NearLight[0].Light=" + percentCommand.toString());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case CHANNEL_AUTO_WHITE_LED:
|
case CHANNEL_AUTO_WHITE_LED:
|
||||||
|
@ -452,7 +452,7 @@ public class ReolinkHandler extends ChannelDuplexHandler {
|
|||||||
ipCameraHandler.sendHttpPOST("/api.cgi?cmd=SetIrLights" + ipCameraHandler.reolinkAuth,
|
ipCameraHandler.sendHttpPOST("/api.cgi?cmd=SetIrLights" + ipCameraHandler.reolinkAuth,
|
||||||
"[{\"cmd\": \"SetIrLights\",\"action\": 0,\"param\": {\"IrLights\": {\"channel\": "
|
"[{\"cmd\": \"SetIrLights\",\"action\": 0,\"param\": {\"IrLights\": {\"channel\": "
|
||||||
+ ipCameraHandler.cameraConfig.getNvrChannel() + ",\"state\": \"Off\"}}}]");
|
+ ipCameraHandler.cameraConfig.getNvrChannel() + ",\"state\": \"Off\"}}}]");
|
||||||
} else if (OnOffType.ON.equals(command) || command instanceof PercentType percentCommand) {
|
} else if (OnOffType.ON.equals(command) || command instanceof PercentType) {
|
||||||
ipCameraHandler.sendHttpPOST("/api.cgi?cmd=SetIrLights" + ipCameraHandler.reolinkAuth,
|
ipCameraHandler.sendHttpPOST("/api.cgi?cmd=SetIrLights" + ipCameraHandler.reolinkAuth,
|
||||||
"[{\"cmd\": \"SetIrLights\",\"action\": 0,\"param\": {\"IrLights\": {\"channel\": "
|
"[{\"cmd\": \"SetIrLights\",\"action\": 0,\"param\": {\"IrLights\": {\"channel\": "
|
||||||
+ ipCameraHandler.cameraConfig.getNvrChannel() + ",\"state\": \"On\"}}}]");
|
+ ipCameraHandler.cameraConfig.getNvrChannel() + ",\"state\": \"On\"}}}]");
|
||||||
|
@ -241,7 +241,7 @@ public class IpCameraHandler extends BaseThingHandler {
|
|||||||
}
|
}
|
||||||
if (contentType.contains("multipart")) {
|
if (contentType.contains("multipart")) {
|
||||||
boundary = Helper.searchString(contentType, "boundary=");
|
boundary = Helper.searchString(contentType, "boundary=");
|
||||||
if (mjpegUri.equals(requestUrl)) {
|
if (mjpegUri.endsWith(requestUrl)) {
|
||||||
if (msg instanceof HttpMessage) {
|
if (msg instanceof HttpMessage) {
|
||||||
// very start of stream only
|
// very start of stream only
|
||||||
mjpegContentType = contentType;
|
mjpegContentType = contentType;
|
||||||
|
@ -124,7 +124,7 @@ public class OnvifConnection {
|
|||||||
private String user = "";
|
private String user = "";
|
||||||
private String password = "";
|
private String password = "";
|
||||||
private int onvifPort = 80;
|
private int onvifPort = 80;
|
||||||
private String deviceXAddr = "http://" + ipAddress + "/onvif/device_service";
|
public String deviceXAddr = "http://" + ipAddress + "/onvif/device_service";
|
||||||
private String eventXAddr = "http://" + ipAddress + "/onvif/device_service";
|
private String eventXAddr = "http://" + ipAddress + "/onvif/device_service";
|
||||||
private String mediaXAddr = "http://" + ipAddress + "/onvif/device_service";
|
private String mediaXAddr = "http://" + ipAddress + "/onvif/device_service";
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
Loading…
Reference in New Issue
Block a user