Problem with mbientlab/MetaWear-SDK-CSharp-Plugin-NetStandard

edited June 2018 in C#

Hello,
i installed "NetStandard2.0 plugins for the MetaWear C# SDK", and tried to activate the accelerometer, but nothing happens.
Also, it often crashes
Can you please advice?

Here is my code:

using MbientLab.MetaWear.Core;
using MbientLab.MetaWear.Data;
using MbientLab.MetaWear.NetStandard;
using MbientLab.MetaWear.Sensor;
using MbientLab.MetaWear.Sensor.AccelerometerMma8452q;
using MbientLab.MetaWear.Sensor.BarometerBosch;
using System;
using System.Threading.Tasks;

namespace MetaWear.NETCore
{
    class Program
    {
        static void Main(string[] args)
        {
            MainAsync(args).Wait();
        }

        private static async Task MainAsync(string[] args)
        {
            try
            {
                IMetaWearBoard metawear = Application.GetMetaWearBoard("F4:4A:2D:8E:65:3E");
                await metawear.InitializeAsync();

                //accelerometer

                var accelerometer = metawear.GetModule<IAccelerometer>();

                accelerometer.Configure(odr: 2f);
                await accelerometer.Acceleration.AddRouteAsync(source => source.Stream(data =>
                    Console.WriteLine(data.Value<Acceleration>())
                ));
                accelerometer.Acceleration.Start();
                accelerometer.Start();

                Console.Read();


            }
            catch (Exception e)
            {
                Console.WriteLine("error: " + e.Message);
            }
        }
    }
}

Comments

  • Hi again,
    I downloaded and tried to compile the three projects instead of reference it , and now i get this exception after running the code :
    "Unable to load DLL 'warble': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

    Can you please advice?
    Erez

    • Provide more details about the crash. Simply saying that your app crashes does not provide any information to work off of.
    • Use the Win10 plugin if you're building a Win10 app.
    • Your sample code is setting the odr to 2Hz.
  • Hi Eric.
    Thanks for the replay!
    I using NetStandard cause i need the Dlls in Unity, and i cant use your Win10 app.in Unity cause Unity DOES NOT support Windows.Device.Bluetooth. Do i miss something?

    Regarding crashes: Only once in ~10 attempts, i am abling to see data coming to the sensor. All other time the app simply crashes after i press "play" . Below is a screenshot. Do i miss something ? how can i provide you more Info?

    Also, i was able to connect the sensor to Unity , but again the editor crashes each time, and just every 10 times i able to get data in Unity from the sensor

    I appreciate any help cause being able to get data in Unity is critical for us.

  • Hi Eric,
    I found the problem- it is in the C project. Trace and sceenshot is below :
    As you can see - the error is " The process cannot access the file because it is being used by another process"
    This explains why the code is working sometimes and sometimes not. no
    Is this enough info for you?

    Trace:
    'example-connect.exe' (Win32): Loaded 'F:\Erez\Dropbox\Personal\Research2018\PLAYWORK\MBIENTLAB\Warble.CPP\vs2017\x64\Debug\example-connect.exe'. Symbols loaded.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'F:\Erez\Dropbox\Personal\Research2018\PLAYWORK\MBIENTLAB\Warble.CPP\vs2017\x64\Debug\warble.dll'. Symbols loaded.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\vccorlib140d.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\msvcp140d.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Devices.Bluetooth.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\ws2_32.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Networking.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Networking.HostName.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\biwinrt.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\WinTypes.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Networking.Connectivity.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Networking.HostName.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Unloaded 'C:\Windows\System32\Windows.Networking.HostName.dll'
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\FirewallAPI.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\fwbase.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Devices.Enumeration.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\deviceassociation.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\propsys.dll'. Cannot find or open the PDB file.
    'example-connect.exe' (Win32): Loaded 'C:\Windows\System32\Microsoft.Bluetooth.Proxy.dll'. Cannot find or open the PDB file.
    onecoreuap\drivers\wdm\bluetooth\user\winrt\gatt\gattdeviceservice.cpp(1291)\Windows.Devices.Bluetooth.dll!00007FFEB81CE481: (caller: 00007FFEB81CDC0E) Exception(1) tid(1564) 80070020 The process cannot access the file because it is being used by another process.
    onecoreuap\drivers\wdm\bluetooth\user\winrt\gatt\gattdeviceservice.cpp(1102)\Windows.Devices.Bluetooth.dll!00007FFEB827EFA0: (caller: 00007FFEB81D0490) ReturnHr(1) tid(1564) 80070020 The process cannot access the file because it is being used by another process.
    Msg:[onecoreuap\drivers\wdm\bluetooth\user\winrt\gatt\gattdeviceservice.cpp(1291)\Windows.Devices.Bluetooth.dll!00007FFEB81CE481: (caller: 00007FFEB81CDC0E) Exception(1) tid(1564) 80070020 The process cannot access the file because it is being used by another process.
    ]
    onecoreuap\drivers\wdm\bluetooth\user\winrt\gatt\gattdeviceservice.cpp(1750)\Windows.Devices.Bluetooth.dll!00007FFEB81D04B2: (caller: 00007FFEB81D4B42) Exception(2) tid(1564) 80070020 The process cannot access the file because it is being used by another process.
    onecoreuap\drivers\wdm\bluetooth\user\winrt\gatt\gattdeviceservice.cpp(1868)\Windows.Devices.Bluetooth.dll!00007FFEB827F6E8: (caller: 00007FFEB81D4B42) ReturnHr(2) tid(1564) 80070020 The process cannot access the file because it is being used by another process.
    onecoreuap\drivers\wdm\bluetooth\user\winrt\gatt\gattdeviceservice.cpp(795)\Windows.Devices.Bluetooth.dll!00007FFEB81D4B61: (caller: 00007FFEB81D6A6A) ReturnHr(3) tid(1564) 80070020 The process cannot access the file because it is being used by another process.
    Exception thrown at 0x00007FFEEE1C4008 in example-connect.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000A4B09FDBE0.
    Exception thrown at 0x00007FFEEE1C4008 in example-connect.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
    Exception thrown at 0x00007FFEEE1C4008 in example-connect.exe: Microsoft C++ exception: wil::ResultException at memory location 0x000000A4B09FDD80.
    Exception thrown at 0x00007FFEEE1C4008 in example-connect.exe: Microsoft C++ exception: [rethrow] at memory location 0x0000000000000000.
    Exception thrown at 0x00007FFEEE1C4008 (KernelBase.dll) in example-connect.exe: WinRT originate error - 0x80070020 : 'The process cannot access the file because it is being used by another process.'.
    Exception thrown at 0x00007FFEEE1C4008 in example-connect.exe: Microsoft C++ exception: Platform::COMException ^ at memory location 0x000000A4B0AFD970.

  • BTW, i have Windows 10 OS, with CSR CSR8510 A10 Dongle connected.

  • edited June 2018

    Which line of code is causing the exception? Your screen shot doesn't show me anything other than that the std::exception class is working as described.

    What are the steps to reproduce this exception? I have not run into this specific exception when testing on my machine. The underlying code is not doing anything fancy, just calling the Windows BLE functions.

  • Hello Eric,
    1. The lines of code are (i think) 209-210 at the win10_api.cpp. I used the example-connect test project to repreduce the error- i sent the mac as parameter and run it few times. As you can see in video , sometimes its ok , and sometimes crashes.
    2.Here is a video i recorded with reproduce the error:
    https://drive.google.com/file/d/1jevNrhSj8UqTeajeOvKYs_SZxZO0hB4-/view?usp=sharing

  • edited June 2018

    Those lines of code are just exception handling code. You need to determine which async task is returning the exception, that is ultimately being thrown by previous.wait();

    Regarding your video, I am unable reproduce the error by continually running the example program in VS2017 as you do in the video. It could be something with your adapter or Windows install but it is not affecting my machine. Do you have other Windows 10 machines and/or adapters you can test with?

  • Yes.
    1.what about my trace i put?
    2.When i run it using consoleApp i get this error:

    SO i tried to open "warble.dll " with dependency walker:

    1. I am not sure what you are asking here.
    2. Which console app project are you referring to? You have been able to run the example C projects so you should already have the required DLLs installed.
  • I pushed some changes to the C library, give them a try.

  • edited July 2018

    Hi Eric,
    I tried the modified C project. and i still get the error ("Unable to load DLL warble.dll..."). I will try to explain better what i did:
    1. in order to test the connection to BLE in Windows, i created "hello world" console app. you can download it here . please note that this console uses MbientLab.MetaWear.dll, warble.dll , MbientLab.MetaWear.NetStandard.dll , Warble.NetStandard.dll. The app is working on DEV computers (i.e. SDKs are installed on the computer).[ However, if I try to run it twice in a raw, it is not connecting properly to the sensor maybe it is related to the "disconnect" method? is it taking some time for the sensor to disconnect properly ?]
    2. I published the app in a self-contained folder, and run it on "clean" win 10 computer (without SDKs installed) , and get the error. you can download the publish folder it here , just double-click the "console1.exe" Note that i manually put the warble.dll at the exe folder. I assume the app is looking for some dependencies?
    3. i put all DLLs in "Plugins/Assets" folder in Unity, but the app is crashing after calling "InitializeAsync" [this is another problem]
    Thanks!

  • edited July 2018

    I do not understand why the first thing you do is call DisconnectAsync since the device is not connected. Furthermore, you are never stopping the sensors, so you are leaving them continually attempting to stream data upon app termination.

    I'm not sure what's wrong with your project but I highly doubt it is the native dll; you can check this by running the example C++ projects on your other machine. Those missing dlls in your screenshot are just shims that get resolved to another dll by Windows so they don't exist anyways.

  • edited July 2018

    Hello Eric,
    i found the missing DLLs ( just copied missing DLLs after using "dependency-walker" tool). However, i still have connection problems:
    1. I cant connect to MetamotionR two times in a raw: i running the code below - i fixed the disconnect method upon your comment , and now (i think) i disconnect it properly . However, the second time i running the code i get exception "error: Failed to discover gatt characteristics". (see figure below - This comes from the C library you published at 21.6) . Please let me know if this code is OK. Should i wait some time after disconnect? do i miss something ?

    1. Also, my MetamotionR cannot be discovered any more even from MetaBAse app (please see figure below - it is "disconnected", however, i can connect it with code) . For example - Yesterday all day i couldn't discover it even with nRF sniffer, and today i could discover it ( only in code) . Do i miss something ?
    2. Will you have Unity SDK ( a whole package, not just DLLs) ?
      Thanks,

    *****CODE:
    using MbientLab.MetaWear;
    using MbientLab.MetaWear.Core;
    using MbientLab.MetaWear.Data;
    using MbientLab.MetaWear.NetStandard;
    using MbientLab.MetaWear.Sensor;
    using MbientLab.MetaWear.Sensor.AccelerometerMma8452q;
    using MbientLab.MetaWear.Sensor.BarometerBosch;
    using System;
    using System.Threading.Tasks;

    namespace MetaWear.NETCore
    {
    class Program
    {
    static void Main(string[] args)
    {
    MainAsync(args).Wait();
    }

        private static async Task MainAsync(string[] args)
        {
            try
            {
    
               Console.WriteLine("Insert mac[erez - F4:4A:2D:8E:65:3E] : ");
                string mc = Console.ReadLine();
                IMetaWearBoard metawear = Application.GetMetaWearBoard(mc);
               // var deviceInfo = await metawear.ReadDeviceInformationAsync();
                  await metawear.InitializeAsync();
    
                //accelerometer
    
                var accelerometer = metawear.GetModule<IAccelerometer>();
    
                accelerometer.Configure(odr:   1
                    );
                await accelerometer.Acceleration.AddRouteAsync(source => source.Stream(data =>
                    Console.WriteLine("Accelerometer = " + data.Value<Acceleration>())
                ));
                accelerometer.Acceleration.Start();
                accelerometer.Start();
    
    
                //pressure 
    
                IBarometerBmp280 barometer = metawear.GetModule<IBarometerBmp280>();
                barometer.Configure(os: MbientLab.MetaWear.Sensor.BarometerBosch.Oversampling.Standard, coeff: IirFilerCoeff._16, standbyTime: 0.5f);
    
                await barometer.Pressure.AddRouteAsync(source => source.Stream(data => Console.WriteLine("Pressure (Pa) = "
                   + data.Value<float>())));
                barometer.Pressure.Start();
                barometer.Start();
    
                //Quaternion
                var sensorFusion = metawear.GetModule<ISensorFusionBosch>();
                sensorFusion.Configure();
                await sensorFusion.Quaternion.AddRouteAsync(source => source.Stream(data =>
                {
                    var quat = data.Value<Quaternion>();
                    Console.WriteLine("Quaternion = " + quat);
                }));
                sensorFusion.Quaternion.Start();
                sensorFusion.Start();
    
    
                Console.ReadLine();
    
                //stop 
                accelerometer.Acceleration.Stop();
                accelerometer.Stop();
                barometer.Pressure.Stop();
                barometer.Stop();
                sensorFusion.Quaternion.Stop();
                sensorFusion.Stop();
                metawear.TearDown();
                await metawear.GetModule<IDebug>().DisconnectAsync();
    
    
            }
            catch (Exception e)
            {
                Console.WriteLine("error: " + e.Message);
                Console.Read();
            }
        }
    }
    

    }

  • edited July 2018
    1. Add some code that retries ``InitializeAsync`. Do you see the same error if you are directly using the C code?
    2. I've never seen that behavior before. I have encountered times where Windows will keep the connection open, but in those cases, you cannot reconnect to the board as well until you restart the BT adapter. On Windows, the best bet is to use the disconnect method from the IDebug interface, which it looks like you are already doing.
    3. No, there is no point in uploading the same files multiple times to different hosting services. Ideally, Unity should integrate NuGet support into the IDE, similar to how Visual Studio does it



    Also, please wrap your posted code with code tags so it is rendered correctly on the forums.

  • edited July 2018

    Hello Eric,
    1. I responding now because it took us some time to perform comprehensive tests on the components. We retried InitializeAsync and ended up with performing three levels of testing, in each we try to perform sequences of "connect, "disconnect" , and loop of "connect"-disconnect":
    1. level 1 - "example-connect" in Warble (with latest commits) with success.
    2. level 2 - "Example.Connect" (the WRAPPER) with success.
    3. level 3 - testing MetaWear.NetStandard using "InitializeAsync" and "disconnectAsync" (even without strating the sensors) . Here we found some issues : in short, we cannot achieve two success "InitializeAsync" and "disconnectAsync" connections is a raw. Sometimes even the first InitializeAsync throw the exception "Failed to discover gatt characteristics" . So, i tried to do something different : this time i first call InitializeAsync , and on the second time i tried to connect to the C++ Gatt connect, but it still throws the exception.
    My conclusion is that something in the C++ prevent the second connect in a raw, when the first connect is always InitializeAsync (cause the warble and the wrapper are working fine)
    I attach the tester i used. Below is the code. You can see that i first call to InitializeAsync and then to the Gatt and always get exception.

    Also - maybe this bug is related to the other bug we have and described [here] on parallel post ?
    (https://mbientlab.com/community/discussion/2601/unity-works-perfectly-with-metawear-sensor-on-first-run-hangs-on-2nd-run#latest "here")?

    Running this code in a loop is my goal, so i can be sure it is working.

    1. Regarding Unity - i didnt mean to use it as repository : It seems that Unity integration is very common use of your platform. i can see a lot of people here raising the same problems that we have with Unity (the second freeze, connecting with warble, and interfacing with Android ). Do you plan to release a unity debugged package ?
    2. i tried to put code tags before and after my code without success. can you please explain how to do it correctly ?

    Thanks
    Erez

    Here is the code:

    {
    
        static void Main(string[] args)
        {         
            Console.WriteLine("Scanning for sensors ....");
            Scanner.Start();
            Scanner.OnResultReceived += Recieved;
            string mc = Console.ReadLine();
        }
    
        private static void Recieved(ScanResult obj)
        {
            Console.WriteLine("mac: " + obj.Mac + " power: " + obj.Rssi);
            if (obj.Name == "MetaWear")
            {
                Console.WriteLine("****FOUND: " + obj.Mac + ":" + obj.Name + ":" + obj.Rssi);
                Scanner.Stop();
    
                   MainAsync(obj.Mac).Wait();
    
    
            }
        }
        private static async Task MainAsync(string mac)
        {       
            try
            {
                IMetaWearBoard metawear = null;
                metawear = Application.GetMetaWearBoard(mac);
    
                try
                {
    
                    Console.WriteLine("Connecting ..");
                    await metawear.InitializeAsync();
                    Console.WriteLine("Connected!");
    
                }
                catch (Exception ex)
                {
                    Console.WriteLine("error:" + ex.Message + " -->retry");
                    await metawear.InitializeAsync();
                    Console.WriteLine("Connected from retry !");
                }
    
                //disconnecting 
                Thread.Sleep(3000);
                Console.WriteLine("Disconnecting ...");
               // metawear.TearDown();
                await metawear.DisconnectAsync();
                Console.WriteLine("Disconnected !");
    
                Thread.Sleep(5000);
                //try connect with Warble
                //  await metawear.InitializeAsync();+
                try
                {
                    var gatt = new Gatt(mac);
                    await gatt.ConnectAsync();
                    Console.WriteLine("Connected!  from Wrable C++");
                    gatt.Disconnect();
                    Console.WriteLine("Disconnected from Wrable C++!");
                }
                catch (Exception ex)
                {
    
                    Console.WriteLine("error:" + ex.Message + " -->Wrable");
                }
    
            }
            catch (Exception e)
            {
                Console.WriteLine("error: " + e.Message);
            }
        }
    }
    
  • I pushed out some fixes to the NetStandard plugin; the new version (v1.0.5) works with your attached solution on my machine.

    Read this
    https://help.github.com/articles/creating-and-highlighting-code-blocks/

  • edited August 2018

    Hi Eric,
    1. I pulled all commits for the three projects (warble, Wrapper and .Net), and** now i get "Catastrophic failure" message **when connecting. I attached the simulator i wrote to reproduce the error. Below is screenshot followed bt Log
    2. Is there a way to subscribe to your commits?


    Here is the logfile:

    11:49:09:031 LoadBoardAttributesAsync
    Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    11:49:10:406 exception:Catastrophic failure

    Catastrophic failure
    (HRESULT = -2147418113)
    Exception thrown: 'MbientLab.Warble.WarbleException' in MbientLab.MetaWear.dll
    Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    11:49:10:967 LoadBoardAttributesAsync
    Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    subscribe Exception thrown: 'MbientLab.Warble.WarbleException' in System.Private.CoreLib.dll
    11:49:11:985 exception:Catastrophic failure

  • Hi Eric,
    This error was due to firmware update to 1.4.1. somehow i had to update five times until until it was connected.
    Anyway , now the sensor is not advertising at all! i cannot connect from Android nor Metabase....
    How can i "wake" the sensor ? i tried to move it and restarting several times, but nothing works..

  • Same error here. Catastrophic failure. I'm on 1.4.1.

  • An update - now i cannot connect again to Metawear anymore even from MetaBase...

  • edited August 2018

    Hrm, I don't have any issues with your updated VS solution nor the sample C programs. My test board is also running firmware v1.4.1.

    There weren't many code changes in the latest release, just commits ee4230b. and 8f3b726. Maybe your adapter does not work with uncached service discovery (first commit)? Since you are working with the source code, which line is causing the exception?

    @abcd said:
    2. Is there a way to subscribe to your commits?

    You can follow the project on GitHub.

  • @abcd

    Try unpairing your sensor under Bluetooth settings in windows 10 and try connecting again. That did the trick for me.

  • Hi jimjam,
    I never pairing with windows 10 , i am using the Scan method of the Warble.
    This works for me now outside of Metawear but inside Unity is still freezing

  • edited August 2018

    MetaWear NetStandard
    This plugin implements the IBluetoothLeGatt and ILibraryIO interfaces for .NET Standard2.0 compatible applications.

    Developers buidling Windows 10 specific applications should use the Windows 10 plugin instead.

    Install
    Use the Package Manager console to install the MetaWear.CSharp.NetStandard package in addition to the MetaWear.CSharp package:

    PM> Install-Package MetaWear.CSharp
    PM> Install-Package MetaWear.CSharp.NetStandard
    Or, manually add the entries to the *.csproj file:





    Linux users will also need to compile the Warble library on their target machine and ensure that the shared library is discoverable by the dotnet application.

    Usage
    Call Application.GetMetaWearBoard with the MAC address of the device you are communicating with. You can use the SDK features, as outlined in the SDK developers' guide, with the returned IMetaWearBoard object.

    using MbientLab.MetaWear.NetStandard;
    using System;
    using System.Threading.Tasks;

    namespace MetaWear.NETCore {
    class Program {
    static void Main(string[] args) {
    MainAsync(args).Wait();
    }

        private static async Task MainAsync(string[] args) {
            try {
                var metawear = Application.GetMetaWearBoard(args[1]);
                await metawear.InitializeAsync();
            } catch(Exception e) {
                Console.WriteLine("error: " + e.Message);
            }
        }
    }
    

    }

    Try this one. Hope it helps. Courtesy of github.

This discussion has been closed.