Make your computer discoverable - bluetooth

my .net app on the computer needs to make the computer discoverable, start a service and then wait to accept incoming connections. my app/computer is the slave and connecting device is the master. So I change my local radio mode to discoverable programmatically,start my service and wait... But when the device is supposed to connect to my app/computer, nothing happens.
Windows help and support has this :
Control Panel ->search for bluetooth -> click on change bluetooth settings ->
To make your computer discoverable to Bluetooth enabled devices,
select the check box for Allow Bluetooth devices to find this computer.
When a Bluetooth enabled computer is in discovery mode, it broadcasts a
wireless signal that allows it to be detected by other computers or devices.
This is sometimes called pairing mode. If you check this box, your computer
will still be able to detect Bluetooth enabled devices that are in discovery mode,
but they will not be able to detect your computer.
I am not quite sure what's the context. If I leave that box checked, then other devices will be able to detect me (because I am set to discoverable), but won't be able to connect????? So my service just keeps listening, won't be able to detect any incoming requests? Am I right?

Related

Establish a connection between smartphone and PC via Bluetooth automatically

I'm trying to establish a connection between my PC running Ubuntu and my iPhone via Bluetooth automatically when it becomes available, after being manually paired beforehand. I've seen this to be possible with certain peripherals, mainly audio. For example, my phone will automatically connect to a Bluetooth speaker when it is turned on and Bluetooth is active on my phone; another example is my phone automatically connects to my car's radio system via Bluetooth when I turn the car on.
I'm not able to connect my phone to my PC without first initiating the connection from the smartphone's Bluetooth menu. I'm thinking that I could possibly write an application for the PC to attempt to connect to the device every few minutes or something, but it seems that the phone needs to be the device to initiate the connection.
The only information that I need for what I'm trying to do ultimately is that the devices can pair successfully. Essentially I'm trying to build a sort of proximity trigger between my phone and my PC without using Wi-Fi and GPS - I can't use these for some specific reasons.
Is there any way to make this happen?
Yes this should be doable as long as you use the Background Processing feature for iOS apps. In the example I'll give below, we'll have the PC be the peripheral and the phone be the central, but you can really have it working either way. You will need to do the following:-
First initial connection needs to be performed in the foreground (this is due to iOS's background limitations).
On the iOS side, you need an application that acts as a central that scans and connects to the remove device (check this example as a starting point).
Upon connection, you need to bond with the PC. Bonding is important as it will prevent you from having to do the pairing again in the future. However, pairing/bonding is managed by the iPhone's OS so you cannot write it in your application, so the workaround is to have an encrypted characteristic on the PC side that will force the iPhone to bond (this is covered later).
On the PC side, you need to have a BlueZ script that acts as a peripheral that is always advertising. You can do this using bluetoothctl (check the examples here and here).
Before you start advertising, you need to have a GATT server on the PC side (to do this, check this example).
When registering characteristics, ensure that one of them has the encrypt-read property (you can find a full list of the properties here).
Now when you attempt to read this characteristic from the iOS side, the two devices should bond (make sure that your PC is bondable which you can do this via these commands).
Once the devices are paired, your iOS app needs to be working in the background constantly scanning and attempting to connect to the same peripheral (have a look at this and this example).
You can find more useful information at the links below:-
Getting started with Bluetooth Low Energy
The Ultimate Guide to CoreBluetooth Development
How to manage Bluetooth devices on Linux using bluetoothctl

iOS13 - Detect if bluetooth is enabled without prompting bluetooth usage request

In previous iOS versions you could detect if the user had bluetooth enabled or not without actually prompting the user's permission to access bluetooth. In iOS13, CBCentralManager now prompts bluetooth permission just to check if they have bluetooth turned on or not, regardless of if the app is actually going to use bluetooth directly.
Our app uses Apple's multipeer connectivity framework to communicate between devices (peer to peer) which uses a combination of wifi and bluetooth, or just wifi if bluetooth is disabled, but that is slower, so we like to remind our users to turn on bluetooth for a faster connection. Using this framework does not actually require a permission prompt for the app to use bluetooth because Apple manages all of that in a closed box so our app itself doesn't use bluetooth or require a permission prompt to work, but Apple's multipeer framework works better if the user has bluetooth enabled.
We want to simply remind the user to enable bluetooth for a faster connection, but only if they don't already have it on. However just checking if it is enabled the old way now requires a bluetooth permission prompt even though we won't be using bluetooth in the app.
In iOS13 is there a new method for just checking if bluetooth is enabled or not that doesn't require a bluetooth permission prompt.

How to keep the HoloLens On when plugged in

I have a HoloLens, and I want to interact with the API's. Unfortunatetly, it keeps going into standby mode, even when plugged in. This means I have to wear the HoloLens like a hat to keep it on. Even though I'm not trying to physically use it.
Is there anyway to keep it out of standby mode when it is plugged in?
You can set the behavior when plugged if you enter the Device Portal (enter the IP of your device in a web browser).

What does adb device status mean?

I am getting the message adb device status:offline in my terminal of Android Studio. What does this mean ?
I have one android virtual device as my emulator. My emulator is working fine. And it is also connecting to the internet since maps are getting loaded. So is this gonna affect anything ?
This is described in the adb documentation:
State — The connection state of the instance may be one of the following:
offline — the instance is not connected to adb or is not responding.
device — the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
no device — there is no emulator/device connected.
So if your device is listed as offline it might affect your ability to communicate with it via adb - e.g. to collect logs. It's not an inidcator of the device's internet connection status.
The adb documentation says that there are 3 connection states: offline, device, and no device, but there are actually a few more connection states that the device can be in. You can see this in the adb header file on line 174.
From the adb documentation:
offline - the instance is not connected to adb or is not responding.
device - the instance is now connected to the adb server. Note that this state does not imply that the Android system is fully booted and operational, since the instance connects to adb while the system is still booting. However, after boot-up, this is the normal operational state of an emulator/device instance.
no device - there is no emulator/device connected.
Some other states:
recovery - Your device is in recovery mode. This mode is used to recover your phone when it is broken or to install custom roms.
sideload - Your device is in sideload mode and can accept adb sideload commands. This mode is used to push and flash zip file images to the device and is accessed through recovery mode.
unauthorized - The adb host's RSA public key has not been added to the device. This happens when you haven't clicked allow on the Allow usb debugging? dialog on the device.
no permissions - Insufficient permissions to communicate with the device.
host - I haven't found any good explanation of what this state is.

Bluetooth connection close itself right after start

my problem is the connection with a Bluetooth device. I have a Netbook with an integrated bluetooth device. I want to connect my netbook with an OBD-II interface and write a software to read out the stats of my car. To test the connection, I started by adding the OBD device via the bluetooth menu. The manager connects to the interface and it wants me to wait while the configurations are taking place. This state lasts "forever". After 60-Minutes of waiting, I closed the window. However, the device is shown in the list of available devices. Because I'm not able to switch the button to initiate the connection, I thought about using minicom (the OBD-II interface uses SPP for communicating).
As far as I did understand, I need an initiated connection with a bluetooth device and with it a virtual serial port to connect to with minicom. After reading some postings, I found out that the hcitool should be able to create the bluetooth session. With this I was able to connect to the device and the "connected" button turned on. Unfortunately it switches back after 2 secs.
hcitool scan is able to find the device
hcitool cc 00:11:22:33:44:55 is able to connect for the already mentioned 2 secs
hcitool con list the connection if it's called within 2 sec after initiating
I also tried to connect via a Windows PC using putty. Windows connected with the device without a problem and after that, I was able to send requests and get the appropriate answers. So it seems like the interface is working correctly.
I'm using Fedora 17 with gnome3. If you need any output or more information, please let me know.
Thanks in advance

Resources