public void Test() { var mgr = new ISensorManager(); foreach (var s in mgr.GetSensorsByCategory(Sensors.SENSOR_CATEGORY_ALL).Enumerate()) { Console.WriteLine($"{s.GetFriendlyName()}: {s.GetID()}"); var vals = s.GetProperties(null); foreach (var pv in vals.Enumerate()) { Console.WriteLine($" {pv.Item2}"); } } }
/// <summary> /// Retrieves a list of sensors by the category GUID. /// </summary> /// <param name="sensorCategory">The category GUID. You can find a list of GUIDs in <see cref="SensorWrapper.SensorCategories"/> class.</param> /// <returns>A list of sensor wrappers. You should cast them to derived types, if available. If no sensors are available, an empty array is returned.</returns> public static Sensor[] GetSensorsByCategory(Guid sensorCategory) { ISensorCollection sensorCollection = null; _sensorMgr.GetSensorsByCategory(sensorCategory, out sensorCollection); if (sensorCollection != null) { uint sensorCount = 0; sensorCollection.GetCount(out sensorCount); Sensor[] foundSensors = new Sensor[sensorCount]; for (uint i = 0; i < sensorCount; i++) { ISensor iSensor = null; sensorCollection.GetAt(i, out iSensor); Sensor sensor = GetSensorWrapperInstance(iSensor); foundSensors[i] = sensor; } return(foundSensors); } return(new Sensor[0]); }