/// <summary> /// Helper function to convert our AppIntentProfile to something more easily consumable /// by the bridge layer. /// </summary> private static BridgeAppIntentProfile CreateBridgeAppIntentProfile(AppIntentProfile appIntentProfile) { BridgeAppIntentProfile bridgeAppIntentProfile = new BridgeAppIntentProfile(); int sensors = 0; int samplePeriods = 0; int gestures = 0; if (appIntentProfile != null) { for (int i = 0; i < WearableConstants.SENSOR_IDS.Length; i++) { if (appIntentProfile.GetSensorInProfile(WearableConstants.SENSOR_IDS[i])) { sensors |= (1 << i); } } for (int i = 0; i < WearableConstants.UPDATE_INTERVALS.Length; i++) { if (appIntentProfile.GetIntervalInProfile(WearableConstants.UPDATE_INTERVALS[i])) { samplePeriods |= (1 << i); } } for (int i = 0; i < WearableConstants.GESTURE_IDS.Length; i++) { if (WearableConstants.GESTURE_IDS[i] == GestureId.None) { continue; } if (appIntentProfile.GetGestureInProfile(WearableConstants.GESTURE_IDS[i])) { gestures |= (1 << (i - 1)); } } } bridgeAppIntentProfile.sensors = sensors; bridgeAppIntentProfile.samplePeriods = samplePeriods; bridgeAppIntentProfile.gestures = gestures; return(bridgeAppIntentProfile); }
private static extern bool WearableValidateAppIntents(BridgeAppIntentProfile bridgeAppIntentProfile);
private static extern void WearableStartDeviceSearch(BridgeAppIntentProfile bridgeAppIntentProfile, int rssiThreshold);
public bool IsAppIntentProfileValid(AppIntentProfile appIntentProfile) { BridgeAppIntentProfile bridgeAppIntentProfile = CreateBridgeAppIntentProfile(appIntentProfile); return(WearableValidateAppIntents(bridgeAppIntentProfile)); }
public void StartSearch(AppIntentProfile appIntentProfile, int rssiThreshold) { BridgeAppIntentProfile bridgeAppIntentProfile = CreateBridgeAppIntentProfile(appIntentProfile); WearableStartDeviceSearch(bridgeAppIntentProfile, rssiThreshold); }
private static extern void WearableConnectToLastDevice(BridgeAppIntentProfile bridgeAppIntentProfile);
public void ReconnectToLastSuccessfulDeviceInternal(AppIntentProfile appIntentProfile) { BridgeAppIntentProfile bridgeAppIntentProfile = CreateBridgeAppIntentProfile(appIntentProfile); WearableConnectToLastDevice(bridgeAppIntentProfile); }