/// <summary> /// Get how many minor classes the supplied major class has. A major class can /// have 0 to 2 minor classes, depending on its type. See the Bluetooth specifications /// for more details. /// </summary> /// <param name="majorType">The major type to retrieve the number of minor classes for.</param> /// <returns>Number of minor classes in use for the specified major class.</returns> public static int NumDeviceClassesForMajorClass(MajorDeviceClassTypes majorType) { return NumMinorDeviceClassesForMajorClassTable.ContainsKey(majorType) ? NumMinorDeviceClassesForMajorClassTable[majorType] : -1; }
/// <summary> /// Check whether the major type is using flags for its minor type (primary / secondary). /// If yes, multiple minor values can be set for a minor type. If no, only a single minor value applies. /// </summary> /// <remarks>Currently, only the primary minor class of the Imaging major class is using flags.</remarks> /// <param name="majorType">Major device class type to retrieve the information for.</param> /// <param name="primarySecondary">Use the primary or secondary bits.</param> /// <returns>True if the minor bits should be interpreted as flags (multiple /// minor classes per major class); false if they should be interpreted as value /// (only one minor class per major class)</returns> public static bool UsesFlagsForMinorClass(MajorDeviceClassTypes majorType, int primarySecondary) { // Hard-coded: only the primary imaging type uses flags to combine // multiple properties into its bits. return majorType == MajorDeviceClassTypes.Imaging && primarySecondary == 1; }
/// <summary> /// Set the major device class by directly specifying the enum value. /// </summary> /// <param name="deviceClass">The major device class as enum value.</param> public void SetMajorDeviceClassFromEnum(MajorDeviceClassTypes deviceClass) { MajorDeviceClass = (uint) deviceClass; }