{ "info": { "author": "Matthew Else", "author_email": "matthew.else@arm.com", "bugtrack_url": null, "classifiers": [], "description": "# bleep\n\nA BLE abstraction layer for Python inspired by [bleat](https://github.com/thegecko/bleat). Currently only supports Linux, with experimental support for Mac OS X.\n\n## Current Support\n\n* Discovering devices\n* Reading advertising data\n* Connecting to devices\n* Discovering services, characteristics and descriptors\n* Read from characteristics\n\n## Installation\n\n### Linux\n\nFirst, install my fork of pygattlib and its dependencies:\n\n```bash\nsudo apt-get install libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev python-dev\n```\n\nYou should also make sure that your version of libbluetooth is at least 4.101:\n\n```bash\napt-cache policy libbluetooth-dev | grep Installed\n```\n\nThen, clone the repository, and install the python package.\n\n```bash\ngit clone https://github.com/matthewelse/pygattlib.git\ncd pygattlib\nsudo python setup.py install\n```\n\nThis will build the dynamic library, and install the python package.\n\nYou can then install bleep easily:\n\n```bash\nsudo pip install bleep\n```\n\nIf you want to develop bleep, instead of the last line, run:\n\n```\nsudo python setup.py develop\n```\n\nThis will cause any changes you make to bleep to be reflected when you import the library.\n\n> NOTE: You may need to run all BLE code with `sudo`, even when using the Python interactive shell.\n\n### Mac OS X\n\nInstallation on Mac OS X is very simple:\n\n```bash\ngit clone https://github.com/matthewelse/bleep.git\ncd bleep\nsudo python setup.py install\n```\n\nLikewise, if you would like to develop bleep, run this instead of the last line:\n\n```bash\nsudo python setup.py develop\n```\n\n## Examples\n\n### tree.py\n\nYou can run tree.py to see all of the services, characteristics and descriptors attached to a device with a specific mac address. In order to find the device's mac address, you could use `hcitool lescan`, or use `BLEDevice.discoverDevices()`.\n\n```\nusage: tree.py [-h] mac\n```\n\n## Usage\n\n### Include bleep\n\n```python\n>>> from bleep import BLEDevice\n```\n\n### Scan for devices\n\n```python\n>>> devices = BLEDevice.discoverDevices()\n>>> devices\n[Device Name: (5A:79:8E:91:83:1C), Device Name: (C1:20:68:1B:00:26), Device Name: BLE Keyboard (C9:E8:56:3B:4D:B1), Device Name: (4C:25:F5:C2:E6:61), Device Name: (60:03:08:B2:47:F1), Device Name: (C1:62:3A:1D:00:14)]\n```\n\nThis will return a list of Device objects, however you won't be connected to any of them, so pick one you like, and connect to it:\n\n```python\n>>> device = devices[2]\n>>> device.connect()\n```\n\nYou can then access the device's services:\n\n```python\n>>> device.services\n[Generic Access, Generic Attribute, Device Information, Battery Service, Human Interface Device]\n```\n\neach service's characteristics\n\n```python\n>>> service = device.services[4]\n>>> service\nHuman Interface Device\n>>> service.characteristics\n[HID Information, Report Map, Protocol Mode, HID Control Point, Report, Report]\n```\n\nand each characteristic's descriptors\n\n```python\n>>> char = service.characteristics[4]\n>>> char\nReport\n>>> char.descriptors\n[Client Characteristic Configuration, Report Reference]\n```\n\n### Useful Functionality\n\n`BLEDevice.discoverDevices` supports parameters which allow you to specify which BLE device to connect to (ignored on OSes other than Linux), how long to sample for, as well as a function which returns a boolean value, allowing you to cherry-pick your devices.\n\n```python\ndef discoverDevices(device='hci0', timeout=5, filter=lambda x: True)\n```", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/matthewelse/bleep", "keywords": "ble", "license": "Apache-2.0", "maintainer": null, "maintainer_email": null, "name": "bleep", "package_url": "https://pypi.org/project/bleep/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/bleep/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/matthewelse/bleep" }, "release_url": "https://pypi.org/project/bleep/0.4.3/", "requires_dist": null, "requires_python": null, "summary": "Bluetooth Low Energy (BLE) Library for Python", "version": "0.4.3" }, "last_serial": 1718949, "releases": { "0.4.2": [], "0.4.3": [ { "comment_text": "", "digests": { "md5": "37165383dfbb187075f9505612522fdc", "sha256": "ba7fb9ae9a4c67bfaff51a3a830c1c6d8663b3688734c9ddea0f2c1c25bdb598" }, "downloads": -1, "filename": "bleep-0.4.3.tar.gz", "has_sig": false, "md5_digest": "37165383dfbb187075f9505612522fdc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18725, "upload_time": "2015-09-11T14:24:04", "url": "https://files.pythonhosted.org/packages/99/b1/fdd864c4ca3b3962eb3f1eabe420ad2128c7615f1096fa097a9fbf4c3491/bleep-0.4.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "37165383dfbb187075f9505612522fdc", "sha256": "ba7fb9ae9a4c67bfaff51a3a830c1c6d8663b3688734c9ddea0f2c1c25bdb598" }, "downloads": -1, "filename": "bleep-0.4.3.tar.gz", "has_sig": false, "md5_digest": "37165383dfbb187075f9505612522fdc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18725, "upload_time": "2015-09-11T14:24:04", "url": "https://files.pythonhosted.org/packages/99/b1/fdd864c4ca3b3962eb3f1eabe420ad2128c7615f1096fa097a9fbf4c3491/bleep-0.4.3.tar.gz" } ] }