Difficulties with New Windows 10 C# SDK
Hello all,
I am attempting to build a new metawear .net console application using the new Metawear.CSharp nuget package.
I've built a very simple application to test out the functionality, I'll list the code here.
I've built a very simple application to test out the functionality, I'll list the code here.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MbientLab.MetaWear.Win10;
using Windows.Devices.Bluetooth;
using MbientLab.MetaWear;
using System.Threading;
using MbientLab.MetaWear.Peripheral;
namespace SensorServer
{
class SensorServer
{
BluetoothLEDevice device;
async void Run()
{
await MacAddrToIMetaWearBoard(233414921927693);
IMetaWearBoard metawear = Application.GetMetaWearBoard(device);
await metawear.InitializeAsync();
ILed led;
if ((led = metawear.GetModule<ILed>()) != null)
Console.WriteLine("LED module is present");
}
public async Task MacAddrToIMetaWearBoard(ulong mac)
{
device = await BluetoothLEDevice.FromBluetoothAddressAsync(mac);
Console.WriteLine(device == null);
}
static void Main(string[] args)
{
SensorServer server = new SensorServer();
server.Run();
while (true)
Thread.Sleep(100);
}
}
}
However, when I attempt to initialize the metawear I get the following exception:
metawear: Could not deserialize board attributes
However, when I attempt to initialize the metawear I get the following exception:
metawear: Could not deserialize board attributes
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at MbientLab.MetaWear.Win10.Application.IO.<LocalLoadAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at MbientLab.MetaWear.Impl.MetaWearBoard.<InitializeAsync>d__46.MoveNext()
Any insight? I can't find any documentation on this exception.
Any insight? I can't find any documentation on this exception.
This discussion has been closed.
Comments
I suppose the exception that is actually crashing the app is as follows:
I've checked a few possibilities, and my bluetoothLEDevice is being properly assigned. Is this still just an issue with Windows 10 trying to get at the gatt characteristics?
System.InvalidOperationException: 'Failed to enable notifications (status = 1)'