IBandClientManager GetBandClientManager() { #if USE_DEVICE return(BandClientManager.Instance); #else FakeBandClientManager.Configure(new FakeBandClientManagerOptions { Bands = new List <IBandInfo> { new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 1"), } }); // Use the fake band client manager return(FakeBandClientManager.Instance); #endif }
public static async Task <IBandClient> GetBandClientAsync() { FakeBandClientManager.Configure(new FakeBandClientManagerOptions { Bands = new List <IBandInfo> { new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 1"), }, UseUnitTestInterval = true, UnitTestSensorInterval = TimeSpan.FromMilliseconds(100), }); var bands = await FakeBandClientManager.Instance.GetBandsAsync(); var bandInfo = bands.First(); var bandClient = await FakeBandClientManager.Instance.ConnectAsync(bandInfo); return(bandClient); }
private async void OnLoad(object sender, RoutedEventArgs e) { // Set up the fake bands FakeBandClientManager.Configure(new FakeBandClientManagerOptions { Bands = new List <IBandInfo> { new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 1"), new FakeBandInfo(BandConnectionType.Bluetooth, "Fake Band 2"), } }); // Use the fake band client manager IBandClientManager clientManager = FakeBandClientManager.Instance; // Microsoft Band SDK code var bands = await clientManager.GetBandsAsync(); var bandInfo = bands.First(); var bandClient = await FakeBandClientManager.Instance.ConnectAsync(bandInfo); var meTile = await bandClient.PersonalizationManager.GetMeTileImageAsync(); PersonalizationView.PersonalizationViewModel.MeTile = meTile.ToWriteableBitmap(); var theme = await bandClient.PersonalizationManager.GetThemeAsync(); Mapper.Map(theme, ThemeView.BandThemeViewModel); await StartSensor(bandClient, bandClient.SensorManager.HeartRate, ev => { Mapper.Map(ev.SensorReading, HeartRateView.HeartRateViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Altimeter, ev => { Mapper.Map(ev.SensorReading, AltimeterView.AltimeterViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.AmbientLight, ev => { Mapper.Map(ev.SensorReading, AmbientLightView.AmbientLightViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Accelerometer, ev => { Mapper.Map(ev.SensorReading, AccelerometerView.AccelerometerViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Calories, ev => { Mapper.Map(ev.SensorReading, CaloriesView.BandCaloriesViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Contact, ev => { Mapper.Map(ev.SensorReading, ContactView.BandDeviceContactViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Distance, ev => { Mapper.Map(ev.SensorReading, DistanceView.BandDistanceViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Gsr, ev => { Mapper.Map(ev.SensorReading, GsrView.GsrViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Gyroscope, ev => { Mapper.Map(ev.SensorReading, GyroView.GyroViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.Pedometer, ev => { Mapper.Map(ev.SensorReading, PedometerView.BandPedometerViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.RRInterval, ev => { Mapper.Map(ev.SensorReading, RRIntervalView.BandRRIntervalViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.SkinTemperature, ev => { Mapper.Map(ev.SensorReading, SkinTemperatureView.BandSkinTemperatureViewModel); }); await StartSensor(bandClient, bandClient.SensorManager.UV, ev => { Mapper.Map(ev.SensorReading, UVView.BandUVViewModel); }); }