I've been attempting to detect whether a bluetooth device is connected to an android phone once a button is clicked. If detected, I would like to interact with this device from within my app. The device I'm talking about is http://www.senanetworks.com/sd1000-01.html .
I've used the example code of https://www.npmjs.com/package/react-native-ble-manager to test it out, but unfortunately, it's not picking up this device even though the regular settings app does. Additionally, checking for already connected peripherals does not work if I connected to the device outside of the app. Any tips on how to do this?
The device you are using, the Parani-SD1000 Bluetooth Serial Adapter, does state in its specs that it uses Bluetooth 2.0. You are using a library for Bluetooth Low Energy devices, but BLE was only introduced with Bluetooth 4.0.
Your devices definitely uses Bluetooth Classic (also nown as Bluetooth Serial), thats also the reason why it shows up in the settings of your mobile phone. You need to use a library like react-native-bluetooth-serial. You can use the isConnected() method to detect wether or not it is connected.
Related
I am building an IOT device for my home and have mDNS responder on it (to avoid static IP setup for IoT devices).
Devices are to be controlled with React Native Android app, but the same seems to be not working and am getting Network error (using Axios).
My endpoints have changed from http://192.168.0.2/setSettings to http://mymdnstest.local/setSettings same works from windows chrome browser but not from android browser as well.
I came across zeroconf but it seems it searches for mdns URL but I am looking for more of invoking them.
Note: the mDNS endpoint is known to my React Native app.
Zeroconf actually works, the issue is with emulator it doesnt let us know if it works.. If you test it with physical device will get to know the mDNS details.
Is it possible to connect a bluetooth device whose ID I know without the pairing screen?
classic:
navigator.bluetooth.requestDevice ({filters: [{services: ['heart_rate']}]})
.then (device => {
this.device = device;
return device.gatt.connect ();
instead I would like to do device.gatt.connect () without navigator.bluetooth.requestDevice .. at least for the device that I have already connected once or of which I know the ID.
can someone help me? ..thank you!
The Bluetooth Permissions API integration section of the Web Bluetooth spec does specify a way to do this using a device ID. However, it is not currently implemented in any browser.
There is ongoing work in Chrome to implement a getDevices() method that can return a list of previously granted Bluetooth devices. The status of that API can be checked in Chrome Platform Status.
6/22/20 Edit:
I recently implemented a new permissions backend as well as two APIs that will enable previously permitted Bluetooth devices to be used.
The new permissions backend is implemented behind the chrome://flags/#enable-web-bluetooth-new-permissions-backend. The new backend will persist device permissions granted through requestDevice() until the permission is reset in Site Settings or the Page Info dialog box.
The getDevices() and watchAdvertisements() are implemented behind the chrome://flags/#enable-experimental-web-platform-features flag for Chrome 85.0.4165.0 or greater. The recommended use of these APIs is to use getDevices() to retrieve an array of permitted BluetoothDevices and then calling watchAdvertisements() on these devices to start a scan. When advertisement packets are detected from the devices, the advertisementreceived Event will be fired on the device that it corresponds to. At this point, the Bluetooth device is in range and can be connected to.
Please give this new feature a try, and file any bugs at https://crbug.com using the Blink>Bluetooth component.
I am testing web blue tooth through
https://whatwebcando.today/bluetooth.html
one of the use cases there is from the browser, it should be able to detect BLE devices and extract the battery service, which should provide a facility to determine battery level of bluetooth connected device,
However during scanning, the site cannot detect my mobile phone, I have read that Web bluetooth only supports BLE
is this compatibility issues? Upon reading i see that Blue tooth 5 of galaxy note9 is supports BLE or am i wrong?
As far as I know, Galaxy Note 9 supports BLE. As per to the documentation, even though the Web Bluetooth API specification is not finalized yet, the Google Chrome team still in progress for the implementation. It is suggested to use the navigator.bluetooth.requestDevice function that takes a mandatory Object that defines filters. These filters are used to return only devices that match some advertised Bluetooth GATT services and/or the device name. From this, you can check if your device is compatible with Web Bluetooth API specification.
Your phone does not advertise BLE packets automatically. You should have an app that starts BLE advertising.
Your Phone needs to simulate a BLE device and send advertisements of the specific service. In this case the batter_service.
You can use the BLE Peripheral Simulater for testing
So, I am developing this VR website online with JavaScript.
I have a function that instantiates an object in the 3D room, at the given location that the user is "watching".
However, I don't see how I can execute that function when my iPhone is locked away in the VR headset. I have been thinking about volumeup-button on my headset that is connected to it or something, but haven't found anyone that has done that before.
Do you guys have any advice? Could there be a way of connecting a BlueTooth remote to it? Or is it simply impossible?
TLDR; How to execute a function in the browser on your phone, when you can't touch your phone.
It is possible to connect Bluetooth keyboard to iOS devices, as you suggested in your post.
You might also leverage the other sensors in the phone (such as accelerometer, gyroscope, microphone), but I'm not certain if Safari has access to those. You would have more options if you developed a standalone application rather than trying to go through a browser.
I have been looking through the MSDN docs for Windows Store apps and the only thing I found that was close to Bluetooth was the Windows.Networking.Proximity. This appears to be a class whose use is only for close proximity ie within 3-4 centimeters. The app I am developing is on a HTML5/WinJS platform.
Is there a BluetoothSocket class like there is for android? For those store developers who are not familiar with Bluetooth on android essentially you create a Bluetooth Device member variable and populate that member with the device information, which is a native java call.
That will give you a list of paired devices, and you just open a Bluetooth socket to that device and then its the standard socket operations on a in/outstream for read/write.
Do I need to do the same thing and write a C++/CX version of this and add it as a Windows Component? The key thing here is that the device I'm connecting to treats the Bluetooth as a COM port, so all I need is a stable, reliable way to read/write to this device as if I were connected to a COM port.
Looks like #JimONeil's answer predates Windows 8.1 and was indeed correct for Windows 8, when the only way to have custom communication with BT device would be to create so called "Device App".
As of Windows 8.1 there is a simplified API which allows for easier (as OP describes "Android style") communication with BT devices.
Here's the quote from MSDN docs for "New Windows 8.1 APIs":
For Windows 8.1, Windows Store apps can use the new RFCOMM and GATT
(Generic Attribute Profile) Windows Runtime APIs to access Bluetooth
devices. These APIs provide access to the Bluetooth BR/EDR and
Bluetooth LE transports.
There're also few good sample projects:
Heart Rate Device (C++/ C# and JavaScript)
Bluetooth Chat (C++/ C# and JavaScript)
Per this MSDN Forum article, there isn't a generalized Bluetooth stack available for Windows Store applications.
As the thread indicates, there is only a Bluetooth Call Control sample and
If a device manufacturer needs to use Bluetooth as part of their
device, they can provide a driver and metadata for a Store app to use
it.
Information here:
http://msdn.microsoft.com/en-us/library/windows/apps/hh464909.aspx