Automate connecting to bluetooth devices from Chrome - google-chrome

I've written a simple web app to factory-reset bluetooth devices that were accidentally turned on during shipping. The app scans for a class of bluetooth devices (those made by the company I work for), renders a list of devices found, and, when I click a button next to a device in the list, sends a reset message to the device.
This is a very manual process and I'd like to automate it. The problem is the Chrome dialog that asks for permissions to pair with a device. I am trying automate the app with Puppeteer, but I can't find a way to either (a) programmatically grant permissions to pair with a device or (b) to select the device in the dialog and click the "pair" button via Puppeteer. Anyone know if what I'm trying to do is possible, or if there's a better way to achieve the goal? Thanks!

This is not possible in Chrome. (I work on chrome.) The automation that does exist for Chrome's testing is layered such that actual Bluetooth connections aren't made.
Eventually we would like to enable this workflow via Enterprise configuration controls. But that is not started yet and there is no date commitment.
One alternative is to use node.js, though you lose the easy interface. You might build the reset backend in a node server and have it serve a web page interface.

Related

Can I access an USB HID in Chrome without an App?

I want to use an USB HID from a website. The website will only be accessed by Chrome browsers. The solution should require a minimum amount of extra software and setup for the website user to work.
The USB device presents itself as USB HID to the OS and I need to write and read byte arrays to and from it in order to implement the manufacturers specification for some of the device's features.
My current solution consists of two parts:
A Chrome App that uses the chrome.hid API to talk to the device. This App exposes a Chrome Cross-Extension messaging port to provide and interface for "service calls".
JavaScript code on the website that sends requests to the Chrome App, which then talks to the USB device to process the request.
In order to make it easier for the user I want to get rid of the App, so the user can just surf to the website, grant access to the device if necessary and then be able to use the device.
To be clear, I want the user to be able to use the website without installing any dependency first.
I already tried using the WebUSB navigator.usb API but Chrome blocks access to USB HID devices. Is there another way to accomplish this?
WebHID is being developed for this use case. It has been available behind a feature flag since Chrome 78, with an original trial expected in Chrome 84 (probably later due to current Covid-19 situation), estimated stable August 2020 .
For more details: https://github.com/robatwilliams/awesome-webhid

Windows Bluetooth ON/OFF API

When I enumerate Bluetooth LE devices using WinRT API, sometimes, I needed to reset Bluetooth radio to successfully find my device. I am wondering is there an easy way to do this from code (Windows SDK, WinRT, WMI etc)?
After digging through Windows Universal samples from Microsoft, I have found a sample RadioManager which shows how to access Radios and turn ON/OFF from code at will. I was able to use the API successfully with a caveat that when used from Desktop WPF app, the app has to be built to match native architecture of the machine. Otherwise, ‘GetRadiosAsync’ method returns empty set.
I'm not totally sure, but resetting the system-wide Bluetooth radio is the sort of action highly unlikely to be available to an execution environment with non-admin privileges.
Anything able to stomp over the abilities of other processes (like turning off a radio) is not going to available in WinRT.
Edit: I stand corrected. Such an API apparently exists:
Windows.Devices.Radios.SetStateAsync

Prevent WinRT App from entering suspend state in a Line-of-Business app

I'm developing a line of business app for Windows 8.1, that is, I am not deploying through the Windows Store and will be able to control all of the features of both the OS and hardware this app is being deployed on.
Because this app is working as the UI in a real-time situation I would prefer if I could ignore the life-cycle events and not have the app suspend or terminate at the whim of Windows 8. Does anyone know of a way to do this?
I have seen some older answers, such as this one and this other one indicating otherwise, but I haven't yet found anything more recently and specifically dealing with the case of a line of business app. I have found the Embedded Lockdown Manager which would prevent the app losing focus and addresses some of the needs I have, but I still would like a way to simple disable Lifecycle events.
Have you tried Assigned Access Mode? Basically use PC Settings -> Accounts to lock an account to a single app. You have to reboot the device and log-in again in order to run anything else.

How to select keyboard in Tizen/HTML5 for Wearables

I have two system wide keyboards pre-installed on my Tizen Wearable device, the first one is a stock Samsumg's keyboard, the second one - Custom. The first one is a user's default selected in Settings.
I don't want to change the system's default, but I want my application to use the Custom keyboard.
In native API I've seen Tizen::Ui::InputConnection object that can be used as a property in Edit or TextArea controls, but I didn't see anything like this in HTML5 API. Searching Tizen's forum didn't help.
I've also seen in Tizen's SDK IME's WebHelperClient example a number of undocumented commands used to talk to a Tizen's service through a websocket. Probably there is a command to select an active keyboard, but I didn't find it.
Any leads are appreciated.
IMO that is not possible for either web apps or native apps.
Reason:
1. In gear, simultaneously two Keyboard can't be active at the same time.
Also, suppose there is an API available which you can use to change to custom keyboard while your app is running, but what if you close your application not using the normal hardware exit(i.e. Swiping down), rather you close it from "Recent Applications" then the custom keyboard that you activated for your app will be set for other applications as well.
Also the documentation available here doesn't explain anything which you are asking
https://developer.tizen.org/documentation/guides/web-application/tizen-features/ime-application

Chrome OS/Chromebook: How to control user access

I need to know if it is possible to emulate certain functions of the ChromeOS Management Console through apps.
Basically, I want an app to be able to control certain aspects of the OS without being required to purchase the management console.
I believe there is a way to do it, I just need to know where to start. Can an normal JS extension do it? Pepper app? Native App? Which method will give me access the the settings section of the chrome OS?
Most, if not all, of the functionality provided in the settings section is not available to normal apps or extensions.
That's probably not what you wanted to hear. To officially request the chrome team adds the features you need, go to http://crbug.com and make a feature request. You should include more details about exactly what you're trying to do.