Ejemplo n.º 1
0
        private static void invokeStopDevice(EndpointAddress hostedEndPoint)
        {
            using (DeviceInfoServiceClient client = new DeviceInfoServiceClient("DeviceInfoService", hostedEndPoint))
            {
                // Connect to the discovered service endpoint.
                client.Endpoint.Address = hostedEndPoint;
                client.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 0, 2);
                client.Open();

                client.StopNode();

                // Closing the client gracefully closes the connection and cleans up resources.
                client.Close();
            }
        }
Ejemplo n.º 2
0
        private static void invokeGetDeviceStatus(EndpointAddress hostedEndPoint)
        {
            using (DeviceInfoServiceClient client = new DeviceInfoServiceClient("DeviceInfoService", hostedEndPoint))
            {
                // Connect to the discovered service endpoint.
                client.Endpoint.Address = hostedEndPoint;
                client.Endpoint.Binding.ReceiveTimeout = new TimeSpan(0, 0, 2);
                client.Open();

                StatusMessage msg = client.GetNodeStatus();
                Console.WriteLine("Device Status: Desc: {0} Ready: {1}", msg.description, msg.ready);

                // Closing the client gracefully closes the connection and cleans up resources.
                client.Close();
            }
        }