Does the Universal Windows Application infrastructure support any Serial Port communications? - bluetooth

I have a WPF desktop application that would make a good candidate as a Universal Windows App. The application has a must-have dependence on USB or Bluetooth devices that act as a Serial Port.
In all my reading I've yet to discover whether there is any access to a SerialPort API in a UWA.
I suspect the answer is 'No support'. If so, does anyone know of a USB or Bluetooth GPS that supports whatever APIs the UWA has for that sort of thing. I have to be able to read things like ground speed, elevation, rate of climb, etc.
If the answer is 'Supported', could you point me to some documentation.

For the "Bluetooth devices that act as a Serial Port", I assume you mean the RFCOMM. They are both supported on Windows Runtime since Windows 8.1 and you can also use them in the Universal Windows Application.
namespace: Windows.Devices.Usb and Windows.Devices.Bluetooth.Rfcomm.
About the Bluetooth GPS, I'm not sure if it uses RFCOMM or not (it depends on the devices), and it is also possible to use the GATT.
Code Sample: Custom USB device access sample

Related

webUSB Relay Driver hardware

Over the last couple of years I have been looking for an easy way to control a few relays from Javascript. I want to build a web App to control starting sequence horns for sailing races.
I recently discovered webUSB and it seems like exactly what I need. A direct connection from JS in chrome to the USB world. Simple coding in a language I already use.
On the hardware side I am having trouble finding a product that is compatible. Googling USB Relay finds 100's of products that all seem to rely on some proprietary SW for the OS. I can find lots of educational demo's that turn an LED on and off.
Does anyone have any ideas where to find such a product?
While I'm sure you will be able to find USB relays that can be controlled via WebUSB, most USB relays will probably come with some kind of serial port driver, e.g. https://numato.com/product/1-channel-usb-powered-relay-module uses a CDC serial port driver. These can be controlled using Web Serial, available in Chrome 77 and later behind a feature flag. For a tutorial, see https://codelabs.developers.google.com/codelabs/web-serial/
Explainer: https://github.com/WICG/serial/blob/gh-pages/EXPLAINER.md
API docs: https://wicg.github.io/serial/
If you search for "5V USB Relay Programmable Computer Control For Smart Home" on eBay, you will also find low-cost relays that use HID instead. The advantage of these is that you don't need any serial port or USB drivers, as it will use the operating system's built-in HID drivers. For that you can use WebHID. For more info, see https://github.com/robatwilliams/awesome-webhid.

Controlling a driverless USB Audio Device

I have a USB audio device (Scarlett Focusrite 18i6) which does not require a driver, so I assume it uses the USB HID Audio Class standard.
It works on everything from Windows and Mac to Linux and iOS.
But on Mac and Windows, it has a control application which can for instance enable and disable direct monitoring.
How would I go about reverse-engineering how this is done, so that I can reproduce it on platforms where the control application does not exist?
I'm thinking of booting up Windows in a VMWare session and then logging the USB communication (somehow?) while using the control application, but it does sound tedious considering the amount of data and my very limited understanding of USB.
Any other suggestions?
You could try running the control application using Wine instead of reverse engineering it. However, if it's accessing USB devices then there is a good chance it might be using an API not supported by Wine.
To reverse engineer it, you should find a way to look at the USB traffic between the computer and the device. Total Phase has some hardware USB protocol analyzers, but you might be able to find a good software solution for free.

How to connect to Bluetooth OBD II with visual C++ and for PC

I'm trying to use a Bluetooth OBDII (on-board diagnosis) to connect with a Bluetooth dongle connected to my computer (My OS is windows 7). The dongle connects to the device and assigns it 2 virtual com ports (COM4 for incoming and COM5 for outgoing), But unfortunately I couldn't communicate with this device over the virtual com port. I also attempted to work with winsock library but I didn't find any example for working with Bluetooth OBD and send and receive the instruments. I just found one Bluetooth API for android but it's not useful for me because I want to implement it inside the visual C++ and for PC. and right now I have 2 questions about that :
1. which method is better, Virtual com port or winsock and how ?
2. Do you have any sample code for working with Bluetooth OBD ?
1: Has your device a ELM327 chip? If so, you can setup a serial port over bluetooth, and communicate with that port. I don't know winsock very much, but I think a serial port is better suited for this job.
To set it up, have a look here: http://windows.microsoft.com/en-us/windows7/choose-a-com-port-for-a-bluetooth-enabled-device
Maybe if you can pair with the device, windows 7 will automagically set it up?
2:
You might want to have a look at: http://icculus.org/obdgpslogger/
It's open-source, so you can have a peek how it works. There's also a simulator in the package, which could help you developing/testing. Mostly is Linux based, but it should give you hints where to go. There are also windows installers available for the simulator.

Can PeerFinder class of .NET communicate with mobile phone devices through laptop via bluetooth?

I doubt the limitation of PeerFinder class in .NET. Can it make connection only with other laptops when implemented on laptop and phone to same phone when implemented on phone? Is it limited only to communicate with Windows OS devices, or is it able to communicate with any bluetooth device irrespective of OS?
Kindly, help me if you are sure of this class capabilities. I have seen the implementation of 32Feet.NET but my question is limited about PeerFinder class and its limitations.
Start from this link, in which you can find several useful links for WinRT communication (the suggested protocol to use from Windows Phone 8 to communicate using NFC or Bluetooth)
http://blogs.ugidotnet.org/Nick60/archive/2012/12/30/win-rt-proximity-communication.aspx
You have two possible scenarios:
App to Device: you can connect a Windows Phone 8 device to third party devices (for example a LEGO robot or car audio systems) Bluetooth/RFCOMM (that is serial port profile, for the emulation of RS232 serial connections).
App to App: for communications between Windows Phone 8 devices and also Windows 8/Windows RT devices!
The PeerFinder class is the base class for discover another instance of your app on a nearby device and create a socket connection between the peer apps by using a tap gesture or by browsing:
http://msdn.microsoft.com/en-us/library/windows/apps/br241203.aspx
Hope this helps!
Unfortunately, it seems that the only way to stablish a socket connection using Bluetooth between a WP8 app and a Windows 8 app is by triggering the connection using NFC tap gesture. Although the PeerFinder documentation suggests that you might be able to specify AlternateIdentities to advertise peers running on both devices, it seems that Windows 8 relies on WiFi Direct, while WP8 uses Bluetooth.
So, if you are not able to use the NFC tap gesture between both devices to trigger the connection, you might not be able to pair both apps running on the different devices.
See this thread for more info.

Does the WindowsCE firmware support multiple BlueTooth connections?

Can a WindowsCE device connect so more than one BlueTooth device? The device needs to both serve as a BlueTooth hands-free speaker for a phone and connect to a third device via a serial BlueTooth connection.
Can an application do this without the need of a speciel driver?
You must understand that Windows CE is a modular OS and any specific platform capabilities are implemented by an OEM. An OEM can create a Windows CE device with absolutely no Bluetooth support or they might choose to implement just a Bluetooth client profile (say as a bluetooth audio device) or they may choose to implement a Bluetooth server so they can consume a Bluetooth serial device. They may also choose to implement both. Beyond what the OEM does in software, the hardware itself might allow only one or the other (or both or neither for that matter).
The short of this is that we can't actually answer your question becasue there is no generic answer that fits all devices. You have to ask the Device OEM what they support and if they can extend that support if they don't support what you need.

Resources