summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2020-10-07 17:11:32 -0700
committerScott Shawcroft <scott@tannewt.org>2020-10-07 17:11:32 -0700
commit9fcf96cb645d726cd4c80b9cce438f1633dab95f (patch)
treee6d2463e069635bf6c7f6f223a3cd1ea515129ce /shared-bindings
parent66c25667d88db412a90d47cb80bf178e5a6669b2 (diff)
Replace _bleio.ConnectionError with the native version
Replace uses of _bleio.ConnectionError with regular ConnectionError Fixes #3008
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/_bleio/CharacteristicBuffer.c2
-rw-r--r--shared-bindings/_bleio/Connection.c2
-rw-r--r--shared-bindings/_bleio/PacketBuffer.c2
-rw-r--r--shared-bindings/_bleio/__init__.c15
-rw-r--r--shared-bindings/_bleio/__init__.h2
5 files changed, 4 insertions, 19 deletions
diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c
index 7bcbc807e..4d6c836c1 100644
--- a/shared-bindings/_bleio/CharacteristicBuffer.c
+++ b/shared-bindings/_bleio/CharacteristicBuffer.c
@@ -37,7 +37,7 @@
STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self) {
if (!common_hal_bleio_characteristic_buffer_connected(self)) {
- mp_raise_bleio_ConnectionError(translate("Not connected"));
+ mp_raise_ConnectionError(translate("Not connected"));
}
}
diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c
index b5eeaa906..fe82af098 100644
--- a/shared-bindings/_bleio/Connection.c
+++ b/shared-bindings/_bleio/Connection.c
@@ -63,7 +63,7 @@
void bleio_connection_ensure_connected(bleio_connection_obj_t *self) {
if (!common_hal_bleio_connection_get_connected(self)) {
- mp_raise_bleio_ConnectionError(translate("Connection has been disconnected and can no longer be used. Create a new connection."));
+ mp_raise_ConnectionError(translate("Connection has been disconnected and can no longer be used. Create a new connection."));
}
}
diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c
index 8c8970939..f2a3cbce0 100644
--- a/shared-bindings/_bleio/PacketBuffer.c
+++ b/shared-bindings/_bleio/PacketBuffer.c
@@ -161,7 +161,7 @@ STATIC mp_obj_t bleio_packet_buffer_write(mp_uint_t n_args, const mp_obj_t *pos_
// gatts write events, which may not have been sent yet.
//
// IDEAL:
- // mp_raise_bleio_ConnectionError(translate("Not connected"));
+ // mp_raise_ConnectionError(translate("Not connected"));
// TEMPORARY:
num_bytes_written = 0;
}
diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c
index 3d9084dd5..2ef70a64f 100644
--- a/shared-bindings/_bleio/__init__.c
+++ b/shared-bindings/_bleio/__init__.c
@@ -63,7 +63,6 @@
//| """Catchall exception for Bluetooth related errors."""
//| ...
MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception)
-
NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...) {
va_list argptr;
va_start(argptr,fmt);
@@ -71,18 +70,6 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* fmt, ...)
va_end(argptr);
nlr_raise(exception);
}
-//| class ConnectionError(BluetoothError):
-//| """Raised when a connection is unavailable."""
-//| ...
-//|
-MP_DEFINE_BLEIO_EXCEPTION(ConnectionError, bleio_BluetoothError)
-NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* fmt, ...) {
- va_list argptr;
- va_start(argptr,fmt);
- mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_bleio_ConnectionError, fmt, argptr);
- va_end(argptr);
- nlr_raise(exception);
-}
//| class RoleError(BluetoothError):
//| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is
@@ -93,6 +80,7 @@ MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError)
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg) {
mp_raise_msg(&mp_type_bleio_RoleError, msg);
}
+
//| class SecurityError(BluetoothError):
//| """Raised when a security related error occurs."""
//| ...
@@ -183,7 +171,6 @@ STATIC const mp_rom_map_elem_t bleio_module_globals_table[] = {
// Errors
{ MP_ROM_QSTR(MP_QSTR_BluetoothError), OBJ_FROM_PTR(&mp_type_bleio_BluetoothError) },
- { MP_ROM_QSTR(MP_QSTR_ConnectionError), OBJ_FROM_PTR(&mp_type_bleio_ConnectionError) },
{ MP_ROM_QSTR(MP_QSTR_RoleError), OBJ_FROM_PTR(&mp_type_bleio_RoleError) },
{ MP_ROM_QSTR(MP_QSTR_SecurityError), OBJ_FROM_PTR(&mp_type_bleio_SecurityError) },
diff --git a/shared-bindings/_bleio/__init__.h b/shared-bindings/_bleio/__init__.h
index 588b1f197..65ba9b3a5 100644
--- a/shared-bindings/_bleio/__init__.h
+++ b/shared-bindings/_bleio/__init__.h
@@ -51,14 +51,12 @@ const mp_obj_type_t mp_type_bleio_ ## exc_name = { \
};
extern const mp_obj_type_t mp_type_bleio_BluetoothError;
-extern const mp_obj_type_t mp_type_bleio_ConnectionError;
extern const mp_obj_type_t mp_type_bleio_RoleError;
extern const mp_obj_type_t mp_type_bleio_SecurityError;
extern mp_obj_t bleio_set_adapter(mp_obj_t adapter_obj);
NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t* msg, ...);
-NORETURN void mp_raise_bleio_ConnectionError(const compressed_string_t* msg, ...);
NORETURN void mp_raise_bleio_RoleError(const compressed_string_t* msg);
NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t* msg, ...);