Ejemplo n.º 1
0
        public string GetDeviceInformation()
        {
            string result   = String.Empty;
            string firmware = String.Empty;
            string serial   = String.Empty;
            string hardware = String.Empty;
            string model    = String.Empty;

            if (deviceioClient != null)
            {
                try
                {
                    deviceioClient.GetDeviceInformation(out model, out firmware, out serial, out hardware);

                    deviceInformation.Model    = model;
                    deviceInformation.Firmware = firmware;
                    deviceInformation.Serial   = serial;
                    deviceInformation.Hardware = hardware;

                    result = string.Format("Model {0}, FirmwareVersion {1}, SerialNumber {2}, HardwareId {3}",
                                           model, firmware, serial, hardware);
                }
                catch (Exception ex)
                {
                    Logger.Write(ex);
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static string GetDeviceInformation(Uri uri)
        {
            HttpTransportBindingElement httpBinding = new HttpTransportBindingElement()
            {
                AuthenticationScheme = AuthenticationSchemes.Digest//AuthenticationSchemes.Digest
            };

            EndpointAddress endpointAddress = new EndpointAddress(uri);

            TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement()
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };

            CustomBinding binding = new CustomBinding(messageElement, httpBinding);

            deviceio.DeviceClient deviceioDeviceClient = new deviceio.DeviceClient(binding, endpointAddress);

            string result = String.Empty;

            string firmware = String.Empty;
            string serial   = String.Empty;
            string hardware = String.Empty;
            string model    = String.Empty;

            if (deviceioDeviceClient != null)
            {
                try
                {
                    deviceioDeviceClient.GetDeviceInformation(out model, out firmware, out serial, out hardware);

                    result = string.Format("{0}", model);

                    //result = string.Format("Model {0}, FirmwareVersion {1}, SerialNumber {2}, HardwareId {3}",
                    //                 model, firmware, serial, hardware);
                }
                catch (Exception ex)
                {
                    Logger.Write(ex);
                    result = string.Format("{0} GetDeviceInformation() error....");
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public static string GetDeviceInformation(Uri uri)
        {
            HttpTransportBindingElement httpBinding = new HttpTransportBindingElement()
            {
                AuthenticationScheme = AuthenticationSchemes.Digest//AuthenticationSchemes.Digest
            };

            EndpointAddress endpointAddress = new EndpointAddress(uri);

            TextMessageEncodingBindingElement messageElement = new TextMessageEncodingBindingElement()
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };

            CustomBinding binding = new CustomBinding(messageElement, httpBinding);

            deviceio.DeviceClient deviceioDeviceClient = new deviceio.DeviceClient(binding, endpointAddress);

            string result = String.Empty;

            string firmware = String.Empty;
            string serial = String.Empty;
            string hardware = String.Empty;
            string model = String.Empty;

            if (deviceioDeviceClient != null)
            {
                try
                {
                    deviceioDeviceClient.GetDeviceInformation(out model, out firmware, out serial, out hardware);

                    result = string.Format("{0}", model);

                    //result = string.Format("Model {0}, FirmwareVersion {1}, SerialNumber {2}, HardwareId {3}",
                    //                 model, firmware, serial, hardware);
                }
                catch (Exception ex)
                {
                    Logger.Write(ex);
                    result = string.Format("{0} GetDeviceInformation() error....");
                }
            }

            return result;
        }