Skip to content

Instantly share code, notes, and snippets.

@peterfoot
Created March 27, 2017 21:08
Show Gist options
  • Save peterfoot/8da6c31cbe29499067d7d3f710d446e2 to your computer and use it in GitHub Desktop.
Save peterfoot/8da6c31cbe29499067d7d3f710d446e2 to your computer and use it in GitHub Desktop.
Get the minor Class of Device value for a Bluetooth Imaging device.
using System;
using Windows.Devices.Bluetooth;
namespace InTheHand.Devices.Bluetooth
{
/// <summary>
/// Defines missing values in the <see cref="BluetoothMinorClass"/> enumeration for devices with a <see cref="BluetoothClassOfDevice.MajorClass"/> of Imaging.
/// </summary>
[Flags]
public enum BluetoothImagingMinorClass
{
Uncategorized = 0,
Display = 4,
Camera = 8,
Scanner = 16,
Printer = 32,
}
/// <summary>
/// Provides an extension method to get the Imaging minor class.
/// </summary>
public static class BluetoothClassOfDeviceExtensions
{
/// <summary>
/// Returns the Minor Class of Device for an Imaging device.
/// </summary>
/// <param name="classOfDevice"></param>
/// <returns></returns>
public static BluetoothImagingMinorClass GetImagingMinorClass(this BluetoothClassOfDevice classOfDevice)
{
return (BluetoothImagingMinorClass)((int)classOfDevice.MinorClass);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment