private static TC08DeviceImports.TempUnit GetUnits(CommandArgs command) { TC08DeviceImports.TempUnit units = TC08DeviceImports.TempUnit.USBTC08_UNITS_CENTIGRADE; if (command.Unit.Length == 1) { if (command.Unit.ToLower()[0] == 'k') { units = TC08DeviceImports.TempUnit.USBTC08_UNITS_KELVIN; } if (command.Unit.ToLower()[0] == 'f') { units = TC08DeviceImports.TempUnit.USBTC08_UNITS_FAHRENHEIT; } } return(units); }
/// <summary> /// Gets the temperature values. /// </summary> /// <param name="unit">The temperature unit.</param> /// <returns></returns> /// <exception cref="TC08Exception"></exception> public unsafe float[] GetValues(TC08DeviceImports.TempUnit unit) { float[] data = new float[9]; short overflows; short result = TC08DeviceImports.GetSingle(Handle, data, &overflows, unit); if (result == 0) { throw new TC08Exception(result); } for (int i = 0; i < data.Length; i++) { data[i] = (float)Math.Round(data[i], 2); } return(data); }