Project Setup¶
The C# SDK is distributed on NuGet and can be installed via the Package Manager Console in VS2017
PM> Install-Package MetaWear.CSharp
Or with the .NET Core cli.
dotnet add package MetaWear.CSharp
You can also manually add a PackageReference
tag to your *.csproj file
<ItemGroup>
<PackageReference Include="MetaWear.CSharp" Version="[1.1, 2.0)" />
</ItemGroup>
Plugins¶
Because the SDK is platform agnostic, developers will need to plugin platform specific BLE and file I/O code by implementing the interfaces defined in the MetaWear.Impl.Platform namespace.
using MbientLab.MetaWear.Impl.Platform;
class MyBluetoothLeGatt : IBluetoothLeGatt {
// Implementation here
}
class MyIO : ILibraryIO {
// Implementation here
}
When you have implemented the required interfaces, pass instances of those classes into the MetaWearBoard
constructor.
using MbientLab.MetaWear;
using MbientLab.MetaWear.Impl;
IMetaWearBoard metawear = new MetaWearBoard(new MyBluetoothLeGatt(), new MyIO());
MbientLab has provided Windows 10 and .NET Standard 2.0 implementations of the aforementioned interfaces in the
MetaWear.CSharp.Win10
and MetaWear.CSharp.NetStandard
packages respectively. See their GitHub pages
(Win10,
NET Standard ) for specifics on using those plugins.