{ "info": { "author": "Chris Peplin , Vernier Software and Technology", "author_email": "info@vernier.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "pygatt - Python Module for Bluetooth LE Generic Attribute Profile (GATT).\n=========================================================================\n\nThis Module allows reading and writing to GATT descriptors on devices\nsuch as fitness trackers, sensors, and anything implementing standard\nGATT Descriptor behavior.\n\npygatt provides a Pythonic API by wrapping two different backends:\n\n- BlueZ (requires Linux), using the ``gatttool`` command-line utility.\n- Bluegiga's BGAPI, compatible with USB adapters like the BLED112.\n\nMotivation\n----------\n\nDespite the popularity of BLE, we have yet to find a good programming\ninterface for it on desktop computers. Since most peripherals are\ndesigned to work with smartphones, this space is neglected. One\ninteractive interface, BlueZ's ``gatttool``, is functional but difficult\nto use programatically. BlueZ itself obviously works, but the interface\nleaves something to be desired and only works in Linux.\n\nRequirements\n------------\n\n- Python 2.7.5 or greater, or Python 3.5 or greater\n\n - Python 2.7.3's ``struct`` library has a bug that will break PyGATT - 2.7.5\n or greater is recommended.\n\n- BlueZ 5.18 or greater (with gatttool) - required for the gatttool\n backend only.\n\n - Tested on 5.18, 5.21, 5.35 and 5.43\n\n- GATTToolBackend requires Linux (i.e. not Windows compatible)\n\nInstallation\n------------\n\nInstall ``pygatt`` with pip from PyPI:\n\n::\n\n $ pip install pygatt\n\nThe BlueZ backend is not supported by default as it requires\n``pexpect``, which can only be installed in a UNIX-based environment. If\nyou wish to use that backend, install the optional dependencies with:\n\n::\n\n $ pip install \"pygatt[GATTTOOL]\"\n\nInstall the latest development version of ``pygatt`` with pip:\n\n::\n\n $ pip install git+https://github.com/peplin/pygatt\n\nExample Use\n-----------\n\nThe primary API for users of this library is provided by\n``pygatt.BLEBackend`` and ``pygatt.BLEDevice``. After initializing an\ninstance of the preferred backend (available implementations are found\nin ``pygatt.backends``, use the ``BLEBackend.connect`` method to connect\nto a device and get an instance of ``BLEDevice.``\n\n.. code:: python\n\n import pygatt\n\n # The BGAPI backend will attemt to auto-discover the serial device name of the\n # attached BGAPI-compatible USB adapter.\n adapter = pygatt.BGAPIBackend()\n\n try:\n adapter.start()\n device = adapter.connect('01:23:45:67:89:ab')\n value = device.char_read(\"a1e8f5b1-696b-4e4c-87c6-69dfe0b0093b\")\n finally:\n adapter.stop()\n\nNote that not all backends support connecting to more than 1 device at\nat time, so calling ``BLEBackend.connect`` again may terminate existing\nconnections.\n\nHere's the same example using the GATTTool backend. It's identical\nexcept for the initialization of the backend:\n\n.. code:: python\n\n import pygatt\n\n adapter = pygatt.GATTToolBackend()\n\n try:\n adapter.start()\n device = adapter.connect('01:23:45:67:89:ab')\n value = device.char_read(\"a1e8f5b1-696b-4e4c-87c6-69dfe0b0093b\")\n finally:\n adapter.stop()\n\nNotifications Example\n---------------------\n\nThis example uses the gatttool backend to connect to a device with a specific\nMAC address, subscribes for notifications on a characteristic, and prints the\ndata returned in each notification.\n\n.. code:: python\n\n import pygatt\n from binascii import hexlify\n\n adapter = pygatt.GATTToolBackend()\n\n def handle_data(handle, value):\n \"\"\"\n handle -- integer, characteristic read handle the data was received on\n value -- bytearray, the data returned in the notification\n \"\"\"\n print(\"Received data: %s\" % hexlify(value))\n\n try:\n adapter.start()\n device = adapter.connect('01:23:45:67:89:ab')\n\n device.subscribe(\"a1e8f5b1-696b-4e4c-87c6-69dfe0b0093b\",\n callback=handle_data)\n finally:\n adapter.stop()\n\nDebugging\n---------\n\nWhile debugging software using pygatt, it is often useful to see what's\nhappening inside the library. You can enable debugging logging and have\nit printed to your terminal with this code:\n\n::\n\n import pygatt\n import logging\n\n logging.basicConfig()\n logging.getLogger('pygatt').setLevel(logging.DEBUG)\n\nCan't find BGAPI device in Windows\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou may need to explicitly specify the COM port of your BGAPI-compatible\ndevice in windows, e.g.:\n\n::\n\n adapter = pygatt.BGAPIBackend(serial_port='COM9')\n\nIf you provide the COM port name, but still get an error such as\n``WindowsError(2, 'The system cannot find the file specified.')``, try\nchanging the COM port of the device to a value under 10, e.g. ``COM9``.\n\nAuthors\n-------\n\n- Jeff Rowberg @jrowberg https://github.com/jrowberg/bglib\n- Greg Albrecht @ampledata https://github.com/ampledata/pygatt\n- Christopher Peplin @peplin https://github.com/peplin/pygatt\n- Morten Kjaergaard @mkjaergaard https://github.com/mkjaergaard/pygatt\n- Michael Saunby @msaunby https://github.com/msaunby/ble-sensor-pi\n- Steven Sloboda https://github.com/sloboste\n- Ilya Sukhanov @IlyaSukhanov\n- @dcliftreaves\n- Jonathan Dan\n- Ilann Adjedj\n- Ralph Hempel\n- Rene Jacobsen\n- Marcus Georgi\n- Alexandre Barachant\n- Michel Rivas Hernandez\n- Jean Regisser\n- David Martin\n- Pieter Hooimeijer\n\nReleasing to PyPI\n-----------------\n\nFor the maintainers of the project, when you want to make a release:\n\n- Merge all of the changes into ``master``.\n- Update the version in ``setup.py``.\n- Update the ``CHANGELOG.mkd``\n- Tag the commit and push to GitHub (will need to push to a separate\n branch of PR first since ``master`` is a protected branch).\n- Travis CI will take care of the rest - it will build and deploy\n tagged commits to PyPI automatically.\n\nLicense\n-------\n\nCopyright 2015 Stratos Inc. and Orion Labs\n\nApache License, Version 2.0 and MIT License. See LICENSE.\n\n\n.. :changelog:\n\nRelease History\n================\n\nV3.2.0\n------\n\n- Fix: Reliably auto-reconnect after restarting BGAPI device. Fixes a bug in\n first attempt at auto-reconnection, only worked in some environments. (#144)\n- Fix: Remove spurious \"no handler for logger\" warnings (#143)\n- Fix: Use enum-compat instead of enum34, to fix installation in Python 3.4+\n- Feature: Limit search window size for GATTTool backend, to avoid high CPU\n usage for long running connections. (#123)\n- Feature: Add support for write commands to BGAPIBackend (#115)\n\nV3.1.1\n------\n\n- Improvement: Convert documentation to RST for better PyPI integration.\n\nV3.1.0\n------\n\n- Fix: Support platforms without ``termios`` (Windows)\n- Feature: Add ``char_read_handle`` to GATTTool backend.\n- Improvement: Warn if ``hcitool`` requires a sudo authentication.\n- Improvement: Allow BGAPI device more time to reboot for more reliable\n discovery.\n- Improvement: Interpret \"invalid file descriptor\" as a disconnect\n event.\n- Fix: Correctly handle service class UUIDs that aren't 16 bytes.\n- Improvement: Support BLE devices with any UTF8 character.\n- Improvement: Make gatttol prompt timeout configurable.\n- Improvement: Gracefully stop ``lescan`` to avoid leaving the adapter\n in a bad state.\n- Improvement: Allow custom timeout for discovery on GATTTool backend.\n- Fix: Make sure responses to char reads on BGAPI backend are from the\n requested handle.\n- Improvement: Raise and exception if trying to instantiate the\n GATTTool backend in Windows.\n- Improvement: If no BGAPI device attached, abort immediately.\n- Fix: Use user's configured HCI device for connection and scanning in\n GATTTool backend.\n\nV3.0.0\n------\n\n- [API Change] The BGAPIBackend.connect method now takes the same\n ``address_type`` argument as the GATTTool backend [BGAPI].\n- [API Change] The ``address_type`` argument on both backends now\n requires a value from a new enum, ``pygatt.BLEAddressType``, instead\n of a string.\n- Made Python 3 support a priority for both GATTTOOL and BGAPI\n backends.\n- Improve reliability of BGAPI backend by re-setting device for each\n connection.\n\nV2.1.0\n------\n\n- Added all standard GATT characteristics. [BGAPI]\n- Move gatttool monitor to a background thread for increased\n performance. [GATTTOOL]\n\nV2.0.1\n------\n\n- Feature: Allow unsubscribing from notifications.\n- Improvement: Allow more time to discover characteristics. [GATTTOOL]\n- Improvement: Allow using gatttol backend without root. [GATTTOOL]\n- Improvement: Standardize type of UUID so comparison always works (str\n vs unicode)\n- Fix: Fix packaging so the version on PyPI can be installed.\n- Fix: Fix Python 3 compatibility.\n\nThanks to Ilya Sukhanov and Alexey Roslyakov for the changes in this\nrelease!\n\nv2.0.0\n------\n\n- New API with support for multiple BLE adapters.\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/VernierST/pygatt", "keywords": "", "license": "Apache 2.0 and MIT", "maintainer": "", "maintainer_email": "", "name": "vernierpygatt", "package_url": "https://pypi.org/project/vernierpygatt/", "platform": "", "project_url": "https://pypi.org/project/vernierpygatt/", "project_urls": { "Homepage": "https://github.com/VernierST/pygatt" }, "release_url": "https://pypi.org/project/vernierpygatt/3.2.0/", "requires_dist": [ "pyserial", "enum-compat", "pexpect; extra == 'gatttool'" ], "requires_python": "", "summary": "Python Bluetooth LE (Low Energy) and GATT Library", "version": "3.2.0" }, "last_serial": 4396003, "releases": { "3.2.0": [ { "comment_text": "", "digests": { "md5": "4b97df34ac17d745afa6cf7298ee9811", "sha256": "e2120704ef0cee20761d5ce5fab310fa76e824e931894696a3791367e5bba832" }, "downloads": -1, "filename": "vernierpygatt-3.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4b97df34ac17d745afa6cf7298ee9811", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 41738, "upload_time": "2018-10-10T01:53:01", "url": "https://files.pythonhosted.org/packages/1e/0a/c7bc72fcf8a7cc22f9bdc5c2daae5b29660ccf1bdf1a1db3b542bc14cf7e/vernierpygatt-3.2.0-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4b97df34ac17d745afa6cf7298ee9811", "sha256": "e2120704ef0cee20761d5ce5fab310fa76e824e931894696a3791367e5bba832" }, "downloads": -1, "filename": "vernierpygatt-3.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4b97df34ac17d745afa6cf7298ee9811", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 41738, "upload_time": "2018-10-10T01:53:01", "url": "https://files.pythonhosted.org/packages/1e/0a/c7bc72fcf8a7cc22f9bdc5c2daae5b29660ccf1bdf1a1db3b542bc14cf7e/vernierpygatt-3.2.0-py3-none-any.whl" } ] }