Skip to content

Commit b5dc585

Browse files
committed
address comments so far; fix sphinx build
1 parent dcf76c7 commit b5dc585

File tree

8 files changed

+80
-22
lines changed

8 files changed

+80
-22
lines changed

adafruit_ble/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,12 @@ class BLEConnection:
5858
Represents a connection to a peer BLE device.
5959
It acts as a map from a `Service` type to a `Service` instance for the connection.
6060
61-
:param bleio_connection _bleio.connection
61+
:param bleio_connection _bleio.Connection
62+
Wrap the native `_bleio.Connection` object.
6263
"""
6364
def __init__(self, bleio_connection):
6465
self._bleio_connection = bleio_connection
65-
# _bleio.Service objects representing services found during discoery.
66+
# _bleio.Service objects representing services found during discovery.
6667
self._discovered_bleio_services = {}
6768
# Service objects that wrap remote services.
6869
self._constructed_services = {}
@@ -186,9 +187,10 @@ def start_scan(self, *advertisement_types, buffer_size=512, extended=False, time
186187
window must be <= interval.
187188
:param int minimum_rssi: the minimum rssi of entries to return.
188189
:param bool active: request and retrieve scan responses for scannable advertisements.
189-
:returns: iterable: If any ``advertisement_types`` are given,
190+
:return: If any ``advertisement_types`` are given,
190191
only Advertisements of those types are produced by the returned iterator.
191192
If none are given then `Advertisement` objects will be returned.
193+
:rtype: iterable
192194
"""
193195
prefixes = b""
194196
if advertisement_types:
@@ -218,8 +220,8 @@ def connect(self, advertisement, *, timeout=4):
218220
219221
:param advertisement Advertisement: An `Advertisement` or a subclass of `Advertisement`
220222
:param timeout float: how long to wait for a connection
221-
:returns the connection to the peer
222-
:rtype BLEConnection
223+
:return: the connection to the peer
224+
:rtype: BLEConnection
223225
"""
224226
connection = self._adapter.connect(advertisement.address, timeout=timeout)
225227
self._connection_cache[connection] = BLEConnection(connection)

adafruit_ble/attributes/__init__.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,36 @@
3333
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BLE.git"
3434

3535
class Attribute:
36-
"""Constants describing security levels."""
36+
"""Constants describing security levels.
37+
38+
.. data:: NO_ACCESS
39+
40+
security mode: access not allowed
41+
42+
.. data:: OPEN
43+
44+
security_mode: no security (link is not encrypted)
45+
46+
.. data:: ENCRYPT_NO_MITM
47+
48+
security_mode: unauthenticated encryption, without man-in-the-middle protection
49+
50+
.. data:: ENCRYPT_WITH_MITM
51+
52+
security_mode: authenticated encryption, with man-in-the-middle protection
53+
54+
.. data:: LESC_ENCRYPT_WITH_MITM
55+
56+
security_mode: LESC encryption, with man-in-the-middle protection
57+
58+
.. data:: SIGNED_NO_MITM
59+
60+
security_mode: unauthenticated data signing, without man-in-the-middle protection
61+
62+
.. data:: SIGNED_WITH_MITM
63+
64+
security_mode: authenticated data signing, without man-in-the-middle protection
65+
"""
3766
NO_ACCESS = _bleio.Attribute.NO_ACCESS
3867
OPEN = _bleio.Attribute.OPEN
3968
ENCRYPT_NO_MITM = _bleio.Attribute.ENCRYPT_NO_MITM

adafruit_ble/characteristics/__init__.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
class Characteristic:
4040
"""
4141
Top level Characteristic class that does basic binding.
42+
4243
:param UUID uuid: The uuid of the characteristic
4344
:param int properties: The properties of the characteristic,
4445
specified as a bitmask of these values bitwise-or'd together:
@@ -57,24 +58,37 @@ class Characteristic:
5758
:param bool fixed_length: True if the characteristic value is of fixed length.
5859
:param buf initial_value: The initial value for this characteristic. If not given, will be
5960
filled with zeros.
60-
:return: the new Characteristic.
6161
62+
.. data:: BROADCAST
63+
64+
property: allowed in advertising packets
65+
66+
.. data:: INDICATE
67+
68+
property: server will indicate to the client when the value is set and wait for a response
69+
70+
.. data:: NOTIFY
71+
72+
property: server will notify the client when the value is set
73+
74+
.. data:: READ
75+
76+
property: clients may read this characteristic
77+
78+
.. data:: WRITE
79+
80+
property: clients may write this characteristic; a response will be sent back
81+
82+
.. data:: WRITE_NO_RESPONSE
83+
84+
property: clients may write this characteristic; no response will be sent back
6285
"""
6386
BROADCAST = _bleio.Characteristic.BROADCAST
64-
"""Property: allowed in advertising packets."""
6587
INDICATE = _bleio.Characteristic.INDICATE
66-
"""Property: server will indicate to the client when the value is set
67-
and wait for a response.
68-
"""
6988
NOTIFY = _bleio.Characteristic.NOTIFY
70-
"""Property: lServer will notify the client when the value is set."""
7189
READ = _bleio.Characteristic.READ
72-
"""Property: clients may read this characteristic."""
7390
WRITE = _bleio.Characteristic.WRITE
74-
"""Property: clients may write this characteristic; a response will be sent back."""
7591
WRITE_NO_RESPONSE = _bleio.Characteristic.WRITE_NO_RESPONSE
76-
"""Property: clients may write this characteristic; no response will be sent back."""
77-
7892

7993
def __init__(self, *, uuid=None, properties=0,
8094
read_perm=Attribute.OPEN, write_perm=Attribute.OPEN,

adafruit_ble/services/standard/device_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
import sys
4949
import microcontroller
5050

51-
from ..core import Service
52-
from ...core.uuid import StandardUUID
51+
from .. import Service
52+
from ...uuid import StandardUUID
5353
from ...characteristics.string import FixedStringCharacteristic
5454

5555
__version__ = "0.0.0-auto.0"

adafruit_ble/services/standard/standard.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929

3030
import time
3131

32-
from ..core import Service
33-
from ...core.uuid import StandardUUID
32+
from .. import Service
33+
from ...uuid import StandardUUID
3434
from ..characteristics.string import StringCharacteristic
35-
from ..characteristics.core import StructCharacteristic
35+
from ..characteristics import StructCharacteristic
3636
from ..characteristics.int import Uint8Characteristic
3737

3838
__version__ = "0.0.0-auto.0"

docs/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
top_level
1010
advertising
11+
attributes
1112
characteristics
1213
services
1314
uuid

docs/attributes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
`adafruit_ble.attributes`
2+
====================================================
3+
4+
.. automodule:: adafruit_ble.attributes
5+
:members:

docs/bleio_mock.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
class Attribute:
2-
OPEN = 0
32
NO_ACCESS = 0
3+
OPEN = 0
4+
ENCRYPT_NO_MITM = 0
5+
ENCRYPT_WITH_MITM = 0
6+
LESC_ENCRYPT_WITH_MITM = 0
7+
SIGNED_NO_MITM = 0
8+
SIGNED_WITH_MITM = 0
49

510
class UUID:
611
def __init__(self, uuid):
712
pass
813

914
class Characteristic:
15+
BROADCAST = 0
1016
READ = 0
1117
WRITE = 0
1218
NOTIFY = 0
19+
INDICATE = 0
1320
WRITE_NO_RESPONSE = 0

0 commit comments

Comments
 (0)