mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-09-06 17:50:20 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ed4df282b1 | ||
|
00154f2b51 | ||
|
dc2ee5a22f | ||
|
caa344ecbb | ||
|
0f9ccd3b63 |
11
README.md
11
README.md
@@ -102,7 +102,7 @@ Installation
|
||||
|
||||
5. For micro:bit, install Scratch-link hex on your device.
|
||||
|
||||
* Download and unzip the [micro:bit Scratch Hex file](https://downloads.scratch.mit.edu/microbit/scratch-microbit-1.1.0.hex.zip).
|
||||
* Download and unzip the [micro:bit Scratch Hex file](https://downloads.scratch.mit.edu/microbit/scratch-microbit.hex.zip).
|
||||
* Flash the micro:bit over USB with the Scratch Hex File, you will see the
|
||||
five character name of the micro:bit scroll across the screen such as
|
||||
'zo9ev'.
|
||||
@@ -170,6 +170,15 @@ Please file issues to [GitHub issue tracker](https://github.com/kawasaki/pyscrli
|
||||
Releases
|
||||
--------
|
||||
|
||||
Release 0.2.8
|
||||
|
||||
* Supported Microbit More v2
|
||||
|
||||
Release 0.2.7
|
||||
|
||||
* Supported Snap Firefox and Chromium
|
||||
* Added -r option to retry BLE scan
|
||||
|
||||
Release 0.2.6
|
||||
|
||||
* Removed Bluetooth Classic and LEGO Mindstorm EV3 support
|
||||
|
@@ -18,7 +18,7 @@ import traceback
|
||||
import argparse
|
||||
|
||||
# for BLESession (e.g. BBC micro:bit)
|
||||
from bluepy.btle import Scanner, UUID, Peripheral, DefaultDelegate
|
||||
from bluepy.btle import Scanner, UUID, Peripheral, DefaultDelegate, ScanEntry
|
||||
from bluepy.btle import BTLEDisconnectError, BTLEManagementError
|
||||
from pyscrlink import bluepy_helper_cap
|
||||
|
||||
@@ -292,15 +292,19 @@ class BLESession(Session):
|
||||
logger.debug("match...")
|
||||
return True
|
||||
if 'namePrefix' in f:
|
||||
# 0x08: Shortened Local Name
|
||||
deviceName = dev.getValueText(0x08)
|
||||
if not deviceName:
|
||||
continue
|
||||
logger.debug(f"Name of \"{deviceName}\" begins with: \"{f['namePrefix']}\"?")
|
||||
if(deviceName.startswith(f['namePrefix'])):
|
||||
logger.debug("Yes")
|
||||
return True
|
||||
logger.debug("No")
|
||||
logger.debug(f"given namePrefix: {f['namePrefix']}")
|
||||
deviceName = dev.getValueText(ScanEntry.SHORT_LOCAL_NAME)
|
||||
if deviceName:
|
||||
logger.debug(f"SHORT_LOCAL_NAME: {deviceName}")
|
||||
if deviceName.startswith(f['namePrefix']):
|
||||
logger.debug(f"match...")
|
||||
return True
|
||||
deviceName = dev.getValueText(ScanEntry.COMPLETE_LOCAL_NAME)
|
||||
if deviceName:
|
||||
logger.debug(f"COMPLETE_LOCAL_NAME: {deviceName}")
|
||||
if deviceName.startswith(f['namePrefix']):
|
||||
logger.debug(f"match...")
|
||||
return True
|
||||
if 'name' in f or 'manufactureData' in f:
|
||||
logger.error("name/manufactureData filters not implemented")
|
||||
# TODO: implement other filters defined:
|
||||
|
Reference in New Issue
Block a user