pybluez | Bluetooth Python extension module

 by   pybluez HTML Version: 0.23 License: GPL-2.0

kandi X-RAY | pybluez Summary

kandi X-RAY | pybluez Summary

pybluez is a HTML library typically used in Networking applications. pybluez has no bugs, it has no vulnerabilities, it has a Strong Copyleft License and it has medium support. You can download it from GitHub.

The PyBluez module allows Python code to access the host machine’s Bluetooth resources.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pybluez has a medium active ecosystem.
              It has 2012 star(s) with 625 fork(s). There are 70 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 29 open issues and 331 have been closed. On average issues are closed in 83 days. There are 4 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of pybluez is 0.23

            kandi-Quality Quality

              pybluez has no bugs reported.

            kandi-Security Security

              pybluez has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              pybluez is licensed under the GPL-2.0 License. This license is Strong Copyleft.
              Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.

            kandi-Reuse Reuse

              pybluez releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pybluez
            Get all kandi verified functions for this library.

            pybluez Key Features

            No Key Features are available at this moment for pybluez.

            pybluez Examples and Code Snippets

            No Code Snippets are available at this moment for pybluez.

            Community Discussions

            QUESTION

            How do I connect a L2CAP-based Bluetooth Camera Shutter (AB Shutter 3) to Linux and get the key event in Python?
            Asked 2021-Feb-26 at 07:23
            Goal

            I have a HITSLAM Camera Shutter Bluetooth button (which is a AB Shutter 3 device, a common Bluetooth camera remote control) which I want to connect to my NVIDIA Jetson Nano using Bluetooth, so that I can use the button's input for some task.

            What I Have Done

            I am using the PyBluez library for connecting. I use the following to find out which port and protocol the AB Shutter 3 uses (where target_device_address is the AB Shutter 3's device address):

            ...

            ANSWER

            Answered 2021-Feb-26 at 07:23

            My recommendation would be not to use hcitool as it was deprecated back in 2017.

            I prefer to use the BlueZ D-Bus API directly which is documented at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt

            This can be accessed in Python using the pydbus library

            I am going to assume your Bluetooth adapter is on hci0 on the Jetson but you can check this with:

            Source https://stackoverflow.com/questions/66379600

            QUESTION

            How to recieve data from BT module (HC-05) by using python on Windows 10?
            Asked 2020-Oct-01 at 14:51

            I am trying to receive GPS data from my HC-05 bluetooth module. I can see complete data in any serial plotter program, however I need to use Python executable for my Raspberry PI.

            I have tried below code that I found from internet;

            ...

            ANSWER

            Answered 2020-Oct-01 at 14:51

            I've figured out recieving data importing "serial" package instead of "bluetooth" of pybluez. Source code is below, all you need to do is to find the serial port adress of your socket and setting baudrate, timeout, parity and stopbits parameters according to the bluetooth module you have!

            Source https://stackoverflow.com/questions/64027005

            QUESTION

            How do you connect a react native app and raspberry pi via bluetooth?
            Asked 2020-Aug-17 at 09:45

            I have a device I'm making and its powered by the Raspberry Pi 3 B, and to access/control this device will be an app I'm developing using React Native.

            1. The phone and RPi both have bluetooth turned on
            2. The phone connects to the RPi's bluetooth signal
            3. The user then starts up the app, and is able to send a command through to the app via bluetooth
            4. RPi is able to read the data, and carry out the command.

            That is the jist of it. From my understanding I will need to create a python program of some sort to deal with the incoming data. My problem is how do I even access that data? How does my python program understand that a connection has been made, and that it is going to receive information(in this case a .txt file)

            I've seen some documentation about PyBluez, but i'm not entirely sure if thats how I want to go about doing it. Maybe that is the solution and I'm not understanding it correctly.

            Sorry if this was too long, any advice will be greatly appreciated.

            ...

            ANSWER

            Answered 2020-Aug-17 at 07:41

            I am going to assume you are using a Serial Port Profile (SPP) which is sometimes called RFCOMM. [The other option is that you are using Bluetooth Low Energy (BLE)].

            Using SPP means you need to create a server on the RPi for the app to connect to.

            Examples of how to do this are at:

            http://blog.kevindoran.co/bluetooth-programming-with-python-3/

            https://bluedot.readthedocs.io/en/latest/btcommapi.html#bluetoothserver

            These two examples take slightly different approaches to achieve the same thing. Pick whichever one feels more natural to you.

            To test you have the server running correctly on the RPi, you can use a generic app on the phone. For example, the Serial Bluetooth Terminal https://play.google.com/store/apps/details?id=de.kai_morich.serial_bluetooth_terminal&hl=en_GB

            Source https://stackoverflow.com/questions/63445870

            QUESTION

            How to create for Dbus Mainloop for two separate Dbus Python programs
            Asked 2020-Jul-29 at 19:45

            I have a python processes that monitor and interact with a Dbus service (NetworkManager)

            Currently this runs in it's own thread from the main program

            ...

            ANSWER

            Answered 2020-Jul-29 at 19:45

            I created my new class which uses Dbus and is a separate thread the same way I created my first class. Then from my main routine I called the class constructor and start each thread.

            Source https://stackoverflow.com/questions/63006764

            QUESTION

            how do i broadcast Bluetooth inquiry with python sockets AF_bluetooth socket?
            Asked 2020-Jul-09 at 20:42

            Well at the moment I try to learn more about Bluetooth, I've realized that to connect I need to send a packet to the device called inquiry packet. However for my script I'm more interested in broadcasting it, and even though pybluez provides the high level functions for it. I want to do it with sockets as part of learning experience. Can anyone please tell me, how to specify I want to send the inquiry packet? through the sockets like so s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) and how do I broadcast it, instead of sending to one adress?

            ...

            ANSWER

            Answered 2020-Jul-09 at 20:42

            Are you asking to create a Serial Port Profile (SPP) socket server?

            Any example of that is below.

            I have used the pydbus library to get the Bluetooth adapter address but you could just hardcode the mac address if you preferred:

            Source https://stackoverflow.com/questions/62652901

            QUESTION

            ModuleNotFoundError though Python module PyBluez is installed
            Asked 2020-Jul-08 at 14:50

            I am using python3 with the Thonny IDE. My programms are running on a Raspberry Pi 4B.

            I tried to install PyBluez on different ways, with pip and with the build-in package installer of Thonny. Every time the installation seemed to work. When I than tried to import the module via import PyBluez I always get this error message:

            ...

            ANSWER

            Answered 2020-Jul-08 at 14:50

            I haven't personally worked with that module, but after looking at the GitHub documentation, I can see that the import statement that is used is import bluetooth. For example, on this page that's what they have

            Source https://stackoverflow.com/questions/62797397

            QUESTION

            Unable to install `gattlib`
            Asked 2020-Mar-21 at 15:20

            I am trying to install gattlib in Python in order to use some of its Bluetooth-tools.

            The OS is ubuntu 18.04.4 LTS.

            I have by now tried the following (as e.g. here):

            ...

            ANSWER

            Answered 2020-Feb-10 at 15:07

            You need to install python-dev that contains the header files for the Python C API. The following should do the trick (make sure to replace X with your Python version):

            Source https://stackoverflow.com/questions/60152996

            QUESTION

            Broken Pipe During BLE Scan (RPi, Python 3.7)
            Asked 2020-Jan-07 at 03:21

            I've got some Python 3.7 BLE scanning code which typically runs fantastic on a RPi3 device in production. However, recently I've seen devices* introduced into the environment that will crash the BLE Scanner in ways that I don't know how to prevent/detect.

            *Note: A Windows 10 Lenovo laptop with Bluetooth chip Qualcomm Atheros QCA61x4 Bluetooth 4.1 can bring this code to its knees. I've also heard that folks running the above next to a BLE Beacon site also crash frequently.

            The crash occurs during the pkt = my_sock.recv(255) command and the exception is a _bluetooth.error (32, 'Broken Pipe')

            Here is a minimal code example below that demonstrates the problem:

            ...

            ANSWER

            Answered 2020-Jan-07 at 03:21

            So, as it turns out, the broken pipe really does in-fact mean broken pipe... imagine that.

            I wired up the project to a RPi4 and was able to see the code processing Bluetooth messages fast enough to keep up. As I had supposed in the original question, the RPi3 code was not keeping up with the rate that the Bluetooth chip was receiving messages and at some point, some sort of buffer/pipe/queue filled up and the Bluetooth (Bluez, probably) broke the pipe.

            Source https://stackoverflow.com/questions/59515380

            QUESTION

            Python Bluetooth how to send a file to a phone
            Asked 2019-Dec-11 at 08:33

            in my current project it is a requirement to send a file from a windows computer to an android device over bluetooth without anything on the phone other than it's standard state and of course a paired bluetooth connection. i've looked over pybluez and it seemed simple enough to send files between a client and server architecture (and in fact got it sending between my laptop and desktop rather quickly) but I cannot for the life of me find any way to get python to send a file from the computer to android once the connection is established; my attempts have been grabbing the bluetooth mac address like thing from the device like so

            ...

            ANSWER

            Answered 2017-Feb-22 at 01:50

            I haven't personally explored it but check out this blog -

            http://recolog.blogspot.com/2013/07/transferring-files-via-bluetooth-using.html

            The author uses the lightblue package as an API for the Obex protocol and send files over the connection. Now the lightblue package appears to be unmaintained. There are other packages like PyObex (which I could not import for whatever reason) which you could also explore as alternatives but lightblue seems to be the way to go.

            Source https://stackoverflow.com/questions/42264298

            QUESTION

            PyBluez over HCI working oddly on Raspberry Pi Compute Module with ESP32
            Asked 2019-Sep-11 at 02:20

            I'm using a Raspberry PI compute module 3 in a custom motherboard connected to an ESP32 using HCI over UART to connect to a mobile phone over bluetooth. It partially works: The phone is able to pair with the device, the device can see the phone in the bluetoothctl UI, SDPtool can see the services (RFCOMM) exposed by the device.

            However, when I use pybluez, certain functionality does not work: First I tried using the device as the bluetooth slave. This is my preferred configuration. btmon showed the phone trying to connect, but pybluez never gets past sock.accept(). The code is pretty much exactly what you see in the example on pybluez github, and I've used the same code successfully with a stock Raspberry Pi Zero W (with the integrated bluetooth) successfully.

            The phone shows the following error in the socket.connect() command: W/System.err: java.io.IOException: read failed, socket might closed or timeout, read ret: -1 W/System.err: at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:698) W/System.err: at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:710) W/System.err: at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:387)

            Hard to find anything of value in the Pi device's logs, but I did see this in btmon:

            ACL Data RX: Handle 128 flags 0x02 dlen 14 [hci0] 75.711662 L2CAP: Command Reject (0x01) ident 5 len 6 Reason: Invalid CID in request (0x0002) Destination CID: 0 Source CID: 0

            I also tried using the Android hack for connecting directly using a channel ID rather than a UUID (essentially skipping the SDP lookup) - I got the channel ID using sdptool browse local, and this resulted in the same error.

            After exhaustively trying different things I switched gears to trying to use the phone as the bluetooth slave instead of the device. Here I see more success, but still things aren't working as expected: discover_devices from pybluez doesn't report any devices, although the phone and bluetoothctl both show the devices as paired. However, if I hardcode in the device address I see in bluetoothctl, I am actually able to connect.

            I'm convinced that something is screwed up with the bluetooth configuration, perhaps the versions of bluez or pybluez, but I can't find anyone else who has reported these sorts of issues. I'd note that I'm using the compatibility mode switch on the bluetoothd service (otherwise it doesn't work at all). Bluez version is 5.43 I believe.

            Has anyone seen anything like this? Any suggestions for troubleshooting these issues (different versions of bluez, etc)?

            ...

            ANSWER

            Answered 2019-Sep-11 at 02:20

            I ultimately did solve this, but I'm not sure which change did it:

            1. I reduced the baud rate to 115200.
            2. I switched it to classic bluetooth in the firmware flash.
            3. I disabled bluetooth sleep.

            One of these three changes must have done the trick

            Source https://stackoverflow.com/questions/57524829

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pybluez

            Please refer to the [installation instructions](/docs/install.rst).

            Support

            | Linux | Raspberry Pi | macOS | Windows | |:------:|:------------:|:-----:|:-------:| | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/pybluez/pybluez.git

          • CLI

            gh repo clone pybluez/pybluez

          • sshUrl

            git@github.com:pybluez/pybluez.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link