diff options
| author | Dan Halbert <halbert@halwitz.org> | 2019-05-17 15:47:12 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2019-05-17 15:47:12 -0400 |
| commit | ee8119779e22c21fe7771a054e4cf6ee921b4352 (patch) | |
| tree | 9975ea28056b7a0ba2fdc4be9f85ee5e1d79540a /shared-bindings | |
| parent | bd69212a194849fd2d8d025ceaa4ecc0117753cc (diff) | |
WIP
Diffstat (limited to 'shared-bindings')
| -rw-r--r-- | shared-bindings/bleio/ScanEntry.c | 7 | ||||
| -rw-r--r-- | shared-bindings/bleio/Scanner.c | 23 | ||||
| -rw-r--r-- | shared-bindings/bleio/Scanner.h | 2 |
3 files changed, 11 insertions, 21 deletions
diff --git a/shared-bindings/bleio/ScanEntry.c b/shared-bindings/bleio/ScanEntry.c index e6b955078..67e4a38c0 100644 --- a/shared-bindings/bleio/ScanEntry.c +++ b/shared-bindings/bleio/ScanEntry.c @@ -37,9 +37,6 @@ #include "shared-module/bleio/AdvertisementData.h" #include "shared-module/bleio/ScanEntry.h" -// Work-in-progress: orphaned for now. -//| :orphan: -//| //| .. currentmodule:: bleio //| //| :class:`ScanEntry` -- BLE scan response entry @@ -63,7 +60,7 @@ //| .. attribute:: name //| //| The name of the device. (read-only) -//| This attribute might be `None` if the data was missing from the advertisement packet. +//| Will be be `None` if the data was missing from the advertisement packet. //| //| .. attribute:: raw_data @@ -87,7 +84,7 @@ //| .. attribute:: tx_power_level //| //| The transmit power level of the device. (read-only) -//| This attribute might be `None` if the data was missing from the advertisement packet. +//| Will be `None` if the data was missing from the advertisement packet. //| static uint8_t find_data_item(mp_obj_array_t *data_in, uint8_t type, uint8_t **data_out) { uint16_t i = 0; diff --git a/shared-bindings/bleio/Scanner.c b/shared-bindings/bleio/Scanner.c index f5424f706..73b6e6a0b 100644 --- a/shared-bindings/bleio/Scanner.c +++ b/shared-bindings/bleio/Scanner.c @@ -3,6 +3,7 @@ * * 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 @@ -32,9 +33,6 @@ #define DEFAULT_INTERVAL 100 #define DEFAULT_WINDOW 100 -// Work-in-progress: orphaned for now. -//| :orphan: -//| //| .. currentmodule:: bleio //| //| :class:`Scanner` -- scan for nearby BLE devices @@ -46,7 +44,7 @@ //| //| import bleio //| scanner = bleio.Scanner() -//| entries = scanner.scan(2500) +//| entries = scanner.scan(2.5) # Scan for 2.5 seconds //| print(entries) //| @@ -57,33 +55,28 @@ //| .. attribute:: interval //| -//| The interval (in ms) between the start of two consecutive scan windows. -//| Allowed values are between 10ms and 10.24 sec. +//| The interval (in seconds) between the start of two consecutive scan windows. +//| Allowed values are between 0.010 and 10.24 sec. //| //| .. attribute:: window //| -//| The duration (in ms) in which a single BLE channel is scanned. -//| Allowed values are between 10ms and 10.24 sec. +//| The duration (in seconds) in which a single BLE channel is scanned. +//| Allowed values are between 0.010 and 10.24 sec. //| //| .. method:: scan(timeout) //| //| Performs a BLE scan. //| -//| :param int timeout: the scan timeout in ms +//| :param float timeout: the scan timeout in seconds //| :returns: advertising packets found //| :rtype: list of :py:class:`bleio.ScanEntry` //| -STATIC void bleio_scanner_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { - bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in); - - mp_printf(print, "Scanner(interval: %d window: %d)", self->interval, self->window); -} - STATIC mp_obj_t bleio_scanner_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) { mp_arg_check_num(n_args, kw_args, 0, 0, false); + bleio_scanner_obj_t *self = m_new_obj(bleio_scanner_obj_t); self->base.type = type; diff --git a/shared-bindings/bleio/Scanner.h b/shared-bindings/bleio/Scanner.h index 9bd071747..c72136389 100644 --- a/shared-bindings/bleio/Scanner.h +++ b/shared-bindings/bleio/Scanner.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Glenn Ruben Bakke + * 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 |
