summaryrefslogtreecommitdiff
path: root/shared-module/bleio
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2019-08-29 21:48:31 -0700
committerGitHub <noreply@github.com>2019-08-29 21:48:31 -0700
commitb954b2f5df08a2674726fe70023adbe743280426 (patch)
treedbf77764a909b6b36c40f1a66daa3ef323ab9593 /shared-module/bleio
parent2b5ce666be90de7738ed434ba1dde13f67fc30de (diff)
parent318d704887cba04587657c75a8fa9862e22e41aa (diff)
Merge pull request #2092 from dhalbert/bleio-api-revamp5.0.0-alpha.1
Bleio attribute api revamp
Diffstat (limited to 'shared-module/bleio')
-rw-r--r--shared-module/bleio/Address.c45
-rw-r--r--shared-module/bleio/Address.h41
-rw-r--r--shared-module/bleio/Attribute.c46
-rw-r--r--shared-module/bleio/Attribute.h41
-rw-r--r--shared-module/bleio/Characteristic.h43
-rw-r--r--shared-module/bleio/ScanEntry.c45
-rw-r--r--shared-module/bleio/ScanEntry.h42
7 files changed, 0 insertions, 303 deletions
diff --git a/shared-module/bleio/Address.c b/shared-module/bleio/Address.c
deleted file mode 100644
index 6bc458b7c..000000000
--- a/shared-module/bleio/Address.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- * Copyright (c) 2018 Artur Pacholec
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <string.h>
-
-#include "py/objstr.h"
-#include "shared-bindings/bleio/Address.h"
-#include "shared-module/bleio/Address.h"
-
-void common_hal_bleio_address_construct(bleio_address_obj_t *self, uint8_t *bytes, uint8_t address_type) {
- self->bytes = mp_obj_new_bytes(bytes, NUM_BLEIO_ADDRESS_BYTES);
- self->type = address_type;
-}
-
-mp_obj_t common_hal_bleio_address_get_address_bytes(bleio_address_obj_t *self) {
- return self->bytes;
-}
-
-uint8_t common_hal_bleio_address_get_type(bleio_address_obj_t *self) {
- return self->type;
-}
diff --git a/shared-module/bleio/Address.h b/shared-module/bleio/Address.h
deleted file mode 100644
index 39789842f..000000000
--- a/shared-module/bleio/Address.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- * Copyright (c) 2018 Artur Pacholec
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADDRESS_H
-#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADDRESS_H
-
-#include "py/obj.h"
-
-#define NUM_BLEIO_ADDRESS_BYTES 6
-
-typedef struct {
- mp_obj_base_t base;
- uint8_t type;
- mp_obj_t bytes; // a bytes() object
-} bleio_address_obj_t;
-
-#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ADDRESS_H
diff --git a/shared-module/bleio/Attribute.c b/shared-module/bleio/Attribute.c
deleted file mode 100644
index 2275003c9..000000000
--- a/shared-module/bleio/Attribute.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <string.h>
-
-#include "py/runtime.h"
-#include "shared-bindings/bleio/Attribute.h"
-
-void common_hal_bleio_attribute_security_mode_check_valid(bleio_attribute_security_mode_t security_mode) {
- switch (security_mode) {
- case SECURITY_MODE_NO_ACCESS:
- case SECURITY_MODE_OPEN:
- case SECURITY_MODE_ENC_NO_MITM:
- case SECURITY_MODE_ENC_WITH_MITM:
- case SECURITY_MODE_LESC_ENC_WITH_MITM:
- case SECURITY_MODE_SIGNED_NO_MITM:
- case SECURITY_MODE_SIGNED_WITH_MITM:
- break;
- default:
- mp_raise_ValueError(translate("Invalid security_mode"));
- break;
- }
-}
diff --git a/shared-module/bleio/Attribute.h b/shared-module/bleio/Attribute.h
deleted file mode 100644
index a498a14a5..000000000
--- a/shared-module/bleio/Attribute.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ATTRIBUTE_H
-#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ATTRIBUTE_H
-
-// BLE security modes: 0x<level><mode>
-typedef enum {
- SECURITY_MODE_NO_ACCESS = 0x00,
- SECURITY_MODE_OPEN = 0x11,
- SECURITY_MODE_ENC_NO_MITM = 0x21,
- SECURITY_MODE_ENC_WITH_MITM = 0x31,
- SECURITY_MODE_LESC_ENC_WITH_MITM = 0x41,
- SECURITY_MODE_SIGNED_NO_MITM = 0x12,
- SECURITY_MODE_SIGNED_WITH_MITM = 0x22,
-} bleio_attribute_security_mode_t;
-
-#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_ATTRIBUTE_H
diff --git a/shared-module/bleio/Characteristic.h b/shared-module/bleio/Characteristic.h
deleted file mode 100644
index 409a57c76..000000000
--- a/shared-module/bleio/Characteristic.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CHARACTERISTIC_H
-#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CHARACTERISTIC_H
-
-typedef enum {
- CHAR_PROP_NONE = 0,
- CHAR_PROP_BROADCAST = 1u << 0,
- CHAR_PROP_INDICATE = 1u << 1,
- CHAR_PROP_NOTIFY = 1u << 2,
- CHAR_PROP_READ = 1u << 3,
- CHAR_PROP_WRITE = 1u << 4,
- CHAR_PROP_WRITE_NO_RESPONSE = 1u << 5,
- CHAR_PROP_ALL = (CHAR_PROP_BROADCAST | CHAR_PROP_INDICATE | CHAR_PROP_NOTIFY |
- CHAR_PROP_READ | CHAR_PROP_WRITE | CHAR_PROP_WRITE_NO_RESPONSE)
-} bleio_characteristic_properties_enum_t;
-typedef uint8_t bleio_characteristic_properties_t;
-
-#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_CHARACTERISTIC_H
diff --git a/shared-module/bleio/ScanEntry.c b/shared-module/bleio/ScanEntry.c
deleted file mode 100644
index 306ac33c5..000000000
--- a/shared-module/bleio/ScanEntry.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- * Copyright (c) 2018 Artur Pacholec
- * Copyright (c) 2017 Glenn Ruben Bakke
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <string.h>
-
-#include "shared-bindings/bleio/Address.h"
-#include "shared-module/bleio/Address.h"
-#include "shared-module/bleio/ScanEntry.h"
-
-mp_obj_t common_hal_bleio_scanentry_get_address(bleio_scanentry_obj_t *self) {
- return MP_OBJ_FROM_PTR(self->address);
-}
-
-mp_obj_t common_hal_bleio_scanentry_get_advertisement_bytes(bleio_scanentry_obj_t *self) {
- return self->data;
-}
-
-mp_int_t common_hal_bleio_scanentry_get_rssi(bleio_scanentry_obj_t *self) {
- return self->rssi;
-}
diff --git a/shared-module/bleio/ScanEntry.h b/shared-module/bleio/ScanEntry.h
deleted file mode 100644
index b302460e6..000000000
--- a/shared-module/bleio/ScanEntry.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2019 Dan Halbert for Adafruit Industries
- * Copyright (c) 2018 Artur Pacholec
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#ifndef MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANENTRY_H
-#define MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANENTRY_H
-
-#include "py/obj.h"
-#include "shared-bindings/bleio/Address.h"
-
-typedef struct {
- mp_obj_base_t base;
- bool connectable;
- int8_t rssi;
- bleio_address_obj_t *address;
- mp_obj_t data;
-} bleio_scanentry_obj_t;
-
-#endif // MICROPY_INCLUDED_SHARED_MODULE_BLEIO_SCANENTRY_H