Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.3.4 #373

Merged
merged 46 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
77941ef
more xml docs
ctacke Aug 14, 2023
9817ad9
Merge branch 'develop' into ctacke-cleanup
ctacke Aug 14, 2023
4a34f8e
Merge branch 'develop' into ctacke-cleanup
ctacke Aug 17, 2023
618f557
Add timeout exception case to cell network scanner
duduita Aug 22, 2023
4060b4d
Merge remote-tracking branch 'origin/develop' into ctacke-cleanup
ctacke Aug 25, 2023
f88464c
simulation cleanup
ctacke Aug 25, 2023
91151c3
Merge pull request #356 from WildernessLabs/ctacke-cleanup
adrianstevens Aug 29, 2023
3ac074d
Merge pull request #361 from WildernessLabs/fix-cell-scanner-timeout-…
ctacke Aug 29, 2023
7e55f04
Merge remote-tracking branch 'origin/main' into develop
ctacke Sep 1, 2023
4c95187
fix my nugetize mistake
ctacke Sep 1, 2023
3fddf67
adding mallinfo
ctacke Sep 1, 2023
5dfe994
Merge pull request #365 from WildernessLabs/feature/f7-telemetry
adrianstevens Sep 1, 2023
148c962
add erros message and error parse from AT commands
halyssonJr Aug 10, 2023
0aceeef
removed unnecessary file
halyssonJr Sep 4, 2023
e6eb9d0
Fix Meadow.Windows.csproj formatting
adrianstevens Sep 5, 2023
a5619c5
Update Meadow.Avalonia.csproj
adrianstevens Sep 5, 2023
d25ebd4
Update Meadow.F7.csproj
adrianstevens Sep 5, 2023
96af984
Update Meadow.Linux.csproj
adrianstevens Sep 5, 2023
a01ef69
Update Meadow.Simulation.csproj
adrianstevens Sep 5, 2023
c804e2a
Update Meadow.Maui.csproj
adrianstevens Sep 5, 2023
5e497d8
bug fix for app settings path
ctacke Sep 15, 2023
6ea23e9
Merge pull request #366 from WildernessLabs/bug/settings-path
adrianstevens Sep 15, 2023
383d623
MeadowOS: Add trace to catch block exception on device creation
microhobby Sep 21, 2023
986cb56
SerialPort ReadAll refactor
ctacke Sep 21, 2023
75b2f32
Merge pull request #367 from microhobby/main
ctacke Sep 21, 2023
4424fc4
Merge pull request #368 from WildernessLabs/bug/serial-readall
adrianstevens Sep 21, 2023
7be099d
Add contributing.md
adrianstevens Sep 21, 2023
3617b21
Merge pull request #369 from WildernessLabs/contributing
jorgedevs Sep 21, 2023
bbec63a
Get cell IP address on managed code
duduita Sep 22, 2023
429a4e1
Merge pull request #370 from WildernessLabs/get-ip-address-using-cell…
duduita Sep 22, 2023
bdab2cf
add initial support for cell states
halyssonJr Aug 25, 2023
ad6d8ec
add scan, without enabling ScanMode on cell yaml file.
halyssonJr Sep 14, 2023
d7f24c7
Adjust GNSS methods
duduita Sep 22, 2023
1e36855
Fix minor issues
duduita Sep 22, 2023
7dd3d67
Merge pull request #363 from WildernessLabs/add-support-cell-states
duduita Sep 22, 2023
e7834a3
fix typos
engunneer Sep 22, 2023
d225ad7
add external project references
engunneer Sep 22, 2023
dccc24e
XML docs
engunneer Sep 22, 2023
3ac7af9
more typos
engunneer Sep 23, 2023
f1edadc
Merge pull request #371 from engunneer/develop
ctacke Sep 23, 2023
45015fd
add erros message and error parse from AT commands
halyssonJr Aug 10, 2023
fb0c47a
removed unnecessary file
halyssonJr Sep 4, 2023
e706856
Fix minor issues
duduita Sep 22, 2023
51358cf
clean up code
halyssonJr Sep 25, 2023
53f221c
Merge pull request #364 from WildernessLabs/add-messages-errors-cell
adrianstevens Sep 26, 2023
11f8b79
Release 1.3.4
adrianstevens Sep 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contribute to Meadow.Core

**Meadow.Core** is an open-source project by [Wilderness Labs](https://www.wildernesslabs.co/) and we encourage community feedback and contributions.

## How to Contribute

- **Found a bug?** [Report an issue](https://github.com/WildernessLabs/Meadow_Issues/issues)
- Have a **feature idea or driver request?** [Open a new feature request](https://github.com/WildernessLabs/Meadow_Issues/issues)
- Want to **contribute code?** Fork the [Meadow.Core](https://github.com/WildernessLabs/Meadow.Core) repository and submit a pull request against the `develop` branch

## Pull Requests

1. All PRs should target the `develop` branch on the Meadow.Core repository.
2. All new public or protected classes, methods, and properties need XML comment documentation.
3. Please try to follow the existing coding patterns and practices.

## Pull Request Steps

1. Fork the repository
2. Clone your fork locally: `git clone https://github.com/WildernessLabs/Meadow.Core`
3. Switch to the `develop` branch
4. Create a new branch: `git checkout -b feature/your-contribution`
5. Make your changes and commit: `git commit -m 'Added/Updated [feature/fix]`
6. Push to your fork: `git push origin feature/your-contribution`
7. Open a pull request at [Meadow.Core/pulls](https://github.com/WildernessLabs/Meadow.Core/pulls) targetting the `develop` branch
## Need Help?

If you have questions or need assistance, please join the Wilderness Labs [community on Slack](http://slackinvite.wildernesslabs.co/).
189 changes: 94 additions & 95 deletions source/Meadow.Core/Bases/App.cs
Original file line number Diff line number Diff line change
@@ -1,114 +1,113 @@
namespace Meadow
namespace Meadow;

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

/// <summary>
/// Provides a base implementation for the Meadow App. Use this
/// class for Meadow applications to get strongly-typed access to the current
/// device information.
/// </summary>
public abstract class App<D> : IApp, IAsyncDisposable
where D : class, IMeadowDevice
{
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
private ExecutionContext executionContext;

/// <inheritdoc/>
public CancellationToken CancellationToken { get; internal set; } = default!;

/// <inheritdoc/>
public Dictionary<string, string> Settings { get; internal set; } = default!;

/// <summary>
/// Provides a base implementation for the Meadow App. Use this
/// class for Meadow applications to get strongly-typed access to the current
/// device information.
/// Base constructor for the App class
/// </summary>
public abstract class App<D> : IApp, IAsyncDisposable
where D : class, IMeadowDevice
protected App()
{
private ExecutionContext executionContext;
executionContext = Thread.CurrentThread.ExecutionContext;

/// <inheritdoc/>
public CancellationToken CancellationToken { get; internal set; }
Device = MeadowOS.CurrentDevice as D ?? throw new ArgumentException($"Current device is not {typeof(D).Name}"); // 'D' is guaranteed to be initialized and the same type
Abort = MeadowOS.AppAbort.Token;

/// <inheritdoc/>
public Dictionary<string, string> Settings { get; internal set; }
Resolver.Services.Add<IApp>(this);
}

/// <summary>
/// Base constructor for the App class
/// </summary>
protected App()
/// <summary>
/// Invokes an action in the context of the applications main thread
/// </summary>
/// <param name="action">The action to call</param>
/// <param name="state">An optional state object to pass to the Action</param>
public void InvokeOnMainThread(Action<object?> action, object? state = null)
{
switch (Device.Information.Platform)
{
executionContext = Thread.CurrentThread.ExecutionContext;
// ExecutionContext in Mono on the F7 isn't fully working - but we also don't worry about a MainThread there either
case Hardware.MeadowPlatform.F7FeatherV1:
case Hardware.MeadowPlatform.F7FeatherV2:
case Hardware.MeadowPlatform.F7CoreComputeV2:
action.Invoke(state);
break;
default:
ExecutionContext.Run(executionContext, new ContextCallback(action), state);
break;
}
}

Device = MeadowOS.CurrentDevice as D ?? throw new ArgumentException($"Current device is not {typeof(D).Name}"); // 'D' is guaranteed to be initialized and the same type
Abort = MeadowOS.AppAbort.Token;
/// <summary>
/// Called by MeadowOS when everything is ready for the App to run
/// </summary>
public virtual Task Run()
{
return Task.CompletedTask;
}

Resolver.Services.Add<IApp>(this);
}
/// <summary>
/// Called by MeadowOS to initialize the App
/// </summary>
public virtual Task Initialize() { return Task.CompletedTask; }

/// <summary>
/// Invokes an action in the context of the applications main thread
/// </summary>
/// <param name="action">The action to call</param>
/// <param name="state">An optional state object to pass to the Action</param>
public void InvokeOnMainThread(Action<object?> action, object? state = null)
{
switch (Device.Information.Platform)
{
// ExecutionContext in Mono on the F7 isn't fully working - but we also don't worry about a MainThread there either
case Hardware.MeadowPlatform.F7FeatherV1:
case Hardware.MeadowPlatform.F7FeatherV2:
case Hardware.MeadowPlatform.F7CoreComputeV2:
action.Invoke(state);
break;
default:
ExecutionContext.Run(executionContext, new ContextCallback(action), state);
break;
}
}
/// <summary>
/// Called when a request to shut down the App occurs
/// </summary>
/// <remarks>This is called by the Update Service before applying an update</remarks>
public virtual Task OnShutdown() { return Task.CompletedTask; }

/// <summary>
/// Called by MeadowOS when everything is ready for the App to run
/// </summary>
public virtual Task Run()
{
return Task.CompletedTask;
}
/// <summary>
/// Called when the MeadowOS encounters an error
/// </summary>
/// <param name="e">The exception from MeadowOS</param>
public virtual Task OnError(Exception e) { return Task.CompletedTask; }

/// <summary>
/// Called by MeadowOS to initialize the App
/// </summary>
public virtual Task Initialize() { return Task.CompletedTask; }

/// <summary>
/// Called when a request to shut down the App occurs
/// </summary>
/// <remarks>This is called by the Update Service before applying an update</remarks>
public virtual Task OnShutdown() { return Task.CompletedTask; }

/// <summary>
/// Called when the MeadowOS encounters an error
/// </summary>
/// <param name="e">The exception from MeadowOS</param>
public virtual Task OnError(Exception e) { return Task.CompletedTask; }

/// <summary>
/// Called when the application is about to update itself.
/// </summary>
public void OnUpdate(Version newVersion, out bool approveUpdate)
{
approveUpdate = true;
}
/// <summary>
/// Called when the application is about to update itself.
/// </summary>
public void OnUpdate(Version newVersion, out bool approveUpdate)
{
approveUpdate = true;
}

/// <summary>
/// Called when the application has updated itself.
/// </summary>
public void OnUpdateComplete(Version oldVersion, out bool rollbackUpdate)
{
rollbackUpdate = false;
}
/// <summary>
/// Called when the application has updated itself.
/// </summary>
public void OnUpdateComplete(Version oldVersion, out bool rollbackUpdate)
{
rollbackUpdate = false;
}

/// <summary>
/// The root Device interface
/// </summary>
public static D Device { get; protected set; } = default!;
/// <summary>
/// The root Device interface
/// </summary>
public static D Device { get; protected set; } = default!;

/// <summary>
/// The app cancellation token
/// </summary>
public static CancellationToken Abort { get; protected set; }
/// <summary>
/// The app cancellation token
/// </summary>
public static CancellationToken Abort { get; protected set; }

/// <summary>
/// Virtual method provided for App implemenmtations to clean up resources on Disposal
/// </summary>
public virtual ValueTask DisposeAsync() { return new ValueTask(Task.CompletedTask); }
}
/// <summary>
/// Virtual method provided for App implementations to clean up resources on Disposal
/// </summary>
public virtual ValueTask DisposeAsync() { return new ValueTask(Task.CompletedTask); }
}
6 changes: 3 additions & 3 deletions source/Meadow.Core/Gateways/Bluetooth/Characteristic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ public class Characteristic : ICharacteristic
public CharacteristicWriteType WriteType { get; set; }

/// <summary>
/// Indicates wheter the characteristic can be read or not.
/// Indicates whether the characteristic can be read or not.
/// </summary>
public bool CanRead { get; set; }

/// <summary>
/// Indicates wheter the characteristic can be written or not.
/// Indicates whether the characteristic can be written or not.
/// </summary>
public bool CanWrite { get; set; }

/// <summary>
/// Indicates wheter the characteristic supports notify or not.
/// Indicates whether the characteristic supports notify or not.
/// </summary>
public bool CanUpdate { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Meadow.Gateways.Bluetooth
public enum CharacteristicPropertyType
{
/// <summary>
/// Characteristic value can be broadcasted.
/// Characteristic value can be broadcast.
/// </summary>
Broadcast = 1,

Expand All @@ -31,12 +31,12 @@ public enum CharacteristicPropertyType
Write = 8,

/// <summary>
/// Characteristic can notify value changes without acknowledgement.
/// Characteristic can notify value changes without acknowledgment.
/// </summary>
Notify = 16,

/// <summary>
///Characteristic can indicate value changes with acknowledgement.
///Characteristic can indicate value changes with acknowledgment.
/// </summary>
Indicate = 32,

Expand All @@ -50,7 +50,7 @@ public enum CharacteristicPropertyType
/// </summary>
ExtendedProperties = 128,

// TODO: move these to seperate enum
// TODO: move these to separate enum
NotifyEncryptionRequired = 256, //0x100

IndicateEncryptionRequired = 512, //0x200
Expand Down
3 changes: 3 additions & 0 deletions source/Meadow.Core/Gateways/Bluetooth/Definitions/Service.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Meadow.Gateways.Bluetooth
{
/// <summary>
/// Provides access to a device Bluetooth capabilities
/// </summary>
public class Service : IService
{
public ushort Handle { get; set; }
Expand Down
8 changes: 4 additions & 4 deletions source/Meadow.Core/Gateways/Bluetooth/KnownCharacteristics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static KnownCharacteristic Lookup(Guid id)
new KnownCharacteristic("Tx Power Level", Guid.ParseExact("00002a07-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Unread Alert Status", Guid.ParseExact("00002a45-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Aerobic Heart Rate Lower Limit", Guid.ParseExact("00002a7e-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Aerobic Heart Rate Uppoer Limit", Guid.ParseExact("00002a84-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Aerobic Heart Rate Upper Limit", Guid.ParseExact("00002a84-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Age", Guid.ParseExact("00002a80-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Aggregate Input", Guid.ParseExact("00002a5a-0000-1000-8000-00805f9b34fb", "d")),
new KnownCharacteristic("Anaerobic Heart Rate Lower Limit", Guid.ParseExact("00002a81-0000-1000-8000-00805f9b34fb", "d")),
Expand Down Expand Up @@ -190,9 +190,9 @@ public static KnownCharacteristic Lookup(Guid id)
new KnownCharacteristic("TI SensorTag Humidity Data", Guid.ParseExact("f000aa21-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Humidity On/Off", Guid.ParseExact("f000aa22-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Humidity Sample Rate", Guid.ParseExact("f000aa23-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Magnometer Data", Guid.ParseExact("f000aa31-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Magnometer On/Off", Guid.ParseExact("f000aa32-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Magnometer Sample Rate", Guid.ParseExact("f000aa33-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Magnetometer Data", Guid.ParseExact("f000aa31-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Magnetometer On/Off", Guid.ParseExact("f000aa32-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Magnetometer Sample Rate", Guid.ParseExact("f000aa33-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Barometer Data", Guid.ParseExact("f000aa41-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Barometer On/Off", Guid.ParseExact("f000aa42-0451-4000-b000-000000000000", "d")),
new KnownCharacteristic("TI SensorTag Barometer Calibration", Guid.ParseExact("f000aa43-0451-4000-b000-000000000000", "d")),
Expand Down
2 changes: 1 addition & 1 deletion source/Meadow.Core/Gateways/Bluetooth/KnownServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static KnownService Lookup(Guid id)
new KnownService("TI SensorTag Infrared Thermometer", Guid.ParseExact("f000aa00-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Accelerometer", Guid.ParseExact("f000aa10-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Humidity", Guid.ParseExact("f000aa20-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Magnometer", Guid.ParseExact("f000aa30-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Magnetometer", Guid.ParseExact("f000aa30-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Barometer", Guid.ParseExact("f000aa40-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Gyroscope", Guid.ParseExact("f000aa50-0451-4000-b000-000000000000", "d")),
new KnownService("TI SensorTag Test", Guid.ParseExact("f000aa60-0451-4000-b000-000000000000", "d")),
Expand Down
13 changes: 7 additions & 6 deletions source/Meadow.Core/Hardware/AnalogInputPort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Meadow.Hardware;
// ReadVoltage();
// ```
//
// * User needs to take contuinous voltage readings. Most likely getting
// * User needs to take continuous voltage readings. Most likely getting
// oversampled readings each time for accuracy.
//
// ```
Expand All @@ -30,7 +30,7 @@ namespace Meadow.Hardware;
// ```
//
// * User wants to take continuous voltage readings and wants to be notified
// //TODO: think through some notifcation configuration
// //TODO: think through some notification configuration
// ```
// analogPort.VoltageChanged += (float newVoltage){ /*do something*/ };

Expand All @@ -47,7 +47,7 @@ public class AnalogInputPort : AnalogInputPortBase, IObservable<IChangeResult<Vo
/// </summary>
public static readonly TimeSpan DefaultSampleInterval = TimeSpan.FromMilliseconds(40);
/// <summary>
/// The default reference votlage for the Input (3.3V)
/// The default reference voltage for the Input (3.3V)
/// </summary>
public static readonly Voltage DefaultReferenceVoltage = new Voltage(3.3, Voltage.UnitType.Volts);

Expand All @@ -73,14 +73,15 @@ public class AnalogInputPort : AnalogInputPortBase, IObservable<IChangeResult<Vo
protected Voltage? PreviousVoltageReading { get; set; }

/// <summary>
/// Creates an AnalogInputPort given the povided parameters
/// Creates an AnalogInputPort given the provided parameters
/// </summary>
/// <param name="pin">The IPin to use for the input port</param>
/// <param name="ioController">The IMeadowIOController for the pin</param>
/// <param name="channel">The pin's channel info</param>
/// <param name="sampleCount">The number of ADC readings to average for a single sample</param>
/// <param name="sampleInterval">The time between readings used for calculating the average for a sample</param>
/// <param name="referenceVoltage">The ADCs reference voltage</param>
/// <exception cref="PortInUseException"></exception>
protected AnalogInputPort(
IPin pin, IMeadowIOController ioController, IAnalogChannelInfo channel,
int sampleCount, TimeSpan sampleInterval,
Expand All @@ -104,7 +105,7 @@ protected AnalogInputPort(
}

/// <summary>
/// Creates an AnalogInputPort given the povided parameters
/// Creates an AnalogInputPort given the provided parameters
/// </summary>
/// <param name="pin"></param>
/// <param name="ioController"></param>
Expand All @@ -119,7 +120,7 @@ public static AnalogInputPort From(
}

/// <summary>
/// Creates an AnalogInputPort given the povided parameters
/// Creates an AnalogInputPort given the provided parameters
/// </summary>
/// <param name="pin"></param>
/// <param name="ioController"></param>
Expand Down
Loading
Loading