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(); } }
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(); } }