diff --git a/BaseModule/EC.Onvif/Discovery/DiscoveryClient.cs b/BaseModule/EC.Onvif/Discovery/DiscoveryClient.cs new file mode 100644 index 0000000..66ba616 --- /dev/null +++ b/BaseModule/EC.Onvif/Discovery/DiscoveryClient.cs @@ -0,0 +1,725 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,并在以下条件下丢失: +// 代码重新生成。 +// +//------------------------------------------------------------------------------ + +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 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 ByeAsync(ByeRequest request); + } + + /// + [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; + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=0)] + public AttributedURI Address + { + get + { + return this.addressField; + } + set + { + this.addressField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public ReferencePropertiesType ReferenceProperties + { + get + { + return this.referencePropertiesField; + } + set + { + this.referencePropertiesField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public ReferenceParametersType ReferenceParameters + { + get + { + return this.referenceParametersField; + } + set + { + this.referenceParametersField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public AttributedQName PortType + { + get + { + return this.portTypeField; + } + set + { + this.portTypeField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=4)] + public ServiceNameType ServiceName + { + get + { + return this.serviceNameField; + } + set + { + this.serviceNameField = value; + } + } + + /// + [System.Xml.Serialization.XmlAnyElementAttribute(Order=5)] + public System.Xml.XmlElement[] Any + { + get + { + return this.anyField; + } + set + { + this.anyField = value; + } + } + } + + /// + [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; + + /// + [System.Xml.Serialization.XmlTextAttribute(DataType="anyURI")] + public string Value + { + get + { + return this.valueField; + } + set + { + this.valueField = value; + } + } + } + + /// + [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; + + /// + [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; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=1)] + public string Types + { + get + { + return this.typesField; + } + set + { + this.typesField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=2)] + public ScopesType Scopes + { + get + { + return this.scopesField; + } + set + { + this.scopesField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=3)] + public string XAddrs + { + get + { + return this.xAddrsField; + } + set + { + this.xAddrsField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Order=4)] + public uint MetadataVersion + { + get + { + return this.metadataVersionField; + } + set + { + this.metadataVersionField = value; + } + } + + /// + [System.Xml.Serialization.XmlAnyElementAttribute(Order=5)] + public System.Xml.XmlElement[] Any + { + get + { + return this.anyField; + } + set + { + this.anyField = value; + } + } + } + + /// + [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; + + /// + [System.Xml.Serialization.XmlAttributeAttribute(DataType="anyURI")] + public string MatchBy + { + get + { + return this.matchByField; + } + set + { + this.matchByField = value; + } + } + + /// + [System.Xml.Serialization.XmlTextAttribute(DataType="anyURI")] + public string[] Text + { + get + { + return this.textField; + } + set + { + this.textField = value; + } + } + } + + /// + [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; + + /// + [System.Xml.Serialization.XmlAttributeAttribute(DataType="NCName")] + public string PortName + { + get + { + return this.portNameField; + } + set + { + this.portNameField = value; + } + } + + /// + [System.Xml.Serialization.XmlTextAttribute()] + public System.Xml.XmlQualifiedName Value + { + get + { + return this.valueField; + } + set + { + this.valueField = value; + } + } + } + + /// + [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; + + /// + [System.Xml.Serialization.XmlTextAttribute()] + public System.Xml.XmlQualifiedName Value + { + get + { + return this.valueField; + } + set + { + this.valueField = value; + } + } + } + + /// + [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; + + /// + [System.Xml.Serialization.XmlAnyElementAttribute(Order=0)] + public System.Xml.XmlElement[] Any + { + get + { + return this.anyField; + } + set + { + this.anyField = value; + } + } + } + + /// + [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; + + /// + [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 + { + + 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 HelloAsync(HelloRequest request) + { + return base.Channel.HelloAsync(request); + } + + public ByeResponse Bye(ByeRequest request) + { + return base.Channel.Bye(request); + } + + public System.Threading.Tasks.Task 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.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.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 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 + { + + 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 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.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.ServiceModel.ICommunicationObject)(this)).EndClose)); + } + } +} diff --git a/BaseModule/EC.Onvif/OnvifClient.cs b/BaseModule/EC.Onvif/OnvifClient.cs index b764945..cb7b92c 100644 --- a/BaseModule/EC.Onvif/OnvifClient.cs +++ b/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 GetStreamUri() + { + MediaUri mediaUri = await Media.GetStreamUriAsync(RtspStreamSetup, profileToken); + return mediaUri.Uri; + } + + public async Task 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; } /// @@ -106,7 +143,7 @@ namespace EC.Onvif /// /// /// - 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 /// /// /// - 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 /// 0~100 /// 0~100 /// 0~100 - 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 GetStatusAsync() + public async Task 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 diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/ICurdBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/ICurdBLL.cs similarity index 80% rename from BusinessModule/EC.App.ThatBLL/Onvif/Impl/ICurdBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/ICurdBLL.cs index 8c611f2..b59ffe2 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/ICurdBLL.cs +++ b/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 Add(string ip, string username, string password); bool Remove(string ip); @@ -15,7 +13,5 @@ namespace EC.App.ThatBLL.Onvif.Impl Task Update(string ip, string username, string password); bool IsExist(string ip); - - #endregion Operate } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IDeviceBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/IDeviceBLL.cs similarity index 76% rename from BusinessModule/EC.App.ThatBLL/Onvif/Impl/IDeviceBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/IDeviceBLL.cs index ea49f6f..0438ed8 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IDeviceBLL.cs +++ b/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 - /// /// 是否连接 /// /// /// bool IsConnected(string ip); - - #endregion Operate } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/IImagingBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/IImagingBLL.cs new file mode 100644 index 0000000..b168763 --- /dev/null +++ b/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 + { + /// + /// 是否连接 + /// + /// + /// + bool IsConnected(string ip); + + Task FocusAbsoluteMove(string ip, float position); + + Task FocusRelativeMove(string ip, float distance); + + Task FocusContinuousMove(string ip, float speed); + + Task FocusStopMove(string ip); + } +} \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IMediaBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/IMediaBLL.cs similarity index 63% rename from BusinessModule/EC.App.ThatBLL/Onvif/Impl/IMediaBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/IMediaBLL.cs index 0a5fb23..25169dc 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IMediaBLL.cs +++ b/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 - /// /// 是否连接 /// @@ -14,6 +13,8 @@ namespace EC.App.ThatBLL.Onvif.Impl /// bool IsConnected(string ip); - #endregion Operate + Task GetStreamUri(string ip); + + Task GetSnapshotUri(string ip); } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IPTZBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/IPTZBLL.cs similarity index 91% rename from BusinessModule/EC.App.ThatBLL/Onvif/Impl/IPTZBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/IPTZBLL.cs index bf4e3cc..7cffcb0 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IPTZBLL.cs +++ b/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 - /// /// 是否连接 /// @@ -15,10 +13,6 @@ namespace EC.App.ThatBLL.Onvif.Impl /// bool IsConnected(string ip); - #endregion Operate - - #region Move - /// /// 绝对移动 /// @@ -55,7 +49,5 @@ namespace EC.App.ThatBLL.Onvif.Impl /// /// Task StopMove(string ip); - - #endregion Move } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/ImagingBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/ImagingBLL.cs deleted file mode 100644 index 161d63d..0000000 --- a/BusinessModule/EC.App.ThatBLL/Onvif/ImagingBLL.cs +++ /dev/null @@ -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 - } -} \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/CurdBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/Impl/CurdBLL.cs similarity index 83% rename from BusinessModule/EC.App.ThatBLL/Onvif/CurdBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/Impl/CurdBLL.cs index eafb866..686b3fd 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/CurdBLL.cs +++ b/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 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 } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/DeviceBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/Impl/DeviceBLL.cs similarity index 74% rename from BusinessModule/EC.App.ThatBLL/Onvif/DeviceBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/Impl/DeviceBLL.cs index da36807..a53e53e 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/DeviceBLL.cs +++ b/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 } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IImagingBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IImagingBLL.cs deleted file mode 100644 index e18d352..0000000 --- a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/IImagingBLL.cs +++ /dev/null @@ -1,19 +0,0 @@ -using EC.App.Core; -using Furion.DependencyInjection; - -namespace EC.App.ThatBLL.Onvif.Impl -{ - public interface IImagingBLL : IBLL, ISingleton - { - #region Operate - - /// - /// 是否连接 - /// - /// - /// - bool IsConnected(string ip); - - #endregion Operate - } -} \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/ImagingBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/Impl/ImagingBLL.cs new file mode 100644 index 0000000..19f1786 --- /dev/null +++ b/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 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 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 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 FocusStopMove(string ip) + { + bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient); + if (!flag) return false; + await onvifClient.FocusStopMove(); + return true; + } + } +} \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/Impl/MediaBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/Impl/MediaBLL.cs new file mode 100644 index 0000000..565f827 --- /dev/null +++ b/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 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 GetSnapshotUri(string ip) + { + bool flag = _ocService.TryGet(ip, out OnvifClient onvifClient); + if (!flag) return string.Empty; + string uri = await onvifClient.GetSnapshotUri(); + return uri; + } + } +} \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/PTZBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/Impl/PTZBLL.cs similarity index 75% rename from BusinessModule/EC.App.ThatBLL/Onvif/PTZBLL.cs rename to BusinessModule/EC.App.ThatBLL/Onvif/Impl/PTZBLL.cs index 9a2983e..6d169c1 100644 --- a/BusinessModule/EC.App.ThatBLL/Onvif/PTZBLL.cs +++ b/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 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 } } \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatBLL/Onvif/MediaBLL.cs b/BusinessModule/EC.App.ThatBLL/Onvif/MediaBLL.cs deleted file mode 100644 index 5f07339..0000000 --- a/BusinessModule/EC.App.ThatBLL/Onvif/MediaBLL.cs +++ /dev/null @@ -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 - } -} \ No newline at end of file diff --git a/BusinessModule/EC.App.ThatService/Onvif/Impl/IOnvifClientService.cs b/BusinessModule/EC.App.ThatService/Onvif/IOnvifClientService.cs similarity index 75% rename from BusinessModule/EC.App.ThatService/Onvif/Impl/IOnvifClientService.cs rename to BusinessModule/EC.App.ThatService/Onvif/IOnvifClientService.cs index 440d3d1..a69d8e7 100644 --- a/BusinessModule/EC.App.ThatService/Onvif/Impl/IOnvifClientService.cs +++ b/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 { diff --git a/BusinessModule/EC.App.ThatService/Onvif/OnvifClientService.cs b/BusinessModule/EC.App.ThatService/Onvif/Impl/OnvifClientService.cs similarity index 91% rename from BusinessModule/EC.App.ThatService/Onvif/OnvifClientService.cs rename to BusinessModule/EC.App.ThatService/Onvif/Impl/OnvifClientService.cs index 56bb6b8..b2eb952 100644 --- a/BusinessModule/EC.App.ThatService/Onvif/OnvifClientService.cs +++ b/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 { diff --git a/OnvifSocketServer/Program.cs b/OnvifSocketServer/Program.cs index 240be2c..516a28b 100644 --- a/OnvifSocketServer/Program.cs +++ b/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().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().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().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().Result; + } + else if (httpMethod == HttpMethod.Post) + { + result = url.PostAsync().ReceiveJson().Result; + } + else if (httpMethod == HttpMethod.Put) + { + result = url.PutAsync().ReceiveJson().Result; ; + } + else if (httpMethod == HttpMethod.Delete) + { + result = url.DeleteAsync().ReceiveJson().Result; ; + } + else + { + result = null; + } Console.WriteLine(result); + return result; } } } \ No newline at end of file diff --git a/OnvifSocketServer/appsettings.json b/OnvifSocketServer/appsettings.json index 74768ad..f6379aa 100644 --- a/OnvifSocketServer/appsettings.json +++ b/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" } } \ No newline at end of file diff --git a/OnvifWebServer/Controllers/Onvif/CurdController.cs b/OnvifWebServer/Controllers/Onvif/CurdController.cs index b695223..ef8443a 100644 --- a/OnvifWebServer/Controllers/Onvif/CurdController.cs +++ b/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 - /// /// 添加 onvif /// @@ -84,7 +82,5 @@ namespace OnvifWebServer.Controllers.Onvif bool ret = _curdBLL.IsExist(ip); return ret; } - - #endregion Operate } } \ No newline at end of file diff --git a/OnvifWebServer/Controllers/Onvif/DeviceController.cs b/OnvifWebServer/Controllers/Onvif/DeviceController.cs index 1504594..97ad0f4 100644 --- a/OnvifWebServer/Controllers/Onvif/DeviceController.cs +++ b/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 - /// /// 是否连接 /// @@ -38,7 +36,5 @@ namespace OnvifWebServer.Controllers.Onvif bool ret = _deviceBLL.IsConnected(ip); return ret; } - - #endregion Operate } } \ No newline at end of file diff --git a/OnvifWebServer/Controllers/Onvif/ImagingController.cs b/OnvifWebServer/Controllers/Onvif/ImagingController.cs index 62e14c2..2003763 100644 --- a/OnvifWebServer/Controllers/Onvif/ImagingController.cs +++ b/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 - /// /// 是否连接 /// @@ -39,6 +38,61 @@ namespace OnvifWebServer.Controllers.Onvif return ret; } - #endregion Operate + /// + /// 变焦绝对移动 + /// + /// + /// + /// + [HttpGet] + public async Task FocusAbsoluteMove( + [Required][DataValidation(ValidationTypes.IPv4)] string ip, + [Required] float position) + { + bool ret = await _imagingBLL.FocusAbsoluteMove(ip, position); + return ret; + } + + /// + /// 变焦相对移动 + /// + /// + /// + /// + [HttpGet] + public async Task FocusRelativeMove( + [Required][DataValidation(ValidationTypes.IPv4)] string ip, + [Required] float distance) + { + bool ret = await _imagingBLL.FocusRelativeMove(ip, distance); + return ret; + } + + /// + /// 变焦持续移动 + /// + /// + /// + /// + [HttpGet] + public async Task FocusContinuousMove( + [Required][DataValidation(ValidationTypes.IPv4)] string ip, + [Required] float speed) + { + bool ret = await _imagingBLL.FocusContinuousMove(ip, speed); + return ret; + } + + /// + /// 停止变焦 + /// + /// IP地址 + [HttpGet] + public async Task FocusStopMove( + [Required][DataValidation(ValidationTypes.IPv4)] string ip) + { + bool ret = await _imagingBLL.FocusStopMove(ip); + return ret; + } } } \ No newline at end of file diff --git a/OnvifWebServer/Controllers/Onvif/MediaController.cs b/OnvifWebServer/Controllers/Onvif/MediaController.cs index 40c827e..a27d640 100644 --- a/OnvifWebServer/Controllers/Onvif/MediaController.cs +++ b/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 - /// /// 是否连接 /// @@ -39,6 +38,30 @@ namespace OnvifWebServer.Controllers.Onvif return ret; } - #endregion Operate + /// + /// 获取播放视频 URL + /// + /// + /// + [HttpGet] + public async Task GetStreamUri( + [Required][DataValidation(ValidationTypes.IPv4)] string ip) + { + string uri = await _mediaBLL.GetStreamUri(ip); + return uri; + } + + /// + /// 获取抓图 URL + /// + /// + /// + [HttpGet] + public async Task GetSnapshotUri( + [Required][DataValidation(ValidationTypes.IPv4)] string ip) + { + string uri = await _mediaBLL.GetSnapshotUri(ip); + return uri; + } } } \ No newline at end of file diff --git a/OnvifWebServer/Controllers/Onvif/PTZController.cs b/OnvifWebServer/Controllers/Onvif/PTZController.cs index b00dd9d..fe18525 100644 --- a/OnvifWebServer/Controllers/Onvif/PTZController.cs +++ b/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 - /// /// 是否连接 /// @@ -40,10 +38,6 @@ namespace OnvifWebServer.Controllers.Onvif return ret; } - #endregion Operate - - #region Move - /// /// 绝对移动 /// @@ -54,7 +48,7 @@ namespace OnvifWebServer.Controllers.Onvif /// [HttpGet] public async Task 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 /// 变焦绝对点 [HttpGet] public async Task 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 /// 变焦绝对点 [HttpGet] public async Task 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 } } \ No newline at end of file diff --git a/OnvifWebServer/Controllers/Onvif/TestController.cs b/OnvifWebServer/Controllers/Onvif/TestController.cs index 0d2d658..108e812 100644 --- a/OnvifWebServer/Controllers/Onvif/TestController.cs +++ b/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 } } \ No newline at end of file diff --git a/OnvifWebServer/Properties/launchSettings.json b/OnvifWebServer/Properties/launchSettings.json index 0006c7d..fee36ac 100644 --- a/OnvifWebServer/Properties/launchSettings.json +++ b/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" }