ONVIF: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
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