Browse Source

update

pull/1/head
fajiao 3 years ago
parent
commit
34c3375203
  1. 725
      BaseModule/EC.Onvif/Discovery/DiscoveryClient.cs
  2. 105
      BaseModule/EC.Onvif/OnvifClient.cs
  3. 6
      BusinessModule/EC.App.ThatBLL/Onvif/ICurdBLL.cs
  4. 6
      BusinessModule/EC.App.ThatBLL/Onvif/IDeviceBLL.cs
  5. 24
      BusinessModule/EC.App.ThatBLL/Onvif/IImagingBLL.cs
  6. 9
      BusinessModule/EC.App.ThatBLL/Onvif/IMediaBLL.cs
  7. 10
      BusinessModule/EC.App.ThatBLL/Onvif/IPTZBLL.cs
  8. 27
      BusinessModule/EC.App.ThatBLL/Onvif/ImagingBLL.cs
  9. 11
      BusinessModule/EC.App.ThatBLL/Onvif/Impl/CurdBLL.cs
  10. 9
      BusinessModule/EC.App.ThatBLL/Onvif/Impl/DeviceBLL.cs
  11. 19
      BusinessModule/EC.App.ThatBLL/Onvif/Impl/IImagingBLL.cs
  12. 55
      BusinessModule/EC.App.ThatBLL/Onvif/Impl/ImagingBLL.cs
  13. 39
      BusinessModule/EC.App.ThatBLL/Onvif/Impl/MediaBLL.cs
  14. 21
      BusinessModule/EC.App.ThatBLL/Onvif/Impl/PTZBLL.cs
  15. 27
      BusinessModule/EC.App.ThatBLL/Onvif/MediaBLL.cs
  16. 2
      BusinessModule/EC.App.ThatService/Onvif/IOnvifClientService.cs
  17. 4
      BusinessModule/EC.App.ThatService/Onvif/Impl/OnvifClientService.cs
  18. 68
      OnvifSocketServer/Program.cs
  19. 4
      OnvifSocketServer/appsettings.json
  20. 6
      OnvifWebServer/Controllers/Onvif/CurdController.cs
  21. 6
      OnvifWebServer/Controllers/Onvif/DeviceController.cs
  22. 62
      OnvifWebServer/Controllers/Onvif/ImagingController.cs
  23. 31
      OnvifWebServer/Controllers/Onvif/MediaController.cs
  24. 16
      OnvifWebServer/Controllers/Onvif/PTZController.cs
  25. 4
      OnvifWebServer/Controllers/Onvif/TestController.cs
  26. 2
      OnvifWebServer/Properties/launchSettings.json

725
BaseModule/EC.Onvif/Discovery/DiscoveryClient.cs

@ -0,0 +1,725 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,并在以下条件下丢失:
// 代码重新生成。
// </auto-generated>
//------------------------------------------------------------------------------
namespace EC.Onvif.Discovery
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://www.onvif.org/ver10/network/wsdl", ConfigurationName= "EC.Onvif.Discovery.RemoteDiscoveryPort")]
public interface RemoteDiscoveryPort
{
[System.ServiceModel.OperationContractAttribute(Action="http://www.onvif.org/ver10/network/wsdl/Hello", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
HelloResponse Hello(HelloRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://www.onvif.org/ver10/network/wsdl/Hello", ReplyAction="*")]
System.Threading.Tasks.Task<HelloResponse> HelloAsync(HelloRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://www.onvif.org/ver10/network/wsdl/Bye", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
ByeResponse Bye(ByeRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://www.onvif.org/ver10/network/wsdl/Bye", ReplyAction="*")]
System.Threading.Tasks.Task<ByeResponse> ByeAsync(ByeRequest request);
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public partial class EndpointReferenceType
{
private AttributedURI addressField;
private ReferencePropertiesType referencePropertiesField;
private ReferenceParametersType referenceParametersField;
private AttributedQName portTypeField;
private ServiceNameType serviceNameField;
private System.Xml.XmlElement[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=0)]
public AttributedURI Address
{
get
{
return this.addressField;
}
set
{
this.addressField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=1)]
public ReferencePropertiesType ReferenceProperties
{
get
{
return this.referencePropertiesField;
}
set
{
this.referencePropertiesField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=2)]
public ReferenceParametersType ReferenceParameters
{
get
{
return this.referenceParametersField;
}
set
{
this.referenceParametersField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=3)]
public AttributedQName PortType
{
get
{
return this.portTypeField;
}
set
{
this.portTypeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=4)]
public ServiceNameType ServiceName
{
get
{
return this.serviceNameField;
}
set
{
this.serviceNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute(Order=5)]
public System.Xml.XmlElement[] Any
{
get
{
return this.anyField;
}
set
{
this.anyField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public partial class AttributedURI
{
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute(DataType="anyURI")]
public string Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public partial class ProbeMatchType
{
private EndpointReferenceType endpointReferenceField;
private string typesField;
private ScopesType scopesField;
private string xAddrsField;
private uint metadataVersionField;
private System.Xml.XmlElement[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing", Order=0)]
public EndpointReferenceType EndpointReference
{
get
{
return this.endpointReferenceField;
}
set
{
this.endpointReferenceField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=1)]
public string Types
{
get
{
return this.typesField;
}
set
{
this.typesField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=2)]
public ScopesType Scopes
{
get
{
return this.scopesField;
}
set
{
this.scopesField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=3)]
public string XAddrs
{
get
{
return this.xAddrsField;
}
set
{
this.xAddrsField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Order=4)]
public uint MetadataVersion
{
get
{
return this.metadataVersionField;
}
set
{
this.metadataVersionField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute(Order=5)]
public System.Xml.XmlElement[] Any
{
get
{
return this.anyField;
}
set
{
this.anyField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public partial class ScopesType
{
private string matchByField;
private string[] textField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(DataType="anyURI")]
public string MatchBy
{
get
{
return this.matchByField;
}
set
{
this.matchByField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute(DataType="anyURI")]
public string[] Text
{
get
{
return this.textField;
}
set
{
this.textField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public partial class ServiceNameType
{
private string portNameField;
private System.Xml.XmlQualifiedName valueField;
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute(DataType="NCName")]
public string PortName
{
get
{
return this.portNameField;
}
set
{
this.portNameField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public System.Xml.XmlQualifiedName Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public partial class AttributedQName
{
private System.Xml.XmlQualifiedName valueField;
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public System.Xml.XmlQualifiedName Value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public partial class ReferenceParametersType
{
private System.Xml.XmlElement[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute(Order=0)]
public System.Xml.XmlElement[] Any
{
get
{
return this.anyField;
}
set
{
this.anyField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public partial class ReferencePropertiesType
{
private System.Xml.XmlElement[] anyField;
/// <remarks/>
[System.Xml.Serialization.XmlAnyElementAttribute(Order=0)]
public System.Xml.XmlElement[] Any
{
get
{
return this.anyField;
}
set
{
this.anyField = value;
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.MessageContractAttribute(WrapperName="Hello", WrapperNamespace="http://www.onvif.org/ver10/network/wsdl", IsWrapped=true)]
public partial class HelloRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public EndpointReferenceType EndpointReference;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=1)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public string Types;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=2)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public ScopesType Scopes;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=3)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public string XAddrs;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=4)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public uint MetadataVersion;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=5)]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
public System.Xml.XmlAttribute[] AnyAttr;
public HelloRequest()
{
}
public HelloRequest(EndpointReferenceType EndpointReference, string Types, ScopesType Scopes, string XAddrs, uint MetadataVersion, System.Xml.XmlElement[] Any, System.Xml.XmlAttribute[] AnyAttr)
{
this.EndpointReference = EndpointReference;
this.Types = Types;
this.Scopes = Scopes;
this.XAddrs = XAddrs;
this.MetadataVersion = MetadataVersion;
this.Any = Any;
this.AnyAttr = AnyAttr;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.MessageContractAttribute(WrapperName="HelloResponse", WrapperNamespace="http://www.onvif.org/ver10/network/wsdl", IsWrapped=true)]
public partial class HelloResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public EndpointReferenceType EndpointReference;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
public System.Xml.XmlAttribute[] AnyAttr;
public HelloResponse()
{
}
public HelloResponse(EndpointReferenceType EndpointReference, System.Xml.XmlElement[] Any, System.Xml.XmlAttribute[] AnyAttr)
{
this.EndpointReference = EndpointReference;
this.Any = Any;
this.AnyAttr = AnyAttr;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.MessageContractAttribute(WrapperName="Bye", WrapperNamespace="http://www.onvif.org/ver10/network/wsdl", IsWrapped=true)]
public partial class ByeRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public EndpointReferenceType EndpointReference;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=1)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public string Types;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=2)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public ScopesType Scopes;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=3)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public string XAddrs;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=4)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public uint MetadataVersion;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=5)]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
public System.Xml.XmlAttribute[] AnyAttr;
public ByeRequest()
{
}
public ByeRequest(EndpointReferenceType EndpointReference, string Types, ScopesType Scopes, string XAddrs, uint MetadataVersion, System.Xml.XmlElement[] Any, System.Xml.XmlAttribute[] AnyAttr)
{
this.EndpointReference = EndpointReference;
this.Types = Types;
this.Scopes = Scopes;
this.XAddrs = XAddrs;
this.MetadataVersion = MetadataVersion;
this.Any = Any;
this.AnyAttr = AnyAttr;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.MessageContractAttribute(WrapperName="ByeResponse", WrapperNamespace="http://www.onvif.org/ver10/network/wsdl", IsWrapped=true)]
public partial class ByeResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public EndpointReferenceType EndpointReference;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
public System.Xml.XmlAttribute[] AnyAttr;
public ByeResponse()
{
}
public ByeResponse(EndpointReferenceType EndpointReference, System.Xml.XmlElement[] Any, System.Xml.XmlAttribute[] AnyAttr)
{
this.EndpointReference = EndpointReference;
this.Any = Any;
this.AnyAttr = AnyAttr;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
public interface RemoteDiscoveryPortChannel : RemoteDiscoveryPort, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
public partial class RemoteDiscoveryPortClient : System.ServiceModel.ClientBase<RemoteDiscoveryPort>, RemoteDiscoveryPort
{
public RemoteDiscoveryPortClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public HelloResponse Hello(HelloRequest request)
{
return base.Channel.Hello(request);
}
public System.Threading.Tasks.Task<HelloResponse> HelloAsync(HelloRequest request)
{
return base.Channel.HelloAsync(request);
}
public ByeResponse Bye(ByeRequest request)
{
return base.Channel.Bye(request);
}
public System.Threading.Tasks.Task<ByeResponse> ByeAsync(ByeRequest request)
{
return base.Channel.ByeAsync(request);
}
public virtual System.Threading.Tasks.Task OpenAsync()
{
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
}
public virtual System.Threading.Tasks.Task CloseAsync()
{
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.ServiceContractAttribute(Namespace="http://www.onvif.org/ver10/network/wsdl", ConfigurationName= "EC.Onvif.Discovery.DiscoveryLookupPort")]
public interface DiscoveryLookupPort
{
[System.ServiceModel.OperationContractAttribute(Action="http://www.onvif.org/ver10/network/wsdl/Probe", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
ProbeResponse Probe(ProbeRequest request);
[System.ServiceModel.OperationContractAttribute(Action="http://www.onvif.org/ver10/network/wsdl/Probe", ReplyAction="*")]
System.Threading.Tasks.Task<ProbeResponse> ProbeAsync(ProbeRequest request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.MessageContractAttribute(WrapperName="Probe", WrapperNamespace="http://www.onvif.org/ver10/network/wsdl", IsWrapped=true)]
public partial class ProbeRequest
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=0)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public string Types;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=1)]
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public ScopesType Scopes;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=2)]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
public System.Xml.XmlAttribute[] AnyAttr;
public ProbeRequest()
{
}
public ProbeRequest(string Types, ScopesType Scopes, System.Xml.XmlElement[] Any, System.Xml.XmlAttribute[] AnyAttr)
{
this.Types = Types;
this.Scopes = Scopes;
this.Any = Any;
this.AnyAttr = AnyAttr;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
[System.ServiceModel.MessageContractAttribute(WrapperName="ProbeResponse", WrapperNamespace="http://www.onvif.org/ver10/network/wsdl", IsWrapped=true)]
public partial class ProbeResponse
{
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery", Order=0)]
[System.Xml.Serialization.XmlElementAttribute("ProbeMatch", Namespace="http://schemas.xmlsoap.org/ws/2005/04/discovery")]
public ProbeMatchType[] ProbeMatch;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace="", Order=1)]
[System.Xml.Serialization.XmlAnyElementAttribute()]
public System.Xml.XmlElement[] Any;
public System.Xml.XmlAttribute[] AnyAttr;
public ProbeResponse()
{
}
public ProbeResponse(ProbeMatchType[] ProbeMatch, System.Xml.XmlElement[] Any, System.Xml.XmlAttribute[] AnyAttr)
{
this.ProbeMatch = ProbeMatch;
this.Any = Any;
this.AnyAttr = AnyAttr;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
public interface DiscoveryLookupPortChannel : DiscoveryLookupPort, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.3-preview3.21351.2")]
public partial class DiscoveryLookupPortClient : System.ServiceModel.ClientBase<DiscoveryLookupPort>, DiscoveryLookupPort
{
public DiscoveryLookupPortClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress)
{
}
public ProbeResponse Probe(ProbeRequest request)
{
return base.Channel.Probe(request);
}
public System.Threading.Tasks.Task<ProbeResponse> ProbeAsync(ProbeRequest request)
{
return base.Channel.ProbeAsync(request);
}
public virtual System.Threading.Tasks.Task OpenAsync()
{
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
}
public virtual System.Threading.Tasks.Task CloseAsync()
{
return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action<System.IAsyncResult>(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
}
}
}

105
BaseModule/EC.Onvif/OnvifClient.cs

@ -37,9 +37,15 @@ namespace EC.Onvif
private Capabilities Caps { get; set; }
#endregion Client Attr
#region Settings Attr
private string profileToken { get; set; }
#endregion Client Attr
private string videoSourceToken { get; set; }
#endregion Settings Attr
public OnvifClient(string hostname, string username, string password)
{
@ -48,14 +54,17 @@ namespace EC.Onvif
Password = password;
}
public async Task InitAsync()
public async Task Init()
{
try
{
Device = await OnvifClientFactory.CreateDeviceClientAsync(Hostname, Username, Password);
Media = await OnvifClientFactory.CreateMediaClientAsync(Hostname, Username, Password);
PTZ = await OnvifClientFactory.CreatePTZClientAsync(Hostname, Username, Password);
Imaging = await OnvifClientFactory.CreateImagingClientAsync(Hostname, Username, Password);
var profiles = await Media.GetProfilesAsync();
var videoSources = await Media.GetVideoSourcesAsync();
foreach (var profile in profiles.Profiles)
{
if (string.IsNullOrEmpty(profileToken))
@ -64,6 +73,16 @@ namespace EC.Onvif
break;
}
}
foreach (var source in videoSources.VideoSources)
{
if (string.IsNullOrEmpty(videoSourceToken))
{
videoSourceToken = source.token;
break;
}
}
Caps = (await Device.GetCapabilitiesAsync(new CapabilityCategory[] { CapabilityCategory.All })).Capabilities;
}
catch (Exception)
@ -85,8 +104,26 @@ namespace EC.Onvif
public bool IsMediaContected()
{
var r = IsDeviceContected();
return r;
bool ret = IsDeviceContected();
return ret;
}
private StreamSetup RtspStreamSetup { get; } = new()
{
Stream = StreamType.RTPUnicast,
Transport = new() { Protocol = TransportProtocol.RTSP }
};
public async Task<string> GetStreamUri()
{
MediaUri mediaUri = await Media.GetStreamUriAsync(RtspStreamSetup, profileToken);
return mediaUri.Uri;
}
public async Task<string> GetSnapshotUri()
{
MediaUri mediaUri = await Media.GetSnapshotUriAsync(profileToken);
return mediaUri.Uri;
}
#endregion MediaClient
@ -95,8 +132,8 @@ namespace EC.Onvif
public bool IsPTZContected()
{
var r = IsDeviceContected() && (PTZ != null) && !string.IsNullOrEmpty(profileToken);
return r;
bool ret = IsDeviceContected() && (PTZ != null) && !string.IsNullOrEmpty(profileToken);
return ret;
}
/// <summary>
@ -106,7 +143,7 @@ namespace EC.Onvif
/// <param name="tilt"></param>
/// <param name="zoom"></param>
/// <returns></returns>
public async Task AbsoluteMoveAsync(float pan, float tilt, float zoom)
public async Task AbsoluteMove(float pan, float tilt, float zoom)
{
await PTZ.AbsoluteMoveAsync(profileToken, new PTZVector
{
@ -128,7 +165,7 @@ namespace EC.Onvif
/// <param name="pan"></param>
/// <param name="tilt"></param>
/// <param name="zoom"></param>
public async Task RelativeMoveAsync(float pan, float tilt, float zoom)
public async Task RelativeMove(float pan, float tilt, float zoom)
{
await PTZ.RelativeMoveAsync(profileToken, new PTZVector
{
@ -150,7 +187,7 @@ namespace EC.Onvif
/// <param name="pan">0~100</param>
/// <param name="tilt">0~100</param>
/// <param name="zoom">0~100</param>
public async Task ContinuousMoveAsync(float pan, float tilt, float zoom)
public async Task ContinuousMove(float pan, float tilt, float zoom)
{
await PTZ.ContinuousMoveAsync(profileToken, new PTZSpeed
{
@ -166,12 +203,12 @@ namespace EC.Onvif
}, null);
}
public async Task StopMoveAsync()
public async Task StopMove()
{
await PTZ.StopAsync(profileToken, true, true);
}
public async Task<PTZStatus> GetStatusAsync()
public async Task<PTZStatus> GetStatus()
{
return await PTZ.GetStatusAsync(profileToken);
}
@ -182,8 +219,50 @@ namespace EC.Onvif
public bool IsImagingContected()
{
var r = IsDeviceContected();
return r;
bool ret = IsDeviceContected();
return ret;
}
public async Task FocusAbsoluteMove(float position)
{
await Imaging.MoveAsync(videoSourceToken, new FocusMove
{
Absolute = new AbsoluteFocus
{
Position = position,
//Speed = 1f,
//SpeedSpecified = true
}
});
}
public async Task FocusRelativeMove(float distance)
{
await Imaging.MoveAsync(videoSourceToken, new FocusMove
{
Relative = new RelativeFocus
{
Distance = distance,
//Speed = 1f,
//SpeedSpecified = true
}
});
}
public async Task FocusContinuousMove(float speed)
{
await Imaging.MoveAsync(videoSourceToken, new FocusMove
{
Continuous = new ContinuousFocus
{
Speed = speed
}
});
}
public async Task FocusStopMove()
{
await Imaging.StopAsync(videoSourceToken);
}
#endregion ImagingClient

6
BusinessModule/EC.App.ThatBLL/Onvif/Impl/ICurdBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/ICurdBLL.cs

@ -2,12 +2,10 @@
using Furion.DependencyInjection;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif.Impl
namespace EC.App.ThatBLL.Onvif
{
public interface ICurdBLL : IBLL, ISingleton
{
#region Operate
Task<bool> Add(string ip, string username, string password);
bool Remove(string ip);
@ -15,7 +13,5 @@ namespace EC.App.ThatBLL.Onvif.Impl
Task<bool> Update(string ip, string username, string password);
bool IsExist(string ip);
#endregion Operate
}
}

6
BusinessModule/EC.App.ThatBLL/Onvif/Impl/IDeviceBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/IDeviceBLL.cs

@ -1,19 +1,15 @@
using EC.App.Core;
using Furion.DependencyInjection;
namespace EC.App.ThatBLL.Onvif.Impl
namespace EC.App.ThatBLL.Onvif
{
public interface IDeviceBLL : IBLL, ISingleton
{
#region Operate
/// <summary>
/// 是否连接
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
bool IsConnected(string ip);
#endregion Operate
}
}

24
BusinessModule/EC.App.ThatBLL/Onvif/IImagingBLL.cs

@ -0,0 +1,24 @@
using EC.App.Core;
using Furion.DependencyInjection;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif
{
public interface IImagingBLL : IBLL, ISingleton
{
/// <summary>
/// 是否连接
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
bool IsConnected(string ip);
Task<bool> FocusAbsoluteMove(string ip, float position);
Task<bool> FocusRelativeMove(string ip, float distance);
Task<bool> FocusContinuousMove(string ip, float speed);
Task<bool> FocusStopMove(string ip);
}
}

9
BusinessModule/EC.App.ThatBLL/Onvif/Impl/IMediaBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/IMediaBLL.cs

@ -1,12 +1,11 @@
using EC.App.Core;
using Furion.DependencyInjection;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif.Impl
namespace EC.App.ThatBLL.Onvif
{
public interface IMediaBLL : IBLL, ISingleton
{
#region Operate
/// <summary>
/// 是否连接
/// </summary>
@ -14,6 +13,8 @@ namespace EC.App.ThatBLL.Onvif.Impl
/// <returns></returns>
bool IsConnected(string ip);
#endregion Operate
Task<string> GetStreamUri(string ip);
Task<string> GetSnapshotUri(string ip);
}
}

10
BusinessModule/EC.App.ThatBLL/Onvif/Impl/IPTZBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/IPTZBLL.cs

@ -2,12 +2,10 @@
using Furion.DependencyInjection;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif.Impl
namespace EC.App.ThatBLL.Onvif
{
public interface IPTZBLL : IBLL, ISingleton
{
#region Operate
/// <summary>
/// 是否连接
/// </summary>
@ -15,10 +13,6 @@ namespace EC.App.ThatBLL.Onvif.Impl
/// <returns></returns>
bool IsConnected(string ip);
#endregion Operate
#region Move
/// <summary>
/// 绝对移动
/// </summary>
@ -55,7 +49,5 @@ namespace EC.App.ThatBLL.Onvif.Impl
/// <param name="ip"></param>
/// <returns></returns>
Task<bool> StopMove(string ip);
#endregion Move
}
}

27
BusinessModule/EC.App.ThatBLL/Onvif/ImagingBLL.cs

@ -1,27 +0,0 @@
using EC.App.Entity.Onvif;
using EC.App.ThatBLL.Onvif.Impl;
using EC.Onvif;
namespace EC.App.ThatBLL.Onvif
{
public class ImagingBLL : IImagingBLL
{
private readonly OnvifClientService _ocService;
public ImagingBLL(OnvifClientService onvifClientService)
{
_ocService = onvifClientService;
}
#region Operate
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsImagingContected();
return ret;
}
#endregion Operate
}
}

11
BusinessModule/EC.App.ThatBLL/Onvif/CurdBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/Impl/CurdBLL.cs

@ -1,9 +1,8 @@
using EC.App.Entity.Onvif;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatService.Onvif.Impl;
using EC.Onvif;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif
namespace EC.App.ThatBLL.Onvif.Impl
{
public class CurdBLL : ICurdBLL
{
@ -14,14 +13,12 @@ namespace EC.App.ThatBLL.Onvif
_ocService = onvifClientService;
}
#region Operate
public async Task<bool> Add(string ip, string username, string password)
{
bool flag = !_ocService.IsExist(ip);
if (!flag) { return false; }
OnvifClient onvifClient = new OnvifClient(ip, username, password);
await onvifClient.InitAsync();
await onvifClient.Init();
bool ret = _ocService.TryAdd(ip, onvifClient);
return ret;
}
@ -44,7 +41,5 @@ namespace EC.App.ThatBLL.Onvif
bool ret = _ocService.IsExist(ip);
return ret;
}
#endregion Operate
}
}

9
BusinessModule/EC.App.ThatBLL/Onvif/DeviceBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/Impl/DeviceBLL.cs

@ -1,8 +1,7 @@
using EC.App.Entity.Onvif;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatService.Onvif.Impl;
using EC.Onvif;
namespace EC.App.ThatBLL.Onvif
namespace EC.App.ThatBLL.Onvif.Impl
{
public class DeviceBLL : IDeviceBLL
{
@ -13,15 +12,11 @@ namespace EC.App.ThatBLL.Onvif
_ocService = onvifClientService;
}
#region Operate
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsDeviceContected();
return ret;
}
#endregion Operate
}
}

19
BusinessModule/EC.App.ThatBLL/Onvif/Impl/IImagingBLL.cs

@ -1,19 +0,0 @@
using EC.App.Core;
using Furion.DependencyInjection;
namespace EC.App.ThatBLL.Onvif.Impl
{
public interface IImagingBLL : IBLL, ISingleton
{
#region Operate
/// <summary>
/// 是否连接
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
bool IsConnected(string ip);
#endregion Operate
}
}

55
BusinessModule/EC.App.ThatBLL/Onvif/Impl/ImagingBLL.cs

@ -0,0 +1,55 @@
using EC.App.ThatService.Onvif.Impl;
using EC.Onvif;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif.Impl
{
public class ImagingBLL : IImagingBLL
{
private readonly OnvifClientService _ocService;
public ImagingBLL(OnvifClientService onvifClientService)
{
_ocService = onvifClientService;
}
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsImagingContected();
return ret;
}
public async Task<bool> FocusAbsoluteMove(string ip, float position)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.FocusStopMove();
return true;
}
public async Task<bool> FocusRelativeMove(string ip, float distance)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.FocusStopMove();
return true;
}
public async Task<bool> FocusContinuousMove(string ip, float speed)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.FocusStopMove();
return true;
}
public async Task<bool> FocusStopMove(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.FocusStopMove();
return true;
}
}
}

39
BusinessModule/EC.App.ThatBLL/Onvif/Impl/MediaBLL.cs

@ -0,0 +1,39 @@
using EC.App.ThatService.Onvif.Impl;
using EC.Onvif;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif.Impl
{
public class MediaBLL : IMediaBLL
{
private readonly OnvifClientService _ocService;
public MediaBLL(OnvifClientService onvifClientService)
{
_ocService = onvifClientService;
}
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsMediaContected();
return ret;
}
public async Task<string> GetStreamUri(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return string.Empty;
string uri = await onvifClient.GetStreamUri();
return uri;
}
public async Task<string> GetSnapshotUri(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return string.Empty;
string uri = await onvifClient.GetSnapshotUri();
return uri;
}
}
}

21
BusinessModule/EC.App.ThatBLL/Onvif/PTZBLL.cs → BusinessModule/EC.App.ThatBLL/Onvif/Impl/PTZBLL.cs

@ -1,9 +1,8 @@
using EC.App.Entity.Onvif;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatService.Onvif.Impl;
using EC.Onvif;
using System.Threading.Tasks;
namespace EC.App.ThatBLL.Onvif
namespace EC.App.ThatBLL.Onvif.Impl
{
public class PTZBLL : IPTZBLL
{
@ -14,8 +13,6 @@ namespace EC.App.ThatBLL.Onvif
_ocService = onvifClientService;
}
#region Operate
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
@ -23,15 +20,11 @@ namespace EC.App.ThatBLL.Onvif
return ret;
}
#endregion Operate
#region Move
public async Task<bool> AbsoluteMove(string ip, float pan, float tilt, float zoom)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.AbsoluteMoveAsync(pan, tilt, zoom);
await onvifClient.AbsoluteMove(pan, tilt, zoom);
return true;
}
@ -39,7 +32,7 @@ namespace EC.App.ThatBLL.Onvif
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.RelativeMoveAsync(pan, tilt, zoom);
await onvifClient.RelativeMove(pan, tilt, zoom);
return true;
}
@ -47,7 +40,7 @@ namespace EC.App.ThatBLL.Onvif
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.ContinuousMoveAsync(pan, tilt, zoom);
await onvifClient.ContinuousMove(pan, tilt, zoom);
return true;
}
@ -55,10 +48,8 @@ namespace EC.App.ThatBLL.Onvif
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
if (!flag) return false;
await onvifClient.StopMoveAsync();
await onvifClient.StopMove();
return true;
}
#endregion Move
}
}

27
BusinessModule/EC.App.ThatBLL/Onvif/MediaBLL.cs

@ -1,27 +0,0 @@
using EC.App.Entity.Onvif;
using EC.App.ThatBLL.Onvif.Impl;
using EC.Onvif;
namespace EC.App.ThatBLL.Onvif
{
public class MediaBLL : IMediaBLL
{
private readonly OnvifClientService _ocService;
public MediaBLL(OnvifClientService onvifClientService)
{
_ocService = onvifClientService;
}
#region Operate
public bool IsConnected(string ip)
{
bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient);
bool ret = flag && onvifClient.IsMediaContected();
return ret;
}
#endregion Operate
}
}

2
BusinessModule/EC.App.ThatService/Onvif/Impl/IOnvifClientService.cs → BusinessModule/EC.App.ThatService/Onvif/IOnvifClientService.cs

@ -1,7 +1,7 @@
using EC.App.Core;
using Furion.DependencyInjection;
namespace EC.App.ThatService.Onvif.Impl
namespace EC.App.ThatService.Onvif
{
public interface IOnvifClientService : IService, ISingleton
{

4
BusinessModule/EC.App.ThatService/Onvif/OnvifClientService.cs → BusinessModule/EC.App.ThatService/Onvif/Impl/OnvifClientService.cs

@ -1,7 +1,7 @@
using EC.App.ThatService.Onvif.Impl;
using EC.App.Entity.Onvif;
using EC.Onvif;
namespace EC.App.Entity.Onvif
namespace EC.App.ThatService.Onvif.Impl
{
public class OnvifClientService : IOnvifClientService
{

68
OnvifSocketServer/Program.cs

@ -2,6 +2,7 @@
using Flurl.Http;
using Newtonsoft.Json.Linq;
using System;
using System.Net.Http;
namespace OnvifSocketServer
{
@ -10,16 +11,71 @@ namespace OnvifSocketServer
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
TestOnvifUrl();
Console.ReadLine();
}
public static void TestOnvifUrl()
{
string onvifHttpUrl = AppConfig.GetOnvifHttpUrl();
string onvifHttpsUrl = AppConfig.GetOnvifHttpsUrl();
Console.WriteLine(onvifHttpUrl, onvifHttpsUrl);
var baseUri = new Uri(onvifHttpUrl);
var absoluteUri = new Uri(baseUri, "onvif/Curd/IsExist");
JObject result = absoluteUri.AbsoluteUri
.SetQueryParams(new { ip = "192.168.1.105" })
.GetJsonAsync<JObject>().Result;
Uri baseUri = new Uri(onvifHttpUrl);
JObject result;
Console.WriteLine(onvifHttpUrl);
// Get
result = baseUri.AbsoluteUri
.AppendPathSegment("onvif/Curd/IsExist")
.SetQueryParams(new { ip = "192.168.1.108" })
.GetAsync()
.ReceiveJson<JObject>().Result;
Console.WriteLine(result);
// Post
result = baseUri.AbsoluteUri
.AppendPathSegment("onvif/Curd/Add")
.SetQueryParams(new { ip = "192.168.1.65", username = "admin", password = "hk123456" })
.PostAsync()
.ReceiveJson<JObject>().Result;
Console.WriteLine(result);
result = Request(baseUri, "onvif/Media/GetStreamUri", HttpMethod.Get, new { ip = "192.168.1.65" });
result = Request(baseUri, "onvif/Media/GetSnapshotUri", HttpMethod.Get, new { ip = "192.168.1.65" });
// Post
result = Request(baseUri, "onvif/Curd/Add", HttpMethod.Post,
new { ip = "192.168.1.108", username = "admin", password = "hk123456" });
result = Request(baseUri, "onvif/Media/GetStreamUri", HttpMethod.Get, new { ip = "192.168.1.108" });
result = Request(baseUri, "onvif/Media/GetSnapshotUri", HttpMethod.Get, new { ip = "192.168.1.108" });
}
public static JObject Request(Uri uri, string relativePath, HttpMethod httpMethod, object data)
{
Url url = uri.AbsoluteUri.AppendPathSegment(relativePath).SetQueryParams(data);
JObject result;
if (httpMethod == HttpMethod.Get)
{
result = url.GetAsync().ReceiveJson<JObject>().Result;
}
else if (httpMethod == HttpMethod.Post)
{
result = url.PostAsync().ReceiveJson<JObject>().Result;
}
else if (httpMethod == HttpMethod.Put)
{
result = url.PutAsync().ReceiveJson<JObject>().Result; ;
}
else if (httpMethod == HttpMethod.Delete)
{
result = url.DeleteAsync().ReceiveJson<JObject>().Result; ;
}
else
{
result = null;
}
Console.WriteLine(result);
return result;
}
}
}

4
OnvifSocketServer/appsettings.json

@ -1,6 +1,6 @@
{
"Apis": {
"onvif_http_url": "http://localhost:5000",
"onvif_https_url": "https://localhost:5001"
"onvif_http_url": "http://localhost:6000",
"onvif_https_url": "https://localhost:6001"
}
}

6
OnvifWebServer/Controllers/Onvif/CurdController.cs

@ -1,5 +1,5 @@
using EC.App.Core;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
@ -25,8 +25,6 @@ namespace OnvifWebServer.Controllers.Onvif
_curdBLL = curdBLL;
}
#region Operate
/// <summary>
/// 添加 onvif
/// </summary>
@ -84,7 +82,5 @@ namespace OnvifWebServer.Controllers.Onvif
bool ret = _curdBLL.IsExist(ip);
return ret;
}
#endregion Operate
}
}

6
OnvifWebServer/Controllers/Onvif/DeviceController.cs

@ -1,5 +1,5 @@
using EC.App.Core;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
@ -24,8 +24,6 @@ namespace OnvifWebServer.Controllers.Onvif
this._deviceBLL = deviceBLL;
}
#region Operate
/// <summary>
/// 是否连接
/// </summary>
@ -38,7 +36,5 @@ namespace OnvifWebServer.Controllers.Onvif
bool ret = _deviceBLL.IsConnected(ip);
return ret;
}
#endregion Operate
}
}

62
OnvifWebServer/Controllers/Onvif/ImagingController.cs

@ -1,8 +1,9 @@
using EC.App.Core;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace OnvifWebServer.Controllers.Onvif
{
@ -24,8 +25,6 @@ namespace OnvifWebServer.Controllers.Onvif
this._imagingBLL = imagingBLL;
}
#region Operate
/// <summary>
/// 是否连接
/// </summary>
@ -39,6 +38,61 @@ namespace OnvifWebServer.Controllers.Onvif
return ret;
}
#endregion Operate
/// <summary>
/// 变焦绝对移动
/// </summary>
/// <param name="ip"></param>
/// <param name="position"></param>
/// <returns></returns>
[HttpGet]
public async Task<bool> FocusAbsoluteMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float position)
{
bool ret = await _imagingBLL.FocusAbsoluteMove(ip, position);
return ret;
}
/// <summary>
/// 变焦相对移动
/// </summary>
/// <param name="ip"></param>
/// <param name="distance"></param>
/// <returns></returns>
[HttpGet]
public async Task<bool> FocusRelativeMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float distance)
{
bool ret = await _imagingBLL.FocusRelativeMove(ip, distance);
return ret;
}
/// <summary>
/// 变焦持续移动
/// </summary>
/// <param name="ip"></param>
/// <param name="speed"></param>
/// <returns></returns>
[HttpGet]
public async Task<bool> FocusContinuousMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float speed)
{
bool ret = await _imagingBLL.FocusContinuousMove(ip, speed);
return ret;
}
/// <summary>
/// 停止变焦
/// </summary>
/// <param name="ip">IP地址</param>
[HttpGet]
public async Task<bool> FocusStopMove(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
bool ret = await _imagingBLL.FocusStopMove(ip);
return ret;
}
}
}

31
OnvifWebServer/Controllers/Onvif/MediaController.cs

@ -1,8 +1,9 @@
using EC.App.Core;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace OnvifWebServer.Controllers.Onvif
{
@ -24,8 +25,6 @@ namespace OnvifWebServer.Controllers.Onvif
this._mediaBLL = mediaBLL;
}
#region Operate
/// <summary>
/// 是否连接
/// </summary>
@ -39,6 +38,30 @@ namespace OnvifWebServer.Controllers.Onvif
return ret;
}
#endregion Operate
/// <summary>
/// 获取播放视频 URL
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public async Task<string> GetStreamUri(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string uri = await _mediaBLL.GetStreamUri(ip);
return uri;
}
/// <summary>
/// 获取抓图 URL
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
[HttpGet]
public async Task<string> GetSnapshotUri(
[Required][DataValidation(ValidationTypes.IPv4)] string ip)
{
string uri = await _mediaBLL.GetSnapshotUri(ip);
return uri;
}
}
}

16
OnvifWebServer/Controllers/Onvif/PTZController.cs

@ -1,5 +1,5 @@
using EC.App.Core;
using EC.App.ThatBLL.Onvif.Impl;
using EC.App.ThatBLL.Onvif;
using Furion.DataValidation;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel.DataAnnotations;
@ -25,8 +25,6 @@ namespace OnvifWebServer.Controllers.Onvif
this._ptzBLL = ptzBLL;
}
#region Operate
/// <summary>
/// 是否连接
/// </summary>
@ -40,10 +38,6 @@ namespace OnvifWebServer.Controllers.Onvif
return ret;
}
#endregion Operate
#region Move
/// <summary>
/// 绝对移动
/// </summary>
@ -54,7 +48,7 @@ namespace OnvifWebServer.Controllers.Onvif
/// <returns></returns>
[HttpGet]
public async Task<bool> AbsoluteMove(
[DataValidation(ValidationTypes.IPv4)] string ip,
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float pan, [Required] float tilt, [Required] float zoom)
{
bool ret = await _ptzBLL.AbsoluteMove(ip, pan, tilt, zoom);
@ -70,7 +64,7 @@ namespace OnvifWebServer.Controllers.Onvif
/// <param name="zoom">变焦绝对点</param>
[HttpGet]
public async Task<bool> RelativeMove(
[DataValidation(ValidationTypes.IPv4)] string ip,
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float pan, [Required] float tilt, [Required] float zoom)
{
bool ret = await _ptzBLL.RelativeMove(ip, pan, tilt, zoom);
@ -86,7 +80,7 @@ namespace OnvifWebServer.Controllers.Onvif
/// <param name="zoom">变焦绝对点</param>
[HttpGet]
public async Task<bool> ContinuousMove(
[DataValidation(ValidationTypes.IPv4)] string ip,
[Required][DataValidation(ValidationTypes.IPv4)] string ip,
[Required] float pan, [Required] float tilt, [Required] float zoom)
{
bool ret = await _ptzBLL.ContinuousMove(ip, pan, tilt, zoom);
@ -104,7 +98,5 @@ namespace OnvifWebServer.Controllers.Onvif
bool ret = await _ptzBLL.StopMove(ip);
return ret;
}
#endregion Move
}
}

4
OnvifWebServer/Controllers/Onvif/TestController.cs

@ -14,8 +14,6 @@ namespace OnvifWebServer.Controllers.Onvif
{
}
#region Operate
[HttpGet]
public string TestString(string ip)
{
@ -34,7 +32,5 @@ namespace OnvifWebServer.Controllers.Onvif
throw new Exception("test");
return ip;
}
#endregion Operate
}
}

2
OnvifWebServer/Properties/launchSettings.json

@ -20,7 +20,7 @@
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"applicationUrl": "https://localhost:6001;http://localhost:6000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}

Loading…
Cancel
Save