public static GattProperty ToNative(this CharacteristicProperties properties) { if (properties.HasFlag(CharacteristicProperties.NotifyEncryptionRequired)) { throw new ArgumentException("NotifyEncryptionRequired not supported on Android"); } if (properties.HasFlag(CharacteristicProperties.IndicateEncryptionRequired)) { throw new ArgumentException("IndicateEncryptionRequired not supported on Android"); } var value = properties .ToString() .Replace( CharacteristicProperties.WriteNoResponse.ToString(), GattProperty.WriteNoResponse.ToString() ) .Replace( CharacteristicProperties.AuthenticatedSignedWrites.ToString(), GattProperty.SignedWrite.ToString() ) .Replace( CharacteristicProperties.ExtendedProperties.ToString(), GattProperty.ExtendedProps.ToString() ); return((GattProperty)Enum.Parse(typeof(GattProperty), value)); }
protected GattCharacteristicProperties ToNative(CharacteristicProperties props) { var value = props .ToString() .Replace(CharacteristicProperties.WriteNoResponse.ToString(), GattCharacteristicProperties.WriteWithoutResponse.ToString()) .Replace(CharacteristicProperties.NotifyEncryptionRequired.ToString(), String.Empty) .Replace(CharacteristicProperties.IndicateEncryptionRequired.ToString(), String.Empty); return((GattCharacteristicProperties)Enum.Parse(typeof(GattCharacteristicProperties), value)); }