ONVIF
Jump to navigation
Jump to search
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"}