Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

Please see the comment of def services() in device.py

    # Search for all services (optionally by uuid).
    # Use with `async for`, e.g.
    #     async for service in device.services():
    # Note: must allow the loop to run to completion.

An example code:

import asyncio
import aioble
import bluetooth

_TARGET_NAME = "mpy-nus"
_SERVICE_UUID = bluetooth.UUID("6e400001-b5a3-f393-e0a9-e50e24dcca9e")

async def discover_device(target_name):
    # Scan for 20 seconds, in active mode, with very low interval/window (to maximise detection rate).
    async with aioble.scan(duration_ms=20_000, interval_us=30000, window_us=30000, active=True) as scanner:
        async for result in scanner:
    …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@colinc3e
Comment options

Answer selected by Josverl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants