-
Notifications
You must be signed in to change notification settings - Fork 127
/
pair.py
35 lines (28 loc) · 845 Bytes
/
pair.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
import argparse
from core import BluezTarget, BluezAddressType, pair
def main():
parser = argparse.ArgumentParser(
prog="No interaction pairing",
description="Try to pair to a device without user interaction",
)
parser.add_argument(
"-a",
"--target-address",
help="Target device MAC address",
required=True,
dest="address",
)
parser.add_argument(
"-t",
"--target-address-type",
help="Target device MAC address type",
dest="address_type",
type=lambda t: BluezAddressType[t],
choices=list(BluezAddressType),
default=BluezAddressType.BR_EDR,
)
args = parser.parse_args()
pair(BluezTarget(args.address, args.address_type), verbose=True)
if __name__ == "__main__":
main()