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 |
||
(2 intermediate revisions by the same user not shown) | |||
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); | ||
Line 5: | Line 5: | ||
httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; | httpBinding.AuthenticationScheme = AuthenticationSchemes.Basic; | ||
CustomBinding bind = new CustomBinding(messageElement, httpBinding); | CustomBinding bind = new CustomBinding(messageElement, httpBinding); | ||
EndpointAddress deviceAddress = new EndpointAddress("http:// | EndpointAddress deviceAddress = new EndpointAddress("http://192.168.0.10:8888/onvif/device_service"); | ||
DeviceClient deviceClient = new DeviceClient(bind, deviceAddress); | DeviceClient deviceClient = new DeviceClient(bind, deviceAddress); | ||
deviceClient.ClientCredentials.UserName.UserName = "admin"; | deviceClient.ClientCredentials.UserName.UserName = "admin"; | ||
Line 11: | Line 11: | ||
SystemDateTime dateTime = deviceClient.GetSystemDateAndTime(); | 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);</pre> | 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);</pre> | ||
<code> | |||
<code>7/12/2023 15:9:49</code> |
Latest revision as of 15:09, 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://192.168.0.10: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);
7/12/2023 15:9:49