From ee8119779e22c21fe7771a054e4cf6ee921b4352 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 17 May 2019 15:47:12 -0400 Subject: WIP --- shared-bindings/bleio/Scanner.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'shared-bindings/bleio/Scanner.c') 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; -- cgit v1.2.3