When a specific user logs in on Windows 10, I want to have all Bluetooth devices that are currently connected to be disconnected. How would I do this? I want to be able to automatically enter something in the command line either through the task scheduler, or python. I tried installing Bluetooth command-line tools from bluetoothinstaller.com, but the only thing that I can find that works is to do btpair -u, but that unpairs all the devices instead of disconnecting them.
You can try to toggle the Bluetooth Off and On.
Its not a proper way to disconnect but it works. Try RadioControlCmd! after installing use the following commands to toggle Bluetooth On and Off
radiocontrol.exe Bluetooth On
radiocontrol.exe Bluetooth off
Related
I am working on a project with the beagle bone black wireless, where I need to be able to send music control commands to a phone. Note, I don't want to stream music to my beaglebone. I have spent about a week looking online, and found very little about this.
The OS for the beaglebone is Debian Jessie. I can get things like hci0tool, Bluetoothctl, hciconfig to work. I can detect and pair to a device. It seems though that my connection only lasts for the pairing process, and fails every time afterwards.
My current process is executing:
sudo su
bluetoothctl
power on
agent on
default-agent
scan on
I get the mac address
scan off
pair <MAC Address>
trust <MAC Address>
connect <MAC Address>
As of now pairing and trust succeed, though the connection ends after pairing finishes. And I have no idea of where to start for sending a command to a phone.
Connect call on Device1 interface will tries to connect all the profiles supported between the device and adapter. This happens by negotiating or exchanging the supported profiles.
Connection may not be possible when Adapter doesn't support the minimal requirement of profiles which is needed by the Device. In this case, you may need A2DP provider in adapter end to get connection successful. Yes, this is contradictory to this statement.
If you don't want to connect with all the profiles between Device and Adapter, then you can use ConnectProfile method in Device1 interface.
But bluetoothctl doesn't provide commands to achieve neither ConnectProfile nor you AVRCP commands.
You need to use D-Bus calls to get the communication with Bluetoothd. If your application is command line/shell based, you can use dbus-send/gdbus commands to address the D-Bus interface.
Although bluez-tools implements media control AVRCP commands, it doesn't provide any utility which uses it. Either you can compile bluez-tools as library and develop application using the media control API or use dbus-send/gdbus.
I have started with some samples using GDBUS, but not yet for AVRCP controls. See here : https://gist.github.com/parthitce
and Documentation here: https://www.linumiz.com/category/blog/
Ass everyone saying in their first posts "I'm new one" and trying to figure out one complexity.
I want to scan and create list of available wifi networks in Raspberry area and send the list to the phone via bluetooth.
Next - select one of the networks in the list on the phone, enter a password to selected network and send back via bluetooth to Raspberry
I'm using Raspberry pi3 with bluetooth on board, Raspbian OS and nodejs v7.4.0
I choose wifi-control to work with wifi network and it works greate. One thing - I should run npm run with sudo to get all networks, not just current one;
Then I'm trying to work with bluetooth via bluetooth-serial-port lib.
First of all I did all preparations that was written in documentation.
var btSerial = new (require('bluetooth-serial-port')).BluetoothSerialPort();
btSerial.inquire();
And it does nothing. At least I don't see any effect - my phone doesn't "see" Raspberry in available bluetooth devices list;
I thought that my Raspberry has porblems with bluetooth, but then I run
bluetoothctl -> power on -> discoverable on
And Raspberry appeared on phone.
What should I do to "turn on" Bluetooth control and add my Raspberry to list of available bluetooth devices?
Peace!
Got the exact same problem. My solution (which might or might not be fitting for your needs) was to pair the phone via bluetoothctl beforehand. (this already is you why this solution kinda sucks: you can't come and use a different phone/pi the next day, stuff got completely screwed when changing to a different pi :D)
Oh and the main script should run as root, else all of this wont work.
1) Pairing your device
$ bluetoothctl
[bluetoothctl] agent on
[bluetoothctl] discoverable on
[bluetoothctl] pairable on
[bluetoothctl] scan on
(now you turn on your bluetooth on your phone and search for devices, in bluetoothctl you should see your device and mac to be shown)
[bluetoothctl] pair XX:XX...(MAC of your phone)
(phone is going to show the "yo this device wants to pair"-dialog and bluetoothctl wants you to confirm the pairing too)
Now you can always connect to the pi via bluetooth, if it is discoverable or not. (I'm using Serial Bluetooth Terminal)
2) Actual talking between devices
NONE of the npm packages supposed to work with bluetooth worked for me. Not a single one. So in the end I used rfcomm and it's ability to start a program on connection. Together with serialport I let rfcomm run node myscript.js, which establishes the actual serial connection like so:
2.1) rfcomm waiting for connections
const rfcommProc = spawn(
'rfcomm',
['watch', 'hci0', '1', 'node', `${__dirname}/myscript.js`]
);
2.2) myscript.js opening the port
const port = new SerialPort('/dev/rfcomm0', spError => {
if (spError) {
process.send(spError);
}
})
Look up on the npmjs-page how to receive and send stuff now.(:
Hope this gives you some ideas and/or helped.
3) Note
The bluetooth service starts quite late. Making a service requiring it didn't do the job for me, but adding it to rc.local seems to be "late enough" to have it running and listening on startup.
I have a windows 8.1 based lap top which supports Bluetooth.
I wrote a java based bluetooth server which gets connections from Android.
The issue is, the device sometimes get invisible(or to say not shown) on android devices.
I've tried with other laptops or Android phones, but sometimes it just doesn't get searched.
I think it's not about my java server program. Even if there's a problem with my program, it should at least be shown on the bluetooth search list of other devices.
I found a very crude solution about this issue.
Always running the 'change pc settings(not the exact name)' app of windows 8.1, and going to 'PC, devices' -> Bluetooth makes it always searchable. If I turn this off(I mean the 'change pc settings' app, not turning off bluetooth), the bluetooth cannot be found by other devices.
Why is this happening? My purpose is, bluetooth server must be turned on automatically after boot, but the reliability of the bluetooth device is failing my intention. However, since my crude solution above is temporarily solving my issue, I do not think it's a hardware issue.
So, my question is :
1) Why is this happening? And how can I mend this?
2) How can I run windows metro app through windows shell? If I can't find any other solution about this, I will have to write a batch script to always run the solution thing above.
Going to Change PC Settings>PC and devices>Bluetooth is initiating a Bluetooth device search. As a side effect, the Bluetooth is also made Discoverable (pairing mode). However, this Discoverable setting is temporary, only while the PC is searching for remote Bluetooth devices.
If you wish to keep Bluetooth Discoverable at all times, you need to check the "Allow Bluetooth devices to find this PC" button box, found in Bluetooth Settings. I found Bluetooth settings by right clicking the Bluetooth system icon. Can also be found in Devices and Printers, by right clicking the Bluetooth adapter icon.
I am working on using the Bluetooth low energy modem with Linux. I am using the command line option for that i.e. hcitool . I am able to the find the devices using the command: $ hcitool scan
It is working fine for me, also I am able to broadcast my device using :
sudo hciconfig hci0 leadv
It is also working fine. But I want to add the services and characteristic to the modem device which can be detected by other device. I have tried sdptool add but it is not working for me. Does anyone know how to add the services and characteristics to the peripheral using the command line tools in ubuntu?
Edit: My modem is broadcasting but not able to explore the services and characteristic to the other BLE device. Now I am able to set the name of device using hcio name command
Edit: Now I am able to render the services and characteristic, by simultaneously running sudo hcidump command. But I am not able to track from where I am getting those services and characteristics. One definite observation is those services are rendering from the machine.
SDP is absent in BLE. Broadcast/advertise frame and GATT client/server are used instead.
Several links:
BlueZ gatttool: command line tool to run common GATT procedures
BlueZ GATT's ready profiles
hint: DBUS
GATT and DBUS example
How can I connect to the FitBit Zip over Bluetooth 4.0 LE on Linux with bluez?
Bluetooth Low Energy: listening for notifications/indications in linux
http://comments.gmane.org/gmane.linux.bluez.kernel/29547
I used to broadcast BT services by following this article. This page not only shouws you how to advertise a profile, but also gives you an example on how to implement the HSP profile.
To know the bt class you need to announce, you can check this other page.
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