summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/btstack/modbluetooth_btstack.c
diff options
context:
space:
mode:
Diffstat (limited to 'extmod/btstack/modbluetooth_btstack.c')
-rw-r--r--extmod/btstack/modbluetooth_btstack.c128
1 files changed, 128 insertions, 0 deletions
diff --git a/extmod/btstack/modbluetooth_btstack.c b/extmod/btstack/modbluetooth_btstack.c
new file mode 100644
index 0000000000..73f28ffad3
--- /dev/null
+++ b/extmod/btstack/modbluetooth_btstack.c
@@ -0,0 +1,128 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Damien P. George
+ *
+ * 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.
+ */
+
+#if MICROPY_PY_BLUETOOTH && MICROPY_BLUETOOTH_BTSTACK
+
+#include "extmod/btstack/modbluetooth_btstack.h"
+#include "extmod/modbluetooth.h"
+
+int mp_bluetooth_init(void) {
+ return 0;
+}
+
+void mp_bluetooth_deinit(void) {
+}
+
+bool mp_bluetooth_is_enabled(void) {
+ return false;
+}
+
+void mp_bluetooth_get_device_addr(uint8_t *addr) {
+ mp_hal_get_mac(MP_HAL_MAC_BDADDR, addr);
+}
+
+int mp_bluetooth_gap_advertise_start(bool connectable, int32_t interval_us, const uint8_t *adv_data, size_t adv_data_len, const uint8_t *sr_data, size_t sr_data_len) {
+ return 0;
+}
+
+void mp_bluetooth_gap_advertise_stop(void) {
+}
+
+int mp_bluetooth_gatts_register_service_begin(bool append) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_register_service(mp_obj_bluetooth_uuid_t *service_uuid, mp_obj_bluetooth_uuid_t **characteristic_uuids, uint8_t *characteristic_flags, mp_obj_bluetooth_uuid_t **descriptor_uuids, uint8_t *descriptor_flags, uint8_t *num_descriptors, uint16_t *handles, size_t num_characteristics) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_register_service_end(void) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_read(uint16_t value_handle, uint8_t **value, size_t *value_len) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_write(uint16_t value_handle, const uint8_t *value, size_t value_len) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_notify(uint16_t conn_handle, uint16_t value_handle) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_notify_send(uint16_t conn_handle, uint16_t value_handle, const uint8_t *value, size_t *value_len) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_indicate(uint16_t conn_handle, uint16_t value_handle) {
+ return 0;
+}
+
+int mp_bluetooth_gatts_set_buffer(uint16_t value_handle, size_t len, bool append) {
+ return 0;
+}
+
+int mp_bluetooth_gap_disconnect(uint16_t conn_handle) {
+ return 0;
+}
+
+#if MICROPY_PY_BLUETOOTH_ENABLE_CENTRAL_MODE
+int mp_bluetooth_gap_scan_start(int32_t duration_ms, int32_t interval_us, int32_t window_us) {
+ return 0;
+}
+
+int mp_bluetooth_gap_scan_stop(void) {
+ return 0;
+}
+
+int mp_bluetooth_gap_peripheral_connect(uint8_t addr_type, const uint8_t *addr, int32_t duration_ms) {
+ return 0;
+}
+
+int mp_bluetooth_gattc_discover_primary_services(uint16_t conn_handle) {
+ return 0;
+}
+
+int mp_bluetooth_gattc_discover_characteristics(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle) {
+ return 0;
+}
+
+int mp_bluetooth_gattc_discover_descriptors(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle) {
+ return 0;
+}
+
+int mp_bluetooth_gattc_read(uint16_t conn_handle, uint16_t value_handle) {
+ return 0;
+}
+
+int mp_bluetooth_gattc_write(uint16_t conn_handle, uint16_t value_handle, const uint8_t *value, size_t *value_len, unsigned int mode) {
+ return 0;
+}
+#endif
+
+#endif // MICROPY_PY_BLUETOOTH && MICROPY_BLUETOOTH_BTSTACK