Created
June 23, 2018 02:10
-
-
Save TakehikoShimojima/d322821fa34afbbee30972a9897d9094 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ScanDelegate(DefaultDelegate): | |
| def __init__(self): | |
| DefaultDelegate.__init__(self) | |
| def handleDiscovery(self, dev, isNewDev, isNewData): # スキャンハンドラー | |
| if isNewDev: # 新しいデバイスが見つかったら | |
| print('found dev (%s)' % dev.addr) | |
| scanner = Scanner().withDelegate(ScanDelegate()) | |
| while True: | |
| scanner.scan(10.0) # スキャンする。デバイスを見つけた後の処理はScanDelegateに任せる |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment