2016-11-16 15:38:25 -05:00
|
|
|
/*
|
2017-08-04 12:05:38 -04:00
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
2016-11-16 15:38:25 -05:00
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
2019-06-19 10:42:36 -04:00
|
|
|
* Copyright (c) 2018 Dan Halbert for Adafruit Industries
|
2018-07-08 15:13:05 -04:00
|
|
|
* Copyright (c) 2018 Artur Pacholec
|
2016-11-16 15:38:25 -05:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2018-07-08 15:13:05 -04:00
|
|
|
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADAPTER_H
|
|
|
|
#define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADAPTER_H
|
2016-11-16 15:38:25 -05:00
|
|
|
|
2019-09-14 15:40:24 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "common-hal/_bleio/Adapter.h"
|
|
|
|
|
|
|
|
#include "py/objstr.h"
|
2019-08-29 18:44:27 -04:00
|
|
|
#include "shared-module/_bleio/Address.h"
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2020-08-03 19:40:45 -04:00
|
|
|
extern const mp_obj_type_t bleio_adapter_type;
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2020-05-19 02:56:04 -04:00
|
|
|
extern bool common_hal_bleio_adapter_get_advertising(bleio_adapter_obj_t *self);
|
2019-09-14 15:40:24 -04:00
|
|
|
extern bool common_hal_bleio_adapter_get_enabled(bleio_adapter_obj_t *self);
|
|
|
|
extern void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enabled);
|
|
|
|
extern bool common_hal_bleio_adapter_get_connected(bleio_adapter_obj_t *self);
|
|
|
|
extern bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *self);
|
2020-08-14 05:48:15 -04:00
|
|
|
extern bool common_hal_bleio_adapter_set_address(bleio_adapter_obj_t *self, bleio_address_obj_t *address);
|
2019-09-14 15:40:24 -04:00
|
|
|
|
|
|
|
extern mp_obj_str_t* common_hal_bleio_adapter_get_name(bleio_adapter_obj_t *self);
|
|
|
|
extern void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char* name);
|
|
|
|
|
2020-05-19 02:56:04 -04:00
|
|
|
extern uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool connectable, bool anonymous, uint32_t timeout, float interval, uint8_t *advertising_data, uint16_t advertising_data_len, uint8_t *scan_response_data, uint16_t scan_response_data_len);
|
2019-09-14 15:40:24 -04:00
|
|
|
|
2020-05-19 02:56:04 -04:00
|
|
|
extern void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool connectable, bool anonymous, uint32_t timeout, mp_float_t interval, mp_buffer_info_t *advertising_data_bufinfo, mp_buffer_info_t *scan_response_data_bufinfo);
|
2020-01-10 23:55:45 -05:00
|
|
|
extern void common_hal_bleio_adapter_stop_advertising(bleio_adapter_obj_t *self);
|
2019-09-14 15:40:24 -04:00
|
|
|
|
2020-01-10 23:55:45 -05:00
|
|
|
extern mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* prefixes, size_t prefix_length, bool extended, mp_int_t buffer_size, mp_float_t timeout, mp_float_t interval, mp_float_t window, mp_int_t minimum_rssi, bool active);
|
|
|
|
extern void common_hal_bleio_adapter_stop_scan(bleio_adapter_obj_t *self);
|
2019-09-14 15:40:24 -04:00
|
|
|
|
2020-01-10 23:55:45 -05:00
|
|
|
extern bool common_hal_bleio_adapter_get_connected(bleio_adapter_obj_t *self);
|
|
|
|
extern mp_obj_t common_hal_bleio_adapter_get_connections(bleio_adapter_obj_t *self);
|
|
|
|
extern mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_address_obj_t *address, mp_float_t timeout);
|
|
|
|
|
|
|
|
extern void common_hal_bleio_adapter_erase_bonding(bleio_adapter_obj_t *self);
|
2016-12-13 14:27:26 -05:00
|
|
|
|
2018-07-08 15:13:05 -04:00
|
|
|
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_ADAPTER_H
|