File: sync_list_commands.py

package info (click to toggle)
python-btsocket 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 232 kB
  • sloc: python: 1,687; sh: 20; makefile: 6
file content (19 lines) | stat: -rw-r--r-- 609 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from btsocket import btmgmt_sync

data = btmgmt_sync.send('ReadManagementSupportedCommands', None)
print(f'Raw response: {data}')
print('Command Code |        Command Name            | Command Parameters')
print('=' * 65)

for cmd in data.cmd_response_frame.command:
    try:
        params = btmgmt_sync.btmgmt_protocol.cmds[cmd]
        required_params = [param.name for param in params.shape]
    except KeyError:
        required_params = None

    try:
        print(f'{cmd:<12} | {btmgmt_sync.btmgmt_protocol.Commands(cmd):30} | '
              f'{required_params}')
    except ValueError:
        pass