1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/hciconfig.md

363 lines
5.9 KiB
Markdown
Raw Normal View History

[Home](https://kellyjonbrazil.github.io/jc/)
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.hciconfig"></a>
2021-02-09 16:03:00 -08:00
# jc.parsers.hciconfig
2022-01-25 17:07:47 -08:00
2021-02-09 16:03:00 -08:00
jc - JSON CLI output utility `hciconfig` command output parser
Usage (cli):
2022-01-25 17:07:47 -08:00
$ hciconfig | jc --hciconfig
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
or
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
$ jc hciconfig
2021-02-09 16:03:00 -08:00
Usage (module):
2022-01-25 17:07:47 -08:00
import jc
result = jc.parse('hciconfig', hciconfig_command_output)
2022-01-18 15:38:03 -08:00
2022-01-25 17:07:47 -08:00
or
2022-01-18 15:38:03 -08:00
2022-01-25 17:07:47 -08:00
import jc.parsers.hciconfig
result = jc.parsers.hciconfig.parse(hciconfig_command_output)
2021-02-09 16:03:00 -08:00
2021-04-08 12:42:01 -07:00
Schema:
2022-01-25 17:07:47 -08:00
[
{
"device": string,
"type": string,
"bus": string,
"bd_address": string,
"acl_mtu": integer,
"acl_mtu_packets": integer,
"sco_mtu": integer,
"sco_mtu_packets": integer,
"state": [
string
],
"rx_bytes": integer,
"rx_acl": integer,
"rx_sco": integer,
"rx_events": integer,
"rx_errors": integer,
"tx_bytes": integer,
"tx_acl": integer,
"tx_sco": integer,
"tx_commands": integer,
"tx_errors": integer,
"features": [
string
],
"packet_type": [
string
],
"link_policy": [
string
],
"link_mode": [
string
],
"name": string,
"class": string,
"service_classes": [
string # 'Unspecified' is null
],
"device_class": string,
"hci_version": string,
"hci_revision": string,
"lmp_version": string,
"lmp_subversion": string,
"manufacturer": string
}
]
2021-04-08 12:42:01 -07:00
2022-01-25 17:07:47 -08:00
**Examples**:
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
$ hciconfig -a | jc --hciconfig -p
[
{
- `"device"` - "hci0",
- `"type"` - "Primary",
- `"bus"` - "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13",
- `"acl_mtu"` - 310,
- `"acl_mtu_packets"` - 10,
- `"sco_mtu"` - 64,
- `"sco_mtu_packets"` - 8,
- `"state"` - [
"UP",
"RUNNING"
],
- `"rx_bytes"` - 13905869,
- `"rx_acl"` - 0,
- `"rx_sco"` - 0,
- `"rx_events"` - 393300,
- `"rx_errors"` - 0,
- `"tx_bytes"` - 62629,
- `"tx_acl"` - 0,
- `"tx_sco"` - 0,
- `"tx_commands"` - 3893,
- `"tx_errors"` - 0,
- `"features"` - [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
- `"packet_type"` - [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
- `"link_policy"` - [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
- `"link_mode"` - [
"SLAVE",
"ACCEPT"
],
- `"name"` - "CSR8510 A10",
- `"class"` - "0x000000",
- `"service_classes"` - null,
- `"device_class"` - "Miscellaneous",
- `"hci_version"` - "4.0 (0x6)",
- `"hci_revision"` - "0x22bb",
- `"lmp_version"` - "4.0 (0x6)",
- `"lmp_subversion"` - "0x22bb",
- `"manufacturer"` - "Cambridge Silicon Radio (10)"
},
{
- `"device"` - "hci1",
- `"type"` - "Primary",
- `"bus"` - "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13",
- `"acl_mtu"` - 310,
- `"acl_mtu_packets"` - 10,
- `"sco_mtu"` - 64,
- `"sco_mtu_packets"` - 8,
- `"state"` - [
"DOWN"
],
- `"rx_bytes"` - 4388363,
- `"rx_acl"` - 0,
- `"rx_sco"` - 0,
- `"rx_events"` - 122021,
- `"rx_errors"` - 0,
- `"tx_bytes"` - 52350,
- `"tx_acl"` - 0,
- `"tx_sco"` - 0,
- `"tx_commands"` - 3480,
- `"tx_errors"` - 2,
- `"features"` - [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
- `"packet_type"` - [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
- `"link_policy"` - [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
- `"link_mode"` - [
"SLAVE",
"ACCEPT"
]
}
]
$ hciconfig -a | jc --hciconfig -p -r
[
{
- `"device"` - "hci0",
- `"type"` - "Primary",
- `"bus"` - "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13",
- `"acl_mtu"` - "310",
- `"acl_mtu_packets"` - "10",
- `"sco_mtu"` - "64",
- `"sco_mtu_packets"` - "8",
- `"state"` - [
"UP",
"RUNNING"
],
- `"rx_bytes"` - "13905869",
- `"rx_acl"` - "0",
- `"rx_sco"` - "0",
- `"rx_events"` - "393300",
- `"rx_errors"` - "0",
- `"tx_bytes"` - "62629",
- `"tx_acl"` - "0",
- `"tx_sco"` - "0",
- `"tx_commands"` - "3893",
- `"tx_errors"` - "0",
- `"features"` - [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
- `"packet_type"` - [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
- `"link_policy"` - [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
- `"link_mode"` - [
"SLAVE",
"ACCEPT"
],
- `"name"` - "CSR8510 A10",
- `"class"` - "0x000000",
- `"service_classes"` - [
"Unspecified"
],
- `"device_class"` - "Miscellaneous",
- `"hci_version"` - "4.0 (0x6)",
- `"hci_revision"` - "0x22bb",
- `"lmp_version"` - "4.0 (0x6)",
- `"lmp_subversion"` - "0x22bb",
- `"manufacturer"` - "Cambridge Silicon Radio (10)"
},
{
- `"device"` - "hci1",
- `"type"` - "Primary",
- `"bus"` - "USB",
- `"bd_address"` - "00:1A:7D:DA:71:13",
- `"acl_mtu"` - "310",
- `"acl_mtu_packets"` - "10",
- `"sco_mtu"` - "64",
- `"sco_mtu_packets"` - "8",
- `"state"` - [
"DOWN"
],
- `"rx_bytes"` - "4388363",
- `"rx_acl"` - "0",
- `"rx_sco"` - "0",
- `"rx_events"` - "122021",
- `"rx_errors"` - "0",
- `"tx_bytes"` - "52350",
- `"tx_acl"` - "0",
- `"tx_sco"` - "0",
- `"tx_commands"` - "3480",
- `"tx_errors"` - "2",
- `"features"` - [
"0xff",
"0xff",
"0x8f",
"0xfe",
"0xdb",
"0xff",
"0x5b",
"0x87"
],
- `"packet_type"` - [
"DM1",
"DM3",
"DM5",
"DH1",
"DH3",
"DH5",
"HV1",
"HV2",
"HV3"
],
- `"link_policy"` - [
"RSWITCH",
"HOLD",
"SNIFF",
"PARK"
],
- `"link_mode"` - [
"SLAVE",
"ACCEPT"
]
}
]
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.hciconfig.info"></a>
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
## info Objects
2021-02-09 16:03:00 -08:00
```python
2022-01-25 17:07:47 -08:00
class info()
2021-02-09 16:03:00 -08:00
```
2022-01-25 17:07:47 -08:00
2021-04-08 12:42:01 -07:00
Provides parser metadata (version, author, etc.)
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.hciconfig.parse"></a>
#### parse
2021-02-09 16:03:00 -08:00
```python
2022-01-25 17:07:47 -08:00
def parse(data, raw=False, quiet=False)
2021-02-09 16:03:00 -08:00
```
Main text parsing function
2022-01-25 17:07:47 -08:00
**Arguments**:
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
- `data` - (string) text data to parse
- `raw` - (boolean) unprocessed output if True
- `quiet` - (boolean) suppress warning messages if True
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
**Returns**:
2021-02-09 16:03:00 -08:00
2022-01-25 17:07:47 -08:00
List of Dictionaries. Raw or processed structured data.
2021-02-09 16:03:00 -08:00
## Parser Information
Compatibility: linux
2021-12-01 16:12:51 -08:00
Version 1.3 by Kelly Brazil (kellyjonbrazil@gmail.com)