public static string DescriptionForValue(this HMCharacteristic self, int value)
        {
            if (self.IsBoolean())
            {
                return(Convert.ToBoolean(value) ? "On" : "Off");
            }

            var predeterminedValueString = self.PredeterminedValueDescriptionForNumber(value);

            if (predeterminedValueString != null)
            {
                return(predeterminedValueString);
            }

            var metadata = self.Metadata;

            if (metadata != null)
            {
                var stepValue = metadata.StepValue;
                if (stepValue != null)
                {
                    formatter.MaximumFractionDigits = (int)Math.Log10(1f / stepValue.DoubleValue);
                    var str = formatter.StringFromNumber(value);
                    if (!string.IsNullOrEmpty(str))
                    {
                        return(str + self.LocalizedUnitDescription());
                    }
                }
            }

            return(value.ToString());
        }
        public static bool HasPredeterminedValueDescriptions(this HMCharacteristic self)
        {
            var number = self.Value as NSNumber;

            if (number == null)
            {
                return(false);
            }

            var num = number.Int32Value;

            return(self.PredeterminedValueDescriptionForNumber(num) != null);
        }