Skip to content

Commit a992fd0

Browse files
authored
Merge pull request #4 from kattni/rename
Rename to Adafruit CircuitPython BLE Radio
2 parents 5f9caf4 + 810fec3 commit a992fd0

File tree

11 files changed

+32
-31
lines changed

11 files changed

+32
-31
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ install:
4242
- pip install --force-reinstall pylint==1.9.2
4343

4444
script:
45-
- pylint adafruit_radio.py
45+
- pylint adafruit_ble_radio.py
4646
- ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace examples/*.py)
47-
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-radio --library_location .
47+
- circuitpython-build-bundles --filename_prefix adafruit-circuitpython-ble-radio --library_location .
4848
- cd docs && sphinx-build -E -W -b html . _build/html && cd ..

README.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Introduction
99
:target: https://discord.gg/nBQh6qu
1010
:alt: Discord
1111

12-
.. image:: https://travis-ci.com/adafruit/Adafruit_CircuitPython_radio.svg?branch=master
13-
:target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_radio
12+
.. image:: https://travis-ci.com/adafruit/Adafruit_CircuitPython_BLE_Radio.svg?branch=master
13+
:target: https://travis-ci.com/adafruit/Adafruit_CircuitPython_BLE_Radio
1414
:alt: Build Status
1515

1616
This library provides simple byte and string based inter-device communication
@@ -36,7 +36,7 @@ Usage Example
3636

3737
All the functionality is exposed via the very simple ``Radio`` class::
3838

39-
from adafruit_radio import Radio
39+
from adafruit_ble_radio import Radio
4040

4141

4242
# A radio instance listens/broadcasts on a numbered channel.
@@ -47,7 +47,7 @@ All the functionality is exposed via the very simple ``Radio`` class::
4747

4848
# Broadcast a simple string message.
4949
r.send("Hello")
50-
50+
5151
# Broadcast raw bytes.
5252
r.send_bytes(b"Hello")
5353

@@ -77,13 +77,13 @@ installed (``pip install pytest pytest-coverage``).
7777

7878
Run the unit tests with the following command::
7979

80-
$ pytest --cov-report term-missing --cov=adafruit_radio tests/
80+
$ pytest --cov-report term-missing --cov=adafruit_ble_radio tests/
8181

8282
Contributing
8383
============
8484

8585
Contributions are welcome! Please read our `Code of Conduct
86-
<https://github.com/adafruit/Adafruit_CircuitPython_radio/blob/master/CODE_OF_CONDUCT.md>`_
86+
<https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/blob/master/CODE_OF_CONDUCT.md>`_
8787
before contributing to help this project stay welcoming.
8888

8989
Documentation

adafruit_radio.py renamed to adafruit_ble_radio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`adafruit_radio`
23+
`adafruit_ble_radio`
2424
================================================================================
2525
2626
Simple byte and string based inter-device communication via BLE.
@@ -48,7 +48,7 @@
4848

4949

5050
__version__ = "0.0.0-auto.0"
51-
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_radio.git"
51+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio.git"
5252

5353

5454
#: Maximum length of a message (in bytes).

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
55
.. use this format as the module name: "adafruit_foo.foo"
66
7-
.. automodule:: adafruit_radio
7+
.. automodule:: adafruit_ble_radio
88
:members:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
master_doc = "index"
3939

4040
# General information about the project.
41-
project = "Adafruit radio Library"
41+
project = "Adafruit BLE Radio Library"
4242
copyright = "2019 Nicholas H.Tollervey"
4343
author = "Nicholas H.Tollervey"
4444

docs/examples.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ Simple test
33

44
Ensure your device works with this simple test.
55

6-
.. literalinclude:: ../examples/radio_simpletest.py
7-
:caption: examples/radio_simpletest.py
6+
.. literalinclude:: ../examples/ble_radio_simpletest.py
7+
:caption: examples/ble_radio_simpletest.py
88
:linenos:

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Table of Contents
2929
.. toctree::
3030
:caption: Other Links
3131

32-
Download <https://github.com/adafruit/adafruit_CircuitPython_radio/releases/latest>
32+
Download <https://github.com/adafruit/adafruit_CircuitPython_BLE_Radio/releases/latest>
3333
CircuitPython Reference Documentation <https://circuitpython.readthedocs.io>
3434
CircuitPython Support Forum <https://forums.adafruit.com/viewforum.php?f=60>
3535
Discord Chat <https://adafru.it/discord>

examples/radio_simpletest.py renamed to examples/ble_radio_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66
import digitalio
77
import board
8-
from adafruit_radio import Radio
8+
from adafruit_ble_radio import Radio
99

1010

1111
slide_switch = digitalio.DigitalInOut(board.SLIDE_SWITCH)

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
adafruit-circuitpython-ble
2+
Adafruit-Blinka

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
long_description = f.read()
1919

2020
setup(
21-
name="adafruit-circuitpython-radio",
21+
name="adafruit-circuitpython-ble-radio",
2222
use_scm_version=True,
2323
setup_requires=["setuptools_scm"],
2424
description="Simple byte and string based inter-device communication via BLE.",
2525
long_description=long_description,
2626
long_description_content_type="text/x-rst",
2727
# The project's main homepage.
28-
url="https://github.com/adafruit/Adafruit_CircuitPython_radio",
28+
url="https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio",
2929
# Author details
3030
author="Adafruit Industries",
3131
author_email="[email protected]",
@@ -49,5 +49,5 @@
4949
# simple. Or you can use find_packages().
5050
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
5151
# CHANGE `py_modules=['...']` TO `packages=['...']`
52-
py_modules=["adafruit_radio"],
52+
py_modules=["adafruit_ble_radio"],
5353
)

tests/test_adafruit_radio.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
2-
Simple unit tests for the adafruit_radio module. Uses experimental mocking
2+
Simple unit tests for the adafruit_ble_radio module. Uses experimental mocking
33
found in the testconf.py file. See comments therein for explanation of how it
44
works.
55
"""
6-
import adafruit_radio
6+
import adafruit_ble_radio
77
import pytest
88
import struct
99
import time
@@ -15,7 +15,7 @@ def radio():
1515
"""
1616
A fixture to recreate a new Radio instance for each test that needs it.
1717
"""
18-
return adafruit_radio.Radio()
18+
return adafruit_ble_radio.Radio()
1919

2020

2121
def test_radio_init_default():
@@ -27,8 +27,8 @@ def test_radio_init_default():
2727
* The self.msg_pool is initialised as an empty set.
2828
* The channel is set to the default 42.
2929
"""
30-
r = adafruit_radio.Radio()
31-
assert r.ble == adafruit_radio.BLERadio()
30+
r = adafruit_ble_radio.Radio()
31+
assert r.ble == adafruit_ble_radio.BLERadio()
3232
assert r.uid == 0
3333
assert r.msg_pool == set()
3434
assert r._channel == 42
@@ -38,7 +38,7 @@ def test_radio_init_channel():
3838
"""
3939
If a channel argument is passed to initialisation, this is correctly set.
4040
"""
41-
r = adafruit_radio.Radio(channel=7)
41+
r = adafruit_ble_radio.Radio(channel=7)
4242
assert r._channel == 7
4343

4444

@@ -83,7 +83,7 @@ def test_radio_send_bytes_too_long(radio):
8383
A ValueError is raised if the message to be sent is too long (defined by
8484
MAX_LENGTH).
8585
"""
86-
msg = bytes(adafruit_radio.MAX_LENGTH + 1)
86+
msg = bytes(adafruit_ble_radio.MAX_LENGTH + 1)
8787
with pytest.raises(ValueError):
8888
radio.send_bytes(msg)
8989

@@ -95,10 +95,10 @@ def test_radio_send_bytes(radio):
9595
"""
9696
radio.uid = 255 # set up for cycle back to 0.
9797
msg = b"Hello"
98-
with mock.patch("adafruit_radio.time.sleep") as mock_sleep:
98+
with mock.patch("adafruit_ble_radio.time.sleep") as mock_sleep:
9999
radio.send_bytes(msg)
100-
mock_sleep.assert_called_once_with(adafruit_radio.AD_DURATION)
101-
spy_advertisement = adafruit_radio.AdafruitRadio()
100+
mock_sleep.assert_called_once_with(adafruit_ble_radio.AD_DURATION)
101+
spy_advertisement = adafruit_ble_radio.AdafruitRadio()
102102
chan = struct.pack("<B", radio._channel)
103103
uid = struct.pack("<B", 255)
104104
assert spy_advertisement.msg == chan + uid + msg
@@ -136,7 +136,7 @@ def test_radio_receive_full_no_messages(radio):
136136
radio.ble.start_scan.return_value = []
137137
assert radio.receive_full() is None
138138
radio.ble.start_scan.assert_called_once_with(
139-
adafruit_radio.AdafruitRadio, minimum_rssi=-255, timeout=1, extended=True
139+
adafruit_ble_radio.AdafruitRadio, minimum_rssi=-255, timeout=1, extended=True
140140
)
141141
radio.ble.stop_scan.assert_called_once_with()
142142

@@ -169,7 +169,7 @@ def test_radio_receive_full_and_remove_expired_message_metadata(radio):
169169
mock_entry.address.address_bytes = b"adr2"
170170
mock_entry.rssi = -40
171171
radio.ble.start_scan.return_value = [mock_entry]
172-
radio.msg_pool.add((time.monotonic() - adafruit_radio.AD_DURATION - 1, 42, 0, b"addr"))
172+
radio.msg_pool.add((time.monotonic() - adafruit_ble_radio.AD_DURATION - 1, 42, 0, b"addr"))
173173
result = radio.receive_full()
174174
assert result[0] == b"Hello"
175175
assert result[1] == -40

0 commit comments

Comments
 (0)