Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 micropython/bluetooth/aioble/aioble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def timeout(self, timeout_ms):

async def exchange_mtu(self, mtu=None, timeout_ms=1000):
if not self.is_connected():
raise ValueError("Not connected")
raise DeviceDisconnectedError

if mtu:
ble.config(mtu=mtu)
Expand Down
6 changes: 3 additions & 3 deletions micropython/bluetooth/aioble/aioble/l2cap.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import asyncio

from .core import ble, log_error, register_irq_handler
from .device import DeviceConnection
from .device import DeviceConnection, DeviceDisconnectedError


_IRQ_L2CAP_ACCEPT = const(22)
Expand Down Expand Up @@ -63,7 +63,7 @@ def _l2cap_shutdown():


# The channel was disconnected during a send/recvinto/flush.
class L2CAPDisconnectedError(Exception):
class L2CAPDisconnectedError(DeviceDisconnectedError):
pass


Expand All @@ -75,7 +75,7 @@ class L2CAPConnectionError(Exception):
class L2CAPChannel:
def __init__(self, connection):
if not connection.is_connected():
raise ValueError("Not connected")
raise L2CAPDisconnectedError

if connection._l2cap_channel:
raise ValueError("Already has channel")
Expand Down
4 changes: 2 additions & 2 deletions micropython/bluetooth/aioble/aioble/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
register_irq_handler,
GattError,
)
from .device import DeviceConnection, DeviceTimeout
from .device import DeviceConnection, DeviceDisconnectedError, DeviceTimeout

_registered_characteristics = {}

Expand Down Expand Up @@ -263,7 +263,7 @@ async def indicate(self, connection, data=None, timeout_ms=1000):
if self._indicate_connection is not None:
raise ValueError("In progress")
if not connection.is_connected():
raise ValueError("Not connected")
raise DeviceDisconnectedError

self._indicate_connection = connection
self._indicate_status = None
Expand Down
Loading