-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gesture sensor w/ incomplete gesture list (#84)
* Add gesture sensor w/ incomplete gesture list #18 non-breaking (new api)
- Loading branch information
Showing
9 changed files
with
89 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
examples/SharpBrick.PoweredUp.Examples/ExampleTechnicMediumHubGestSensor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using System.Reactive.Linq; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using SharpBrick.PoweredUp; | ||
|
||
namespace Example | ||
{ | ||
public class ExampleTechnicMediumHubGestSensor : BaseExample | ||
{ | ||
public override async Task ExecuteAsync() | ||
{ | ||
using (var technicMediumHub = Host.FindByType<TechnicMediumHub>()) | ||
{ | ||
var device = technicMediumHub.GestureSensor; | ||
|
||
await device.SetupNotificationAsync(0, true, deltaInterval: 0); | ||
|
||
using var _ = device.GestureObservable.Subscribe(x => Log.LogInformation($"Gesture {x}")); | ||
|
||
await Task.Delay(30_000); | ||
|
||
await technicMediumHub.SwitchOffAsync(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
namespace SharpBrick.PoweredUp | ||
{ | ||
public enum Gesture : sbyte | ||
{ | ||
None = 0, // UNSPECED | ||
/// <summary> | ||
/// May be "Tap" gesture. | ||
/// | ||
/// Mapping is not well understood. Please contribute an issue if you have found an issue, additional insight or documentation. | ||
/// </summary> | ||
Gesture1 = 1, // UNSPECED | ||
|
||
/// <summary> | ||
/// Some undocumented gesture (maybe bounce). | ||
/// | ||
/// Mapping is not well understood. Please contribute an issue if you have found an issue, additional insight or documentation. | ||
/// </summary> | ||
Gesture2 = 2, | ||
|
||
/// <summary> | ||
/// May be "Shake" gesture. | ||
/// | ||
/// Mapping is not well understood. Please contribute an issue if you have found an issue, additional insight or documentation. | ||
/// </summary> | ||
Gesture3 = 3, // UNSPECED | ||
|
||
/// <summary> | ||
/// May be "free fall" gesture. | ||
/// | ||
/// Mapping is not well understood. Please contribute an issue if you have found an issue, additional insight or documentation. | ||
/// </summary> | ||
Gesture4 = 4, // UNSPECED | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters