Skip to content

Commit 99ba836

Browse files
authored
Merge pull request #164 from kevincar/119-inconsistent-spelling-of-writable
Fix inconsistent spelling of writable
2 parents 73d4b21 + 418629c commit 99ba836

File tree

10 files changed

+22
-25
lines changed

10 files changed

+22
-25
lines changed

bless/backends/attribute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
class GATTAttributePermissions(Flag):
55
readable = 0x1
6-
writeable = 0x2
6+
writable = 0x2
77
read_encryption_required = 0x4
88
write_encryption_required = 0x8

bless/backends/characteristic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ def _properties_to_bleak(
5858

5959
class BlessGATTCharacteristic(BleakGATTCharacteristic):
6060
"""
61-
Extension of the BleakGATTCharacteristic to allow for writeable values
61+
Extension of the BleakGATTCharacteristic to allow for writable values
6262
"""
6363

6464
def __init__(
6565
self,
6666
uuid: Union[str, UUID],
6767
properties: GATTCharacteristicProperties,
6868
permissions: GATTAttributePermissions,
69-
value: Optional[bytearray]
69+
value: Optional[bytearray],
7070
):
7171
"""
7272
Instantiates a new GATT Characteristic but is not yet assigned to any

bless/backends/descriptor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ class GATTDescriptorProperties(Flag):
2626

2727
class BlessGATTDescriptor(BleakGATTDescriptor):
2828
"""
29-
Extension of the BleakGATTDescriptor to allow for writeable values
29+
Extension of the BleakGATTDescriptor to allow for writable values
3030
"""
3131

3232
def __init__(
3333
self,
3434
uuid: Union[str, UUID],
3535
properties: GATTDescriptorProperties,
3636
permissions: GATTAttributePermissions,
37-
value: Optional[bytearray]
37+
value: Optional[bytearray],
3838
):
3939
"""
4040
Instantiates a new GATT Descriptor but is not yet assigned to any

docs/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Create a server, add a GATT tree, then start advertising:
2222
),
2323
"Permissions": (
2424
GATTAttributePermissions.readable
25-
| GATTAttributePermissions.writeable
25+
| GATTAttributePermissions.writable
2626
),
2727
"Value": None,
2828
}

examples/gattserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async def run(loop):
6262
),
6363
"Permissions": (
6464
GATTAttributePermissions.readable
65-
| GATTAttributePermissions.writeable
65+
| GATTAttributePermissions.writable
6666
),
6767
"Value": None,
6868
}

examples/gattserver_notify.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Example for a BLE 4.0 Server using a GATT dictionary of services and
33
characteristics, plus explicit notifications to subscribed centrals.
44
"""
5+
56
import sys
67
import logging
78
import asyncio
@@ -54,7 +55,7 @@ async def run(loop):
5455
),
5556
"Permissions": (
5657
GATTAttributePermissions.readable
57-
| GATTAttributePermissions.writeable
58+
| GATTAttributePermissions.writable
5859
),
5960
"Value": None,
6061
}

examples/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Example for a BLE 4.0 Server
33
"""
4+
45
import sys
56
import logging
67
import asyncio
@@ -58,7 +59,7 @@ async def run(loop):
5859
| GATTCharacteristicProperties.write
5960
| GATTCharacteristicProperties.indicate
6061
)
61-
permissions = GATTAttributePermissions.readable | GATTAttributePermissions.writeable
62+
permissions = GATTAttributePermissions.readable | GATTAttributePermissions.writable
6263
await server.add_new_characteristic(
6364
my_service_uuid, my_char_uuid, char_flags, None, permissions
6465
)

test/backends/test_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async def test_server(self):
8585
)
8686
value: Optional[bytearray] = None
8787
permissions: GATTAttributePermissions = (
88-
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
88+
GATTAttributePermissions.readable | GATTAttributePermissions.writable
8989
)
9090

9191
if use_encrypted:

test/backends/winrt/test_serviceprovider.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ def advertisement_status_changed(
107107
if args.status == 2:
108108
start_event.set()
109109

110-
def read(
111-
sender: GattLocalCharacteristic,
112-
args: GattReadRequestedEventArgs):
110+
def read(sender: GattLocalCharacteristic, args: GattReadRequestedEventArgs):
113111
print("Read")
114112
deferral: Deferral = args.get_deferral()
115113
value = self.val
@@ -120,20 +118,20 @@ def read(
120118
async def f():
121119
nonlocal request
122120
request = await args.get_request_async()
121+
123122
asyncio.run(f())
124123
request.respond_with_value(writer.detach_buffer())
125124
deferral.complete()
126125

127-
def write(
128-
sender: GattLocalCharacteristic,
129-
args: GattWriteRequestedEventArgs):
126+
def write(sender: GattLocalCharacteristic, args: GattWriteRequestedEventArgs):
130127
print("WRITE")
131128
deferral: Deferral = args.get_deferral()
132129
request: GattWriteRequest
133130

134131
async def f():
135132
nonlocal request
136133
request = await args.get_request_async()
134+
137135
asyncio.run(f())
138136
reader: DataReader = DataReader.from_buffer(request.value)
139137
n_bytes: int = reader.unconsumed_buffer_length
@@ -156,9 +154,7 @@ def subscribe(sender: GattLocalCharacteristic, args: Any):
156154
service_provider_result: GattServiceProviderResult = (
157155
await GattServiceProvider.create_async(service_uuid)
158156
)
159-
service_provider: GattServiceProvider = (
160-
service_provider_result.service_provider
161-
)
157+
service_provider: GattServiceProvider = service_provider_result.service_provider
162158
service_provider.add_advertisement_status_changed(advertisement_status_changed)
163159

164160
new_service: GattLocalService = service_provider.service
@@ -173,8 +169,7 @@ def subscribe(sender: GattLocalCharacteristic, args: Any):
173169
)
174170

175171
permissions: GATTAttributePermissions = (
176-
GATTAttributePermissions.readable |
177-
GATTAttributePermissions.writeable
172+
GATTAttributePermissions.readable | GATTAttributePermissions.writable
178173
)
179174

180175
read_parameters: GattLocalCharacteristicParameters = (

test/test_bleak_v1_compatibility.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def test_add_characteristic(self):
5454
| GATTCharacteristicProperties.notify
5555
)
5656
permissions = (
57-
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
57+
GATTAttributePermissions.readable | GATTAttributePermissions.writable
5858
)
5959

6060
await server.add_new_characteristic(
@@ -114,7 +114,7 @@ async def test_add_gatt_tree(self):
114114
),
115115
"Permissions": (
116116
GATTAttributePermissions.readable
117-
| GATTAttributePermissions.writeable
117+
| GATTAttributePermissions.writable
118118
),
119119
"Value": bytearray(b"test"),
120120
}
@@ -142,7 +142,7 @@ async def test_characteristic_value(self):
142142
GATTCharacteristicProperties.read | GATTCharacteristicProperties.write
143143
)
144144
permissions = (
145-
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
145+
GATTAttributePermissions.readable | GATTAttributePermissions.writable
146146
)
147147

148148
await server.add_new_characteristic(
@@ -175,7 +175,7 @@ async def test_characteristic_properties(self):
175175
| GATTCharacteristicProperties.notify
176176
)
177177
permissions = (
178-
GATTAttributePermissions.readable | GATTAttributePermissions.writeable
178+
GATTAttributePermissions.readable | GATTAttributePermissions.writable
179179
)
180180

181181
await server.add_new_characteristic(

0 commit comments

Comments
 (0)