public void Configure(Object client) { NodeDiscovery.Gateway.SensorValuesClient ssclient = (NodeDiscovery.Gateway.SensorValuesClient)client; NodeDiscovery.Gateway.SSimpControl control = new NodeDiscovery.Gateway.SSimpControl(); Console.WriteLine("\nSet time (y/N)"); if (Console.ReadLine().ToLower().Equals("y")) { control.NewTime = DateTime.Now; control.NewTimeSpecified = true; } ; Console.WriteLine("\nSet Sensors (y/N)"); if (Console.ReadLine().ToLower().Equals("y")) { control.SensorConfig = new NodeDiscovery.Gateway.SensorConfigurationType(); Console.WriteLine("\nAcclRate"); try { sbyte input = sbyte.Parse(Console.ReadLine()); if (input > 0) { control.SensorConfig.Acceleration = new NodeDiscovery.Gateway.SSimpRateConfig(); control.SensorConfig.Acceleration.rate = input; } } catch (ArgumentException) { } } ; NodeDiscovery.Gateway.SSimpStatus response = ssclient.Config(control); // Show the results in the console window. Console.WriteLine("Configuration set successful. Current Status:"); Console.WriteLine("(New) time: {0}", response.CurrentTime); Console.WriteLine("BatteryVoltage: {0}", response.BatteryVoltage); Console.WriteLine("SensorConfigurarion: {0}", response.SensorConfig.ToString()); Console.WriteLine("SensorCapabilities: {0}", response.AllSensorConfig.ToString()); Console.WriteLine("Uptime: {0}", response.UpTime); }
public void ReadSensorValues(Object client) { NodeDiscovery.Gateway.SensorValuesClient ssclient = (NodeDiscovery.Gateway.SensorValuesClient)client; NodeDiscovery.Gateway.SSimpSample response; do { response = ssclient.GetSensorValues(); // Show the results in the console window. ShowValues(response); Console.WriteLine("Read Again?"); } while (Console.ReadLine().ToLower().Equals("y")); }