Skip to content

Make UARTService characteristics be at least as large as max MTU-3 #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.17.4
rev: v3.3.1
hooks:
- id: pylint
name: pylint (library code)
Expand Down
2 changes: 1 addition & 1 deletion adafruit_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from __future__ import annotations

# pylint: disable=wrong-import-position
# pylint: disable=wrong-import-position,too-many-arguments

import sys

Expand Down
2 changes: 2 additions & 0 deletions adafruit_ble/characteristics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

import struct
import _bleio

Expand Down
2 changes: 2 additions & 0 deletions adafruit_ble/characteristics/float.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

from . import Attribute
from . import StructCharacteristic

Expand Down
2 changes: 2 additions & 0 deletions adafruit_ble/characteristics/int.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

from . import Attribute
from . import StructCharacteristic

Expand Down
2 changes: 2 additions & 0 deletions adafruit_ble/characteristics/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

import json
from . import Attribute
from . import Characteristic
Expand Down
9 changes: 8 additions & 1 deletion adafruit_ble/characteristics/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

import _bleio

from . import Attribute
Expand Down Expand Up @@ -66,7 +68,11 @@ def __init__(
self._timeout = timeout
self._buffer_size = buffer_size
super().__init__(
uuid=uuid, properties=properties, read_perm=read_perm, write_perm=write_perm
uuid=uuid,
properties=properties,
read_perm=read_perm,
write_perm=write_perm,
max_length=buffer_size,
)

def bind(
Expand Down Expand Up @@ -104,6 +110,7 @@ def __init__(
properties=properties,
read_perm=Attribute.NO_ACCESS,
write_perm=write_perm,
max_length=buffer_size,
)

def bind(
Expand Down
2 changes: 2 additions & 0 deletions adafruit_ble/characteristics/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

from . import Attribute
from . import Characteristic

Expand Down
6 changes: 4 additions & 2 deletions adafruit_ble/services/nordic.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ class UARTService(Service):
_server_tx = StreamOut(
uuid=VendorUUID("6E400003-B5A3-F393-E0A9-E50E24DCCA9E"),
timeout=1.0,
buffer_size=64,
# 512 is the largest negotiated MTU-3 value for all CircuitPython ports.
buffer_size=512,
)
_server_rx = StreamIn(
uuid=VendorUUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E"),
timeout=1.0,
buffer_size=64,
# 512 is the largest negotiated MTU-3 value for all CircuitPython ports.
buffer_size=512,
)

def __init__(self, service: Optional[_bleio.Service] = None) -> None:
Expand Down
2 changes: 1 addition & 1 deletion adafruit_ble/services/standard/device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DeviceInfoService(Service):
manufacturer = FixedStringCharacteristic(uuid=StandardUUID(0x2A29))
pnp_id = StructCharacteristic("<BHHH", uuid=StandardUUID(0x2A50))

def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
*,
manufacturer: Optional[str] = None,
Expand Down
2 changes: 2 additions & 0 deletions adafruit_ble/services/standard/hid.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from __future__ import annotations

# pylint: disable=too-many-arguments

import struct

from micropython import const
Expand Down
2 changes: 1 addition & 1 deletion examples/ble_packet_buffer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, uuid16):


class PacketBufferCharacteristic(ComplexCharacteristic):
def __init__(
def __init__( # pylint: disable=too-many-arguments
self,
*,
uuid=None,
Expand Down