Attempt at sample NuGet implementation

edited April 2016 in C#
This is my attempt to remake the test app from the c# wrapper as a windows universal app and use the C++ API NuGet package.

You will see in DeviceInfo.xaml.cs that I have left comments in a number of places where I can't figure out quite how to make it work. Any help there is much appreciated.

Comments

  • api v0.3.0 changed how the library handled ble communication.  You should read the v0.3.0 how to page:
  • Oh I see, thanks!
  • Thanks again. I think I'm on the right track now with the BtleConnection and readGattChar and writeGattChar functions (and I pushed my changes).
  • At this point, I have a successful bluetooth connection and I can turn the LEDs on and off, but when I try the gyro I get some kind of external exception.
  • I've pushed out a sample uwp project that will go with the tutorial videos. Part 3 will cover data streaming from the accelerometer. Hopefully this will help you with getting the gyro working. It sounds like there is something wrong with initializing the library but can't say for certain.

    https://github.com/mbientlab-projects/MetaWearTutorial-UWP/tree/377183d2301daabb37e0916290089dd61bc82938
  • Nice, thanks! I appreciate your work on this.
  • I've downloaded the latest code that Eric pushed and I can confirm that I'm getting an external exception as well. This is with a Lumia 635 and a DragonBoard 410c running Windows 10 IoT. The dragonboard is able to pair with the MetaWear, but dies in unmanaged code sometime after line 80 of DetectorSetup.xaml.cs inside the Frame.Navigate command.

    I'm happy to bring the DragonBoard up to SF to facilitate debugging...I have 8 MetaWear C's waiting on code for a tech demo for PAX East, and I'd really like to show it off on this platform.
  • Hrm....Perhaps I missed something with handling the delegates that the C# side uses to wrap function pointers, which I hope is the root cause.  I'll have to setup native debugging and step through the C++ code.
  • Thanks Eric, I really appreciate it. I only have a couple days left before I have to head to Boston. I just realized that I was running Windows 10.0.14295.1000 on the DragonBoard, which is a Windows Insider build. I'm reverting the board to 10.0.10586 and trying again. I know they are working on the onboard Bluetooth for Pi3 with this build, and it is conceivable they changed something in the Bluetooth API that is causing your code to complain.
  • I checked out the commit for the accelerometer tutorial, and it worked for me! I can see realtime values in the debug console, hurray!
  • I'm still getting the same error even with the latest code. jrood, could you tell me exactly what configuration you're using? I'm happy to go buy hardware to make this demo work.
  • This is the stack trace for the error:

    Step into: Stepping over non-user code 'MetaWear.NugetImplementation.SampleApp.MetaWear_NugetImplementation_SampleApp_XamlTypeInfo.XamlSystemBaseType.get_UnderlyingType'
    'MetaWear.NugetImplementation.SampleApp.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\452fdf44-f8fd-4797-9a94-e432932cb429VS.Debug_ARM.Laura\System.Text.Encoding.dll'. Module was built without symbols.
    'MetaWear.NugetImplementation.SampleApp.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\452fdf44-f8fd-4797-9a94-e432932cb429VS.Debug_ARM.Laura\System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    Exception thrown: 'System.Exception' in MetaWear.NugetImplementation.SampleApp.exe
    The program '[2436] MetaWear.NugetImplementation.SampleApp.exe' has exited with code 0 (0x0).
  • For me, I was testing everything on my laptop running Windows 10.  We have a BLU Win HD LTE X150Q phone in the office but after upgrading to Windows Phone 10, the app simply crashes when trying to call FindAllAsync, possibly the same bug filed here, https://github.com/Microsoft/Windows-universal-samples/issues/246.
  • Yes, that sounds exactly like my issue. Did you have this code working on the BLU Win HD running Windows Phone 8.1?

  • Yes, it was with an older version of the C++ API (v0.2.0) but I don't see why it wouldn't work with the current release (v0.4.15).  I have not released a NuGet package for the Win81 platform so you would have to build the windows runtime component yourself.
This discussion has been closed.