public async void OnButton(Nuimo nuimo, byte state) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { buttonOutput.Text = "Button state: " + state; }); }
// -------------- INuimoDelegate Methods ---------------------------// public async void OnBattery(Nuimo nuimo, byte level) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { batteryOutput.Text = "Battery: " + level + "%"; }); }
public async void OnRotation(Nuimo nuimo, short steps) { angle += steps; await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { rotOutput.Text = "Angle: " + angle; }); }
public async void OnSwipe(Nuimo nuimo, byte direction) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { swipeTimer.Stop(); swipeOutput.Text = "Swipe " + swipes[direction]; swipeTimer.Start(); }); }
public void RemoveNuimo(Nuimo nuimo) { if (nuimo != null) { var newOptions = _nuimoOptions; newOptions.WhitelistedNuimos.Remove(nuimo); StoreNewNuimoOptions(newOptions); } }
public MainPage() { // If no Id is supplied, it will search for a Bluetooth device called nuimo.Name (default is 'Nuimo', but you can change that). nuimo = new Nuimo("d3b48a8b91ac"); // e.g // nuimo.Name = "MyNewNuimoName"; // Sadly, different Nuimo names are AFAIK not supported yet on the hardware. this.InitializeComponent(); ApplicationView.PreferredLaunchViewSize = new Size(480, 800); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize; }
public async void OnFly(Nuimo nuimo, byte direction, byte speed) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { swipeTimer.Stop(); if (direction == 4) // Means close/far { swipeOutput.Text = "Hover distance: " + speed; } else { swipeOutput.Text = "Fly " + swipes[direction] + " (Speed " + speed + ")."; } swipeTimer.Start(); }); }
public IActionResult Delete([FromBody] Nuimo nuimo) { if (nuimo == null) { return(BadRequest("invalid nuimo object")); } if (!CheckDeviceId(nuimo.DeviceId)) { return(BadRequest("invalid id")); } if (!IsKnownNuimo(nuimo.DeviceId)) { return(NotFound($"Nuimo with device id {nuimo.DeviceId} is unknown.")); } else { _nuimoOptionsWriter.RemoveNuimo(nuimo); return(Ok($"Nuimo with device id {nuimo.DeviceId} removed")); } }
public IActionResult Post([FromBody] Nuimo nuimo) { if (nuimo == null) { return(BadRequest("invalid nuimo object")); } if (!CheckDeviceId(nuimo.DeviceId)) { return(BadRequest("invalid id")); } if (!IsKnownNuimo(nuimo.DeviceId)) { _nuimoOptionsWriter.AddNuimo(nuimo); return(Ok($"Nuimo {nuimo.Name} added")); } else { return(BadRequest($"{nuimo.Name} is already added.")); } }