Skip to content

Commit ee81197

Browse files
committed
WIP
1 parent bd69212 commit ee81197

3 files changed

Lines changed: 11 additions & 21 deletions

File tree

shared-bindings/bleio/ScanEntry.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
#include "shared-module/bleio/AdvertisementData.h"
3838
#include "shared-module/bleio/ScanEntry.h"
3939

40-
// Work-in-progress: orphaned for now.
41-
//| :orphan:
42-
//|
4340
//| .. currentmodule:: bleio
4441
//|
4542
//| :class:`ScanEntry` -- BLE scan response entry
@@ -63,7 +60,7 @@
6360
//| .. attribute:: name
6461
//|
6562
//| The name of the device. (read-only)
66-
//| This attribute might be `None` if the data was missing from the advertisement packet.
63+
//| Will be be `None` if the data was missing from the advertisement packet.
6764
//|
6865

6966
//| .. attribute:: raw_data
@@ -87,7 +84,7 @@
8784
//| .. attribute:: tx_power_level
8885
//|
8986
//| The transmit power level of the device. (read-only)
90-
//| This attribute might be `None` if the data was missing from the advertisement packet.
87+
//| Will be `None` if the data was missing from the advertisement packet.
9188
//|
9289
static uint8_t find_data_item(mp_obj_array_t *data_in, uint8_t type, uint8_t **data_out) {
9390
uint16_t i = 0;

shared-bindings/bleio/Scanner.c

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6+
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
67
* Copyright (c) 2018 Artur Pacholec
78
*
89
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -32,9 +33,6 @@
3233
#define DEFAULT_INTERVAL 100
3334
#define DEFAULT_WINDOW 100
3435

35-
// Work-in-progress: orphaned for now.
36-
//| :orphan:
37-
//|
3836
//| .. currentmodule:: bleio
3937
//|
4038
//| :class:`Scanner` -- scan for nearby BLE devices
@@ -46,7 +44,7 @@
4644
//|
4745
//| import bleio
4846
//| scanner = bleio.Scanner()
49-
//| entries = scanner.scan(2500)
47+
//| entries = scanner.scan(2.5) # Scan for 2.5 seconds
5048
//| print(entries)
5149
//|
5250

@@ -57,33 +55,28 @@
5755

5856
//| .. attribute:: interval
5957
//|
60-
//| The interval (in ms) between the start of two consecutive scan windows.
61-
//| Allowed values are between 10ms and 10.24 sec.
58+
//| The interval (in seconds) between the start of two consecutive scan windows.
59+
//| Allowed values are between 0.010 and 10.24 sec.
6260
//|
6361

6462
//| .. attribute:: window
6563
//|
66-
//| The duration (in ms) in which a single BLE channel is scanned.
67-
//| Allowed values are between 10ms and 10.24 sec.
64+
//| The duration (in seconds) in which a single BLE channel is scanned.
65+
//| Allowed values are between 0.010 and 10.24 sec.
6866
//|
6967

7068
//| .. method:: scan(timeout)
7169
//|
7270
//| Performs a BLE scan.
7371
//|
74-
//| :param int timeout: the scan timeout in ms
72+
//| :param float timeout: the scan timeout in seconds
7573
//| :returns: advertising packets found
7674
//| :rtype: list of :py:class:`bleio.ScanEntry`
7775
//|
78-
STATIC void bleio_scanner_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
79-
bleio_scanner_obj_t *self = MP_OBJ_TO_PTR(self_in);
80-
81-
mp_printf(print, "Scanner(interval: %d window: %d)", self->interval, self->window);
82-
}
83-
8476
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) {
8577
mp_arg_check_num(n_args, kw_args, 0, 0, false);
8678

79+
8780
bleio_scanner_obj_t *self = m_new_obj(bleio_scanner_obj_t);
8881
self->base.type = type;
8982

shared-bindings/bleio/Scanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* The MIT License (MIT)
55
*
6-
* Copyright (c) 2017 Glenn Ruben Bakke
6+
* Copyright (c) 2019 Dan Halbert for Adafruit Industries
77
* Copyright (c) 2018 Artur Pacholec
88
*
99
* Permission is hereby granted, free of charge, to any person obtaining a copy

0 commit comments

Comments
 (0)