Change Bluetooth name Python - python

I'm using PyBluez on Ubuntu 10.10. I would like to know how is possible to change the bluetooth name of the local device in software. I couldn't find any command related..

Invoke org.bluez.Adapter.SetProperty(u'Name', u'New name here') in the /org/bluez/<pid>/<device> object path on the org.bluez D-Bus bus.

Related

Python BLE Bleak Device not Found

I'm trying to use the Adafruit_CircuitPython_BLE_iBBQ python library (see https://github.com/adafruit/Adafruit_CircuitPython_BLE_iBBQ) to connect to the INKBIRD Smart Wireless BBQ Thermometer. I have used conda and the circuitpython docs to successfully create a circuit python environment. I'm running the sample code at https://docs.circuitpython.org/projects/ble_ibbq/en/latest/examples.html.
It correctly finds the iBBQ advertisement but then throws
bleak.exc.BleakError: Device with address FC:45:C3:38:76:03 was not found.
Does anyone know how this might be addressed?
Thank you!

Remote bluetooth camera trigger for phone

I would like to build a camera trigger for my phone by simulating a BLE keyboard that sends the Volume Up key to the phone connected by Bluetooth. I want this because I want to trigger the native Camera app, and not an embedded camera view.
I'm agnostic about technology used but ideally for simplicity I'd like it to be a command line utility in my Macbook, with something like Go or Node.js.
I've looked into Noble for Node.js, which doesn't seem to be oriented at emitting, and found projects for arduino, and found a couple of StackOverflow questions asking the same, but nothing definitive yet.
Apparently the Bleno project for Node.js could be better suited, but apparently it's very outdated.
Would someone please point me in the right direction?
Thank you
Edit
I was able to use Bleno to emit 0xEA and 0xE9 (Volume Up and Volume Down apparently), and using the LightBlue app I'm able to inspect that receive those messages, however, connecting to the MacBook through the phone's bluetooth does not increase/decrease volume.
Edit
Found this outdated project written in Swift 3 for reference
Edit Apparently the pybluez project looks like it could be a good option
You should be able to use the terminal for that. Eg. in Windows, you can start the camera app using start microsoft.windows:camera
Something similar should be available even in Mac. Try that out. Otherwise, go to the root directory where the camera app is stored. And then trigger that from code.
You need to create a Bluetooth HID (or HID over GATT) peripheral that your phone can connect to and will receive the key commands from.
There is a project here that did it with a Raspberry Pi:
https://gist.github.com/ukBaz/a47e71e7b87fbc851b27cde7d1c0fcf0#gistcomment-2997623
Unfornately the underlaying Bluetooth library will not move across to your Mac Book.
The HID protocol is documented here: https://github.com/jpbrucker/BLE_HID/blob/master/doc/HID.md
In summary, I think what your saying is that you want to make an cli application which is on your laptop/desktop connect to your phone via Bluetooth and simulate a volume key from your laptop/desktop keyboard.
Android:
To do this you will need:
Python 3.5 or above
PyBluez
Keyboard(Python module/API)
Android Studio
Java Development Kit 8 (preferably 11 or 14)
Android BLE
So in order to do this I would create a cli application with python3 and I would record the key presses on the laptop/desktop machine by using the keyboard module this then gets transmitted(bluetooth) via the PyBluez module to your phone. Your phone then accepts the bluetooth data via Android BLE and then simulates the volume button press.
DISCLAIMER:
This only works when the phone is already paired to your pc and only work on android phones 4.4.4 and above.
Some Links That Could Help You:
Bluetooth lib for python 3 ,
detect key press in python? ,
Create a socket for 4.0 bluetooth transmission
IOS:
To do this you will need:
Python 3.5 or above
PyBluez
Keyboard(Python module/API)
XCode
Swift
Core Bluetooth Module
So in order to do this I would create a cli application with python3 and I would record the key presses on the laptop/desktop machine by using the keyboard module this then gets transmitted(bluetooth) via the PyBluez module to your phone. Your phone then accepts the bluetooth data via Core Blutooth Module in swift and then simulates the volume button press.
DISCLAIMER:
The phone and laptop/desktop must be paired before it runs this might sound obvious but some people might ignore this.
Some Links That Could Help You:
iOS use the volume buttons as input ,
https://developer.apple.com/documentation/corebluetooth/transferring_data_between_bluetooth_low_energy_devices

Pyserial error: could not open port

I've been following this tutorial: https://circuitdigest.com/microcontroller-projects/arduino-python-tutorial
import pyserial didn't return any errors, but when I run my python code, I get the following error:
SerialException: could not open port 'com18': WindowsError(2, 'The system cannot find the file specified.')
Anyone know how to fix this?
I copy what you can read in the tutorial:
ArduinoSerial = serial.Serial('com18',9600)
Note: It is very important to mention the correct COM port name. It can found by using the Device manager on your computer.
When you have plugged your arduino, windows has chosen another COM number.
The port can be found directly in arduino IDE. It detects all devices connected on USB; but the IDE do not know which one is your arduino. In the menu tools / port you will see the list of COM on your computer.
If no COM is proposed, then you miss a driver for your card under windows --> google for it.

Raspberry pi using bluetooth.discover_devices() with python not working

I have installed bluetooth with
sudo apt-get install bluetooth bluez-utils blueman
I can find my mobile phone with
hcitool scan
The problem is when i try to use bluetooth in python file
import bluetooth
works fine. But when I try
nearby_devices = bluetooth.discover_devices()
It's not working. Error is
AttributeError: 'module' object has no attribute 'discover_devices'
Based on some web pages that should work.
P.s. basically I would like to send text file to my mobile device programmatically. And this is begining of that proces.
I have fixed the problem. It was very silly mistake. If I could I would delete the question. I have named my other file bluetooth in the same folder. So when I wrote import bluetooth it was my other python file that was imported not bluetooth module.

get GPS coordinates via bluetooth with python on OSX

I just bought a GPS bluetooth receiver, which has been correctly paired with my OSX machine. Now I would like to query the device for my position with python. How do I do it?
I assume your GPS receiver works over a virtual COM port, so it's independent of bluetooth.
Probably these libraries will help you:
Python bindings for gpsd (which is available for Mac too)
PyGPS, untested
with a virtual COM port you can use this script with the NMEA 0183 protocol http://miguellopes.net/bluetooth-gps-python/ (it's in portuguese but google translator can give you a help there)

Categories

Resources