in GattServicesLibrary/GattServicesLibrary/Helpers/ValueConverter.cs [50:122]
public static string ConvertValueBufferToString(IBuffer value, GattPresentationFormat format = null)
{
// no format, return bytes
if (format == null)
{
return GattConvert.ToHexString(value);
}
// Bool
if (format.FormatType == GattPresentationFormatTypes.Boolean)
{
// Previous implementation was incorrect. Need to implement in GattHelper.
throw new NotImplementedException();
}
else if (format.FormatType == GattPresentationFormatTypes.Bit2 ||
format.FormatType == GattPresentationFormatTypes.Nibble)
{
// 2bit or nibble - no exponent
// Previous implementation was incorrect. Need to implement in GattHelper.
return GattConvert.ToHexString(value);
}
else if (format.FormatType == GattPresentationFormatTypes.UInt8 ||
format.FormatType == GattPresentationFormatTypes.UInt12 ||
format.FormatType == GattPresentationFormatTypes.UInt16)
{
// Previous implementation was incorrect. Need to implement in GattHelper.
return GattConvert.ToHexString(value);
}
else if (format.FormatType == GattPresentationFormatTypes.UInt24 ||
format.FormatType == GattPresentationFormatTypes.UInt32)
{
// Previous implementation was incorrect. Need to implement in GattHelper.
return GattConvert.ToHexString(value);
}
else if (format.FormatType == GattPresentationFormatTypes.UInt48 ||
format.FormatType == GattPresentationFormatTypes.UInt64)
{
// Previous implementation was incorrect. Need to implement in GattHelper.
return GattConvert.ToHexString(value);
}
else if (format.FormatType == GattPresentationFormatTypes.SInt8 ||
format.FormatType == GattPresentationFormatTypes.SInt12 ||
format.FormatType == GattPresentationFormatTypes.SInt16)
{
// Previous implementation was incorrect. Need to implement in GattHelper.
return GattConvert.ToHexString(value);
}
else if (format.FormatType == GattPresentationFormatTypes.SInt24 ||
format.FormatType == GattPresentationFormatTypes.SInt32)
{
return GattConvert.ToInt32(value).ToString();
}
else if (format.FormatType == GattPresentationFormatTypes.Utf8)
{
return GattConvert.ToUTF8String(value);
}
else if (format.FormatType == GattPresentationFormatTypes.Utf16)
{
return GattConvert.ToUTF16String(value);
}
else
{
// format.FormatType == GattPresentationFormatTypes.UInt128 ||
// format.FormatType == GattPresentationFormatTypes.SInt128 ||
// format.FormatType == GattPresentationFormatTypes.DUInt16 ||
// format.FormatType == GattPresentationFormatTypes.SInt64 ||
// format.FormatType == GattPresentationFormatTypes.Struct ||
// format.FormatType == GattPresentationFormatTypes.Float ||
// format.FormatType == GattPresentationFormatTypes.Float32 ||
// format.FormatType == GattPresentationFormatTypes.Float64
return GattConvert.ToHexString(value);
}
}