ONVIF: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Retrieve date time == <pre class="code">TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress devi...") |
No edit summary |
||
Line 1: | Line 1: | ||
== Retrieve | == C# Retrieve Date Time == | ||
<pre class="code">TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement(); | <pre class="code">TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement(); | ||
messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); | messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); |
Revision as of 15:04, 7 December 2023
C# Retrieve Date Time
TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement(); messageElement.MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None); HttpTransportBindingElement httpBinding = new HttpTransportBindingElement(); httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; CustomBinding bind = new CustomBinding(messageElement, httpBinding); EndpointAddress deviceAddress = new EndpointAddress("http://127.0.0.1:8888/onvif/device_service"); DeviceClient deviceClient = new DeviceClient(bind, deviceAddress); deviceClient.ClientCredentials.UserName.UserName = "admin"; deviceClient.ClientCredentials.UserName.Password = "password"; SystemDateTime dateTime = deviceClient.GetSystemDateAndTime(); Console.WriteLine(dateTime.UTCDateTime.Date.Day.ToString() + "/" + dateTime.UTCDateTime.Date.Month.ToString() + "/" + dateTime.UTCDateTime.Date.Year.ToString() + " " + dateTime.UTCDateTime.Time.Hour + ":" + dateTime.UTCDateTime.Time.Minute + ":" + dateTime.UTCDateTime.Time.Second);
{"result":[{"id":1,"objectClass":"Handbag","x":0.301338,"y":0.89906,"width":0.234911,"height":0.10094}],"error":null,"id":"id"}