private USBAppIntentProfile MakeUSBProfile(AppIntentProfile appIntentProfile) { USBAppIntentProfile usbProfile = new USBAppIntentProfile(); if (appIntentProfile != null) { // Sensors usbProfile.sensorBitmask = 0; for (int i = 0; i < WearableConstants.SensorIds.Length; i++) { SensorId sensor = WearableConstants.SensorIds[i]; // Does this profile require this sensor? if (appIntentProfile.GetSensorInProfile(sensor)) { SensorFlags sensorBit = WearableTools.GetSensorFlag(sensor); usbProfile.sensorBitmask |= (int)sensorBit; } } // Gestures usbProfile.gestureBitmask = 0; for (int i = 0; i < WearableConstants.GestureIds.Length; i++) { GestureId gesture = WearableConstants.GestureIds[i]; // Does this profile require this gesture? if (appIntentProfile.GetGestureInProfile(gesture)) { GestureFlags gestureBit = WearableTools.GetGestureFlag(gesture); usbProfile.gestureBitmask |= (int)gestureBit; } } usbProfile.updateIntervalBitmask = 0; for (int i = 0; i < WearableConstants.UpdateIntervals.Length; i++) { SensorUpdateInterval interval = WearableConstants.UpdateIntervals[i]; // Does this profile require this update interval? if (appIntentProfile.GetIntervalInProfile(interval)) { int intervalBit = WearableTools.SensorUpdateIntervalToBit(interval); usbProfile.updateIntervalBitmask |= intervalBit; } } } return(usbProfile); }
/// <summary> /// Returns true if a device supports using a gesture with <see cref="GestureId"/> /// <paramref name="gestureId"/>, otherwise false if it does not. /// </summary> /// <param name="gestureId"></param> /// <returns></returns> public bool IsGestureAvailable(GestureId gestureId) { var gestureFlag = WearableTools.GetGestureFlag(gestureId); return((availableGestures & gestureFlag) == gestureFlag); }