Created
July 26, 2024 16:04
-
-
Save Langerz82/8558cbfad835d43f3a14719c25dbdeec to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python | |
import signal | |
from bluetool.agent import Client, AgentSvr | |
class MyClient(Client): | |
def request_pin_code(self, dev_info): | |
print(dev_info) | |
return raw_input("Input pin code:") | |
def request_passkey(self, dev_info): | |
print(dev_info) | |
return raw_input("Input passkey:") | |
def request_confirmation(self, dev_info, *args): | |
print(dev_info, args) | |
return raw_input("Input 'yes' to accept request:") == "yes" | |
def request_authorization(self, dev_info): | |
print(dev_info) | |
return true | |
# return raw_input("Input 'yes' to accept request:") == "yes" | |
def handler(signum, frame): | |
svr.shutdown() | |
svr = AgentSvr(client_class=MyClient) | |
signal.signal(signal.SIGINT, handler) | |
signal.signal(signal.SIGTERM, handler) | |
svr.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment