0

I'm writing a Metro Style C#/XAML application which connects to Bluetooth Low Energy device and recieves data from it. Microsoft shared a sample which uses WPD API and makes all what I need. But it is written in javascript and uses javascript specific methods like ActiveXObject().

var deviceFactory = new ActiveXObject("PortableDeviceAutomation.Factory");

Is there any way to port this code to C# Metro application?

1 Answers1

1

This API is JavaScript-only. If you need to access Bluetooth Low Energy devices from C# in Windows 8, you can write a Windows Runtime component using the WPD C++/COM API that projects the functionality you need to access.

Sample (see Scenario 6 for a device services example): http://code.msdn.microsoft.com/windowsapps/Portable-Device-API-57c4e696

Windows Runtime Component (can be consumed from JS or C#): http://msdn.microsoft.com/en-us/library/windows/apps/hh755833.aspx

Lisa O
  • 125
  • 2