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": null,
"name": "adafruit-circuitpython-ble-radio",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "adafruit, blinka, circuitpython, micropython, radio, ble",
"author": null,
"author_email": "Adafruit Industries <circuitpython@adafruit.com>",
"download_url": "https://files.pythonhosted.org/packages/2c/79/9c75e1966df83510fa0be557b76b756a181498cef5af7675db529ecb43e8/adafruit_circuitpython_ble_radio-0.5.12.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.12",
"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": "62658062558a04c6e7648e13714cf1b8817499c0e47f20951e2cd02a842391c9",
"md5": "b9c071042c73bdf931cc2e46ec396486",
"sha256": "051eb478a738491266377010248c02398e03bd3451c201c846dbfe8260ddf31a"
},
"downloads": -1,
"filename": "adafruit_circuitpython_ble_radio-0.5.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b9c071042c73bdf931cc2e46ec396486",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6559,
"upload_time": "2025-01-16T19:27:30",
"upload_time_iso_8601": "2025-01-16T19:27:30.736856Z",
"url": "https://files.pythonhosted.org/packages/62/65/8062558a04c6e7648e13714cf1b8817499c0e47f20951e2cd02a842391c9/adafruit_circuitpython_ble_radio-0.5.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2c799c75e1966df83510fa0be557b76b756a181498cef5af7675db529ecb43e8",
"md5": "d74ca9c89a42764082277f4aa7a61b0a",
"sha256": "451548ac141de52d02d2b68a7573c03ad42e0dbd6c516e0e6791a0f1da21d24e"
},
"downloads": -1,
"filename": "adafruit_circuitpython_ble_radio-0.5.12.tar.gz",
"has_sig": false,
"md5_digest": "d74ca9c89a42764082277f4aa7a61b0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30221,
"upload_time": "2025-01-16T19:27:32",
"upload_time_iso_8601": "2025-01-16T19:27:32.202024Z",
"url": "https://files.pythonhosted.org/packages/2c/79/9c75e1966df83510fa0be557b76b756a181498cef5af7675db529ecb43e8/adafruit_circuitpython_ble_radio-0.5.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-16 19:27:32",
"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"
}