|
3 | 3 | * |
4 | 4 | * The MIT License (MIT) |
5 | 5 | * |
| 6 | + * Copyright (c) 2019 Dan Halbert for Adafruit Industries |
6 | 7 | * Copyright (c) 2018 Artur Pacholec |
7 | 8 | * |
8 | 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
32 | 33 | #define DEFAULT_INTERVAL 100 |
33 | 34 | #define DEFAULT_WINDOW 100 |
34 | 35 |
|
35 | | -// Work-in-progress: orphaned for now. |
36 | | -//| :orphan: |
37 | | -//| |
38 | 36 | //| .. currentmodule:: bleio |
39 | 37 | //| |
40 | 38 | //| :class:`Scanner` -- scan for nearby BLE devices |
|
46 | 44 | //| |
47 | 45 | //| import bleio |
48 | 46 | //| scanner = bleio.Scanner() |
49 | | -//| entries = scanner.scan(2500) |
| 47 | +//| entries = scanner.scan(2.5) # Scan for 2.5 seconds |
50 | 48 | //| print(entries) |
51 | 49 | //| |
52 | 50 |
|
|
57 | 55 |
|
58 | 56 | //| .. attribute:: interval |
59 | 57 | //| |
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. |
62 | 60 | //| |
63 | 61 |
|
64 | 62 | //| .. attribute:: window |
65 | 63 | //| |
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. |
68 | 66 | //| |
69 | 67 |
|
70 | 68 | //| .. method:: scan(timeout) |
71 | 69 | //| |
72 | 70 | //| Performs a BLE scan. |
73 | 71 | //| |
74 | | -//| :param int timeout: the scan timeout in ms |
| 72 | +//| :param float timeout: the scan timeout in seconds |
75 | 73 | //| :returns: advertising packets found |
76 | 74 | //| :rtype: list of :py:class:`bleio.ScanEntry` |
77 | 75 | //| |
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 | | - |
84 | 76 | 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) { |
85 | 77 | mp_arg_check_num(n_args, kw_args, 0, 0, false); |
86 | 78 |
|
| 79 | + |
87 | 80 | bleio_scanner_obj_t *self = m_new_obj(bleio_scanner_obj_t); |
88 | 81 | self->base.type = type; |
89 | 82 |
|
|
0 commit comments