Introduction
============
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ble-radio/badge/?version=latest
:target: https://docs.circuitpython.org/projects/ble_radio/en/latest/
:alt: Documentation Status
.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg
:target: https://adafru.it/discord
:alt: Discord
.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/workflows/Build%20CI/badge.svg
:target: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/actions
:alt: Build Status
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code Style: Black
This library provides simple byte and string based inter-device communication
via BLE.
It works like a walkie-talkie: configure your device to use a certain channel
(numbered 0-255, default being 42) and it will broadcast on that channel and
receive any messages from other devices using that channel.
Dependencies
=============
This library depends on:
* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.
Usage Example
=============
All the functionality is exposed via the very simple ``Radio`` class::
from adafruit_ble_radio import Radio
# A radio instance listens/broadcasts on a numbered channel.
r = Radio(channel=7)
# Update radio instance settings.
r.configure(channel=9)
# Broadcast a simple string message.
r.send("Hello")
# Broadcast raw bytes.
r.send_bytes(b"Hello")
# A loop to listen for incoming string based messages...
while True:
msg = r.receive()
if msg:
print(msg)
# Alternatively, to get the raw bytes and other details...
while True:
msg = r.receive_full()
if msg:
msg_bytes = msg[0]
msg_strength = msg[1]
msg_time = msg[2]
print("Recieved {} (strength {}, at time {})".format(
msg_bytes,
msg_strength,
msg_time))
Unit Tests
==========
To run the test suite you should have ``pytest`` and ``pytest-coverage``
installed (``pip install pytest pytest-coverage``).
Run the unit tests with the following command::
$ pytest --cov-report term-missing --cov=adafruit_ble_radio tests/
Documentation
=============
API documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/ble_radio/en/latest/>`_.
For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.
Contributing
============
Contributions are welcome! Please read our `Code of Conduct
<https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/blob/main/CODE_OF_CONDUCT.md>`_
before contributing to help this project stay welcoming.
Raw data
{
"_id": null,
"home_page": "",
"name": "adafruit-circuitpython-ble-radio",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "adafruit,blinka,circuitpython,micropython,radio,ble",
"author": "",
"author_email": "Adafruit Industries <circuitpython@adafruit.com>",
"download_url": "https://files.pythonhosted.org/packages/4f/e9/c9c2b9aa00daef2ab09a10b03295591154bbe1d84be6fffbc2da8928852f/adafruit-circuitpython-ble-radio-0.5.9.tar.gz",
"platform": null,
"description": "Introduction\n============\n\n.. image:: https://readthedocs.org/projects/adafruit-circuitpython-ble-radio/badge/?version=latest\n :target: https://docs.circuitpython.org/projects/ble_radio/en/latest/\n :alt: Documentation Status\n\n.. image:: https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_Bundle/main/badges/adafruit_discord.svg\n :target: https://adafru.it/discord\n :alt: Discord\n\n.. image:: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/workflows/Build%20CI/badge.svg\n :target: https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/actions\n :alt: Build Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n :alt: Code Style: Black\n\nThis library provides simple byte and string based inter-device communication\nvia BLE.\n\nIt works like a walkie-talkie: configure your device to use a certain channel\n(numbered 0-255, default being 42) and it will broadcast on that channel and\nreceive any messages from other devices using that channel.\n\nDependencies\n=============\n\nThis library depends on:\n\n* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_\n\nPlease ensure all dependencies are available on the CircuitPython filesystem.\nThis is easily achieved by downloading\n`the Adafruit library and driver bundle <https://circuitpython.org/libraries>`_.\n\nUsage Example\n=============\n\nAll the functionality is exposed via the very simple ``Radio`` class::\n\n from adafruit_ble_radio import Radio\n\n\n # A radio instance listens/broadcasts on a numbered channel.\n r = Radio(channel=7)\n\n # Update radio instance settings.\n r.configure(channel=9)\n\n # Broadcast a simple string message.\n r.send(\"Hello\")\n\n # Broadcast raw bytes.\n r.send_bytes(b\"Hello\")\n\n # A loop to listen for incoming string based messages...\n while True:\n msg = r.receive()\n if msg:\n print(msg)\n\n # Alternatively, to get the raw bytes and other details...\n while True:\n msg = r.receive_full()\n if msg:\n msg_bytes = msg[0]\n msg_strength = msg[1]\n msg_time = msg[2]\n print(\"Recieved {} (strength {}, at time {})\".format(\n msg_bytes,\n msg_strength,\n msg_time))\n\nUnit Tests\n==========\n\nTo run the test suite you should have ``pytest`` and ``pytest-coverage``\ninstalled (``pip install pytest pytest-coverage``).\n\nRun the unit tests with the following command::\n\n $ pytest --cov-report term-missing --cov=adafruit_ble_radio tests/\n\nDocumentation\n=============\n\nAPI documentation for this library can be found on `Read the Docs <https://docs.circuitpython.org/projects/ble_radio/en/latest/>`_.\n\nFor information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.\n\nContributing\n============\n\nContributions are welcome! Please read our `Code of Conduct\n<https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/blob/main/CODE_OF_CONDUCT.md>`_\nbefore contributing to help this project stay welcoming.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Simple byte and string based inter-device communication via BLE.",
"version": "0.5.9",
"project_urls": {
"Homepage": "https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio"
},
"split_keywords": [
"adafruit",
"blinka",
"circuitpython",
"micropython",
"radio",
"ble"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c87393f79aff5cf366154b3f3b6dca76bd7bd3e2b304514d7ba920c64c1fb6fa",
"md5": "6252e4f9f5c20ab1dbff07397e749dfc",
"sha256": "65128f5b4743b517ca43d57166843eea7de35cf1550691746c747f36d78f0cb5"
},
"downloads": -1,
"filename": "adafruit_circuitpython_ble_radio-0.5.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6252e4f9f5c20ab1dbff07397e749dfc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6548,
"upload_time": "2023-09-25T15:57:41",
"upload_time_iso_8601": "2023-09-25T15:57:41.815401Z",
"url": "https://files.pythonhosted.org/packages/c8/73/93f79aff5cf366154b3f3b6dca76bd7bd3e2b304514d7ba920c64c1fb6fa/adafruit_circuitpython_ble_radio-0.5.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4fe9c9c2b9aa00daef2ab09a10b03295591154bbe1d84be6fffbc2da8928852f",
"md5": "759fed3d7bc74101a9e53470aef05e0d",
"sha256": "b26d6393c7392cbcb8f3f79463395b67e6c5dd7b4747134306080596c855831e"
},
"downloads": -1,
"filename": "adafruit-circuitpython-ble-radio-0.5.9.tar.gz",
"has_sig": false,
"md5_digest": "759fed3d7bc74101a9e53470aef05e0d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30197,
"upload_time": "2023-09-25T15:57:42",
"upload_time_iso_8601": "2023-09-25T15:57:42.744375Z",
"url": "https://files.pythonhosted.org/packages/4f/e9/c9c2b9aa00daef2ab09a10b03295591154bbe1d84be6fffbc2da8928852f/adafruit-circuitpython-ble-radio-0.5.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-25 15:57:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adafruit",
"github_project": "Adafruit_CircuitPython_BLE_Radio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Adafruit-Blinka",
"specs": []
},
{
"name": "adafruit-circuitpython-ble",
"specs": []
}
],
"lcname": "adafruit-circuitpython-ble-radio"
}