parsek-cdp 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- parsek_cdp/__init__.py +55 -0
- parsek_cdp/_logging.py +49 -0
- parsek_cdp/cdp/__init__.py +247 -0
- parsek_cdp/cdp/accessibility/__init__.py +15 -0
- parsek_cdp/cdp/accessibility/events.py +35 -0
- parsek_cdp/cdp/accessibility/functions.py +202 -0
- parsek_cdp/cdp/accessibility/types.py +235 -0
- parsek_cdp/cdp/animation/__init__.py +15 -0
- parsek_cdp/cdp/animation/events.py +52 -0
- parsek_cdp/cdp/animation/functions.py +140 -0
- parsek_cdp/cdp/animation/types.py +113 -0
- parsek_cdp/cdp/audits/__init__.py +15 -0
- parsek_cdp/cdp/audits/events.py +21 -0
- parsek_cdp/cdp/audits/functions.py +95 -0
- parsek_cdp/cdp/audits/types.py +1051 -0
- parsek_cdp/cdp/autofill/__init__.py +15 -0
- parsek_cdp/cdp/autofill/events.py +27 -0
- parsek_cdp/cdp/autofill/functions.py +64 -0
- parsek_cdp/cdp/autofill/types.py +108 -0
- parsek_cdp/cdp/backgroundservice/__init__.py +15 -0
- parsek_cdp/cdp/backgroundservice/events.py +40 -0
- parsek_cdp/cdp/backgroundservice/functions.py +59 -0
- parsek_cdp/cdp/backgroundservice/types.py +63 -0
- parsek_cdp/cdp/bluetoothemulation/__init__.py +15 -0
- parsek_cdp/cdp/bluetoothemulation/events.py +70 -0
- parsek_cdp/cdp/bluetoothemulation/functions.py +247 -0
- parsek_cdp/cdp/bluetoothemulation/types.py +120 -0
- parsek_cdp/cdp/browser/__init__.py +15 -0
- parsek_cdp/cdp/browser/events.py +46 -0
- parsek_cdp/cdp/browser/functions.py +350 -0
- parsek_cdp/cdp/browser/types.py +158 -0
- parsek_cdp/cdp/cachestorage/__init__.py +15 -0
- parsek_cdp/cdp/cachestorage/events.py +13 -0
- parsek_cdp/cdp/cachestorage/functions.py +126 -0
- parsek_cdp/cdp/cachestorage/types.py +89 -0
- parsek_cdp/cdp/cast/__init__.py +15 -0
- parsek_cdp/cdp/cast/events.py +38 -0
- parsek_cdp/cdp/cast/functions.py +77 -0
- parsek_cdp/cdp/cast/types.py +23 -0
- parsek_cdp/cdp/console/__init__.py +15 -0
- parsek_cdp/cdp/console/events.py +22 -0
- parsek_cdp/cdp/console/functions.py +36 -0
- parsek_cdp/cdp/console/types.py +30 -0
- parsek_cdp/cdp/css/__init__.py +15 -0
- parsek_cdp/cdp/css/events.py +79 -0
- parsek_cdp/cdp/css/functions.py +788 -0
- parsek_cdp/cdp/css/types.py +742 -0
- parsek_cdp/cdp/debugger/__init__.py +15 -0
- parsek_cdp/cdp/debugger/events.py +164 -0
- parsek_cdp/cdp/debugger/functions.py +663 -0
- parsek_cdp/cdp/debugger/types.py +171 -0
- parsek_cdp/cdp/deviceaccess/__init__.py +15 -0
- parsek_cdp/cdp/deviceaccess/events.py +30 -0
- parsek_cdp/cdp/deviceaccess/functions.py +54 -0
- parsek_cdp/cdp/deviceaccess/types.py +28 -0
- parsek_cdp/cdp/deviceorientation/__init__.py +15 -0
- parsek_cdp/cdp/deviceorientation/events.py +13 -0
- parsek_cdp/cdp/deviceorientation/functions.py +35 -0
- parsek_cdp/cdp/deviceorientation/types.py +10 -0
- parsek_cdp/cdp/dom/__init__.py +15 -0
- parsek_cdp/cdp/dom/events.py +228 -0
- parsek_cdp/cdp/dom/functions.py +1033 -0
- parsek_cdp/cdp/dom/types.py +293 -0
- parsek_cdp/cdp/domdebugger/__init__.py +15 -0
- parsek_cdp/cdp/domdebugger/events.py +13 -0
- parsek_cdp/cdp/domdebugger/functions.py +155 -0
- parsek_cdp/cdp/domdebugger/types.py +57 -0
- parsek_cdp/cdp/domsnapshot/__init__.py +15 -0
- parsek_cdp/cdp/domsnapshot/events.py +13 -0
- parsek_cdp/cdp/domsnapshot/functions.py +111 -0
- parsek_cdp/cdp/domsnapshot/types.py +312 -0
- parsek_cdp/cdp/domstorage/__init__.py +15 -0
- parsek_cdp/cdp/domstorage/events.py +60 -0
- parsek_cdp/cdp/domstorage/functions.py +79 -0
- parsek_cdp/cdp/domstorage/types.py +30 -0
- parsek_cdp/cdp/emulation/__init__.py +15 -0
- parsek_cdp/cdp/emulation/events.py +17 -0
- parsek_cdp/cdp/emulation/functions.py +688 -0
- parsek_cdp/cdp/emulation/types.py +305 -0
- parsek_cdp/cdp/eventbreakpoints/__init__.py +15 -0
- parsek_cdp/cdp/eventbreakpoints/events.py +13 -0
- parsek_cdp/cdp/eventbreakpoints/functions.py +41 -0
- parsek_cdp/cdp/eventbreakpoints/types.py +10 -0
- parsek_cdp/cdp/extensions/__init__.py +15 -0
- parsek_cdp/cdp/extensions/events.py +13 -0
- parsek_cdp/cdp/extensions/functions.py +118 -0
- parsek_cdp/cdp/extensions/types.py +19 -0
- parsek_cdp/cdp/fedcm/__init__.py +15 -0
- parsek_cdp/cdp/fedcm/events.py +45 -0
- parsek_cdp/cdp/fedcm/functions.py +93 -0
- parsek_cdp/cdp/fedcm/types.py +72 -0
- parsek_cdp/cdp/fetch/__init__.py +15 -0
- parsek_cdp/cdp/fetch/events.py +82 -0
- parsek_cdp/cdp/fetch/functions.py +215 -0
- parsek_cdp/cdp/fetch/types.py +81 -0
- parsek_cdp/cdp/filesystem/__init__.py +15 -0
- parsek_cdp/cdp/filesystem/events.py +13 -0
- parsek_cdp/cdp/filesystem/functions.py +36 -0
- parsek_cdp/cdp/filesystem/types.py +54 -0
- parsek_cdp/cdp/headlessexperimental/__init__.py +15 -0
- parsek_cdp/cdp/headlessexperimental/events.py +13 -0
- parsek_cdp/cdp/headlessexperimental/functions.py +77 -0
- parsek_cdp/cdp/headlessexperimental/types.py +24 -0
- parsek_cdp/cdp/heapprofiler/__init__.py +15 -0
- parsek_cdp/cdp/heapprofiler/events.py +65 -0
- parsek_cdp/cdp/heapprofiler/functions.py +193 -0
- parsek_cdp/cdp/heapprofiler/types.py +57 -0
- parsek_cdp/cdp/indexeddb/__init__.py +15 -0
- parsek_cdp/cdp/indexeddb/events.py +13 -0
- parsek_cdp/cdp/indexeddb/functions.py +232 -0
- parsek_cdp/cdp/indexeddb/types.py +120 -0
- parsek_cdp/cdp/input/__init__.py +15 -0
- parsek_cdp/cdp/input/events.py +25 -0
- parsek_cdp/cdp/input/functions.py +361 -0
- parsek_cdp/cdp/input/types.py +87 -0
- parsek_cdp/cdp/inspector/__init__.py +15 -0
- parsek_cdp/cdp/inspector/events.py +41 -0
- parsek_cdp/cdp/inspector/functions.py +27 -0
- parsek_cdp/cdp/inspector/types.py +10 -0
- parsek_cdp/cdp/io/__init__.py +15 -0
- parsek_cdp/cdp/io/events.py +13 -0
- parsek_cdp/cdp/io/functions.py +77 -0
- parsek_cdp/cdp/io/types.py +13 -0
- parsek_cdp/cdp/layertree/__init__.py +15 -0
- parsek_cdp/cdp/layertree/events.py +36 -0
- parsek_cdp/cdp/layertree/functions.py +178 -0
- parsek_cdp/cdp/layertree/types.py +104 -0
- parsek_cdp/cdp/log/__init__.py +15 -0
- parsek_cdp/cdp/log/events.py +22 -0
- parsek_cdp/cdp/log/functions.py +54 -0
- parsek_cdp/cdp/log/types.py +57 -0
- parsek_cdp/cdp/media/__init__.py +15 -0
- parsek_cdp/cdp/media/events.py +87 -0
- parsek_cdp/cdp/media/functions.py +27 -0
- parsek_cdp/cdp/media/types.py +101 -0
- parsek_cdp/cdp/memory/__init__.py +15 -0
- parsek_cdp/cdp/memory/events.py +13 -0
- parsek_cdp/cdp/memory/functions.py +164 -0
- parsek_cdp/cdp/memory/types.py +71 -0
- parsek_cdp/cdp/mixins/__init__.py +21 -0
- parsek_cdp/cdp/mixins/datatype.py +123 -0
- parsek_cdp/cdp/mixins/event.py +78 -0
- parsek_cdp/cdp/mixins/namespace.py +31 -0
- parsek_cdp/cdp/network/__init__.py +15 -0
- parsek_cdp/cdp/network/events.py +726 -0
- parsek_cdp/cdp/network/functions.py +734 -0
- parsek_cdp/cdp/network/types.py +1247 -0
- parsek_cdp/cdp/overlay/__init__.py +15 -0
- parsek_cdp/cdp/overlay/events.py +54 -0
- parsek_cdp/cdp/overlay/functions.py +407 -0
- parsek_cdp/cdp/overlay/types.py +328 -0
- parsek_cdp/cdp/page/__init__.py +15 -0
- parsek_cdp/cdp/page/events.py +416 -0
- parsek_cdp/cdp/page/functions.py +1081 -0
- parsek_cdp/cdp/page/types.py +1088 -0
- parsek_cdp/cdp/performance/__init__.py +15 -0
- parsek_cdp/cdp/performance/events.py +24 -0
- parsek_cdp/cdp/performance/functions.py +63 -0
- parsek_cdp/cdp/performance/types.py +22 -0
- parsek_cdp/cdp/performancetimeline/__init__.py +15 -0
- parsek_cdp/cdp/performancetimeline/events.py +22 -0
- parsek_cdp/cdp/performancetimeline/functions.py +30 -0
- parsek_cdp/cdp/performancetimeline/types.py +85 -0
- parsek_cdp/cdp/preload/__init__.py +15 -0
- parsek_cdp/cdp/preload/events.py +116 -0
- parsek_cdp/cdp/preload/functions.py +25 -0
- parsek_cdp/cdp/preload/types.py +267 -0
- parsek_cdp/cdp/profiler/__init__.py +15 -0
- parsek_cdp/cdp/profiler/events.py +64 -0
- parsek_cdp/cdp/profiler/functions.py +134 -0
- parsek_cdp/cdp/profiler/types.py +105 -0
- parsek_cdp/cdp/pwa/__init__.py +15 -0
- parsek_cdp/cdp/pwa/events.py +13 -0
- parsek_cdp/cdp/pwa/functions.py +196 -0
- parsek_cdp/cdp/pwa/types.py +45 -0
- parsek_cdp/cdp/runtime/__init__.py +15 -0
- parsek_cdp/cdp/runtime/events.py +123 -0
- parsek_cdp/cdp/runtime/functions.py +552 -0
- parsek_cdp/cdp/runtime/types.py +319 -0
- parsek_cdp/cdp/schema/__init__.py +15 -0
- parsek_cdp/cdp/schema/events.py +13 -0
- parsek_cdp/cdp/schema/functions.py +32 -0
- parsek_cdp/cdp/schema/types.py +22 -0
- parsek_cdp/cdp/security/__init__.py +15 -0
- parsek_cdp/cdp/security/events.py +64 -0
- parsek_cdp/cdp/security/functions.py +66 -0
- parsek_cdp/cdp/security/types.py +168 -0
- parsek_cdp/cdp/serviceworker/__init__.py +15 -0
- parsek_cdp/cdp/serviceworker/events.py +43 -0
- parsek_cdp/cdp/serviceworker/functions.py +115 -0
- parsek_cdp/cdp/serviceworker/types.py +95 -0
- parsek_cdp/cdp/storage/__init__.py +15 -0
- parsek_cdp/cdp/storage/events.py +288 -0
- parsek_cdp/cdp/storage/functions.py +571 -0
- parsek_cdp/cdp/storage/types.py +656 -0
- parsek_cdp/cdp/systeminfo/__init__.py +15 -0
- parsek_cdp/cdp/systeminfo/events.py +13 -0
- parsek_cdp/cdp/systeminfo/functions.py +75 -0
- parsek_cdp/cdp/systeminfo/types.py +132 -0
- parsek_cdp/cdp/target/__init__.py +15 -0
- parsek_cdp/cdp/target/events.py +109 -0
- parsek_cdp/cdp/target/functions.py +424 -0
- parsek_cdp/cdp/target/types.py +83 -0
- parsek_cdp/cdp/tethering/__init__.py +15 -0
- parsek_cdp/cdp/tethering/events.py +22 -0
- parsek_cdp/cdp/tethering/functions.py +35 -0
- parsek_cdp/cdp/tethering/types.py +10 -0
- parsek_cdp/cdp/tracing/__init__.py +15 -0
- parsek_cdp/cdp/tracing/events.py +61 -0
- parsek_cdp/cdp/tracing/functions.py +119 -0
- parsek_cdp/cdp/tracing/types.py +81 -0
- parsek_cdp/cdp/webaudio/__init__.py +15 -0
- parsek_cdp/cdp/webaudio/events.py +184 -0
- parsek_cdp/cdp/webaudio/functions.py +51 -0
- parsek_cdp/cdp/webaudio/types.py +155 -0
- parsek_cdp/cdp/webauthn/__init__.py +15 -0
- parsek_cdp/cdp/webauthn/events.py +69 -0
- parsek_cdp/cdp/webauthn/functions.py +214 -0
- parsek_cdp/cdp/webauthn/types.py +96 -0
- parsek_cdp/core/__init__.py +18 -0
- parsek_cdp/core/browser.py +240 -0
- parsek_cdp/core/browser_context.py +58 -0
- parsek_cdp/core/element.py +405 -0
- parsek_cdp/core/feature.py +376 -0
- parsek_cdp/core/frame.py +351 -0
- parsek_cdp/core/pagable.py +175 -0
- parsek_cdp/core/page.py +163 -0
- parsek_cdp/core/target.py +490 -0
- parsek_cdp/features/__init__.py +14 -0
- parsek_cdp/features/request_listener/__init__.py +256 -0
- parsek_cdp/features/request_listener/events.py +48 -0
- parsek_cdp/features/request_listener/types.py +235 -0
- parsek_cdp/generate.py +642 -0
- parsek_cdp/parsek/__init__.py +18 -0
- parsek_cdp/parsek/events.py +38 -0
- parsek_cdp/parsek/types.py +36 -0
- parsek_cdp/py.typed +0 -0
- parsek_cdp-0.1.0.dist-info/METADATA +277 -0
- parsek_cdp-0.1.0.dist-info/RECORD +242 -0
- parsek_cdp-0.1.0.dist-info/WHEEL +5 -0
- parsek_cdp-0.1.0.dist-info/licenses/LICENSE +201 -0
- parsek_cdp-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"""Commands for the BluetoothEmulation domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import DataType, FieldMeta, encode
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from .types import (
|
|
11
|
+
CentralState,
|
|
12
|
+
CharacteristicOperationType,
|
|
13
|
+
CharacteristicProperties,
|
|
14
|
+
DescriptorOperationType,
|
|
15
|
+
GATTOperationType,
|
|
16
|
+
ManufacturerData,
|
|
17
|
+
ScanEntry,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
@dataclass
|
|
21
|
+
class AddServiceReturn(DataType):
|
|
22
|
+
"""Return value of :meth:`BluetoothEmulation.add_service`."""
|
|
23
|
+
service_id: str
|
|
24
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
25
|
+
FieldMeta('service_id', 'serviceId', False, 'primitive'),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass
|
|
30
|
+
class AddCharacteristicReturn(DataType):
|
|
31
|
+
"""Return value of :meth:`BluetoothEmulation.add_characteristic`."""
|
|
32
|
+
characteristic_id: str
|
|
33
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
34
|
+
FieldMeta('characteristic_id', 'characteristicId', False, 'primitive'),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class AddDescriptorReturn(DataType):
|
|
40
|
+
"""Return value of :meth:`BluetoothEmulation.add_descriptor`."""
|
|
41
|
+
descriptor_id: str
|
|
42
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
43
|
+
FieldMeta('descriptor_id', 'descriptorId', False, 'primitive'),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class BluetoothEmulation:
|
|
48
|
+
"""Commands of the BluetoothEmulation domain, bound to a target."""
|
|
49
|
+
|
|
50
|
+
def __init__(self, target: Any) -> None:
|
|
51
|
+
self._target = target
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
async def enable(self, *, state: CentralState, le_supported: bool) -> None:
|
|
55
|
+
"""
|
|
56
|
+
Enable the BluetoothEmulation domain.
|
|
57
|
+
:param state: State of the simulated central.
|
|
58
|
+
:param le_supported: If the simulated central supports low-energy.
|
|
59
|
+
"""
|
|
60
|
+
_params: Dict[str, Any] = {}
|
|
61
|
+
_params['state'] = encode(FieldMeta('', '', False, 'enum', ref='BluetoothEmulation.CentralState'), state)
|
|
62
|
+
_params['leSupported'] = encode(FieldMeta('', '', False, 'primitive'), le_supported)
|
|
63
|
+
_result = await self._target.send('BluetoothEmulation.enable', _params)
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
async def set_simulated_central_state(self, *, state: CentralState) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Set the state of the simulated central.
|
|
69
|
+
:param state: State of the simulated central.
|
|
70
|
+
"""
|
|
71
|
+
_params: Dict[str, Any] = {}
|
|
72
|
+
_params['state'] = encode(FieldMeta('', '', False, 'enum', ref='BluetoothEmulation.CentralState'), state)
|
|
73
|
+
_result = await self._target.send('BluetoothEmulation.setSimulatedCentralState', _params)
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
async def disable(self) -> None:
|
|
77
|
+
"""Disable the BluetoothEmulation domain."""
|
|
78
|
+
_params: Dict[str, Any] = {}
|
|
79
|
+
_result = await self._target.send('BluetoothEmulation.disable', _params)
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
async def simulate_preconnected_peripheral(self, *, address: str, name: str, manufacturer_data: List[ManufacturerData], known_service_uuids: List[str]) -> None:
|
|
83
|
+
"""
|
|
84
|
+
Simulates a peripheral with |address|, |name| and |knownServiceUuids|
|
|
85
|
+
that has already been connected to the system.
|
|
86
|
+
:param address:
|
|
87
|
+
:param name:
|
|
88
|
+
:param manufacturer_data:
|
|
89
|
+
:param known_service_uuids:
|
|
90
|
+
"""
|
|
91
|
+
_params: Dict[str, Any] = {}
|
|
92
|
+
_params['address'] = encode(FieldMeta('', '', False, 'primitive'), address)
|
|
93
|
+
_params['name'] = encode(FieldMeta('', '', False, 'primitive'), name)
|
|
94
|
+
_params['manufacturerData'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'object', ref='BluetoothEmulation.ManufacturerData')), manufacturer_data)
|
|
95
|
+
_params['knownServiceUuids'] = encode(FieldMeta('', '', False, 'array', inner=FieldMeta('', '', False, 'primitive')), known_service_uuids)
|
|
96
|
+
_result = await self._target.send('BluetoothEmulation.simulatePreconnectedPeripheral', _params)
|
|
97
|
+
return None
|
|
98
|
+
|
|
99
|
+
async def simulate_advertisement(self, *, entry: ScanEntry) -> None:
|
|
100
|
+
"""
|
|
101
|
+
Simulates an advertisement packet described in |entry| being received by
|
|
102
|
+
the central.
|
|
103
|
+
:param entry:
|
|
104
|
+
"""
|
|
105
|
+
_params: Dict[str, Any] = {}
|
|
106
|
+
_params['entry'] = encode(FieldMeta('', '', False, 'object', ref='BluetoothEmulation.ScanEntry'), entry)
|
|
107
|
+
_result = await self._target.send('BluetoothEmulation.simulateAdvertisement', _params)
|
|
108
|
+
return None
|
|
109
|
+
|
|
110
|
+
async def simulate_gatt_operation_response(self, *, address: str, type_: GATTOperationType, code: int) -> None:
|
|
111
|
+
"""
|
|
112
|
+
Simulates the response code from the peripheral with |address| for a
|
|
113
|
+
GATT operation of |type|. The |code| value follows the HCI Error Codes from
|
|
114
|
+
Bluetooth Core Specification Vol 2 Part D 1.3 List Of Error Codes.
|
|
115
|
+
:param address:
|
|
116
|
+
:param type_:
|
|
117
|
+
:param code:
|
|
118
|
+
"""
|
|
119
|
+
_params: Dict[str, Any] = {}
|
|
120
|
+
_params['address'] = encode(FieldMeta('', '', False, 'primitive'), address)
|
|
121
|
+
_params['type'] = encode(FieldMeta('', '', False, 'enum', ref='BluetoothEmulation.GATTOperationType'), type_)
|
|
122
|
+
_params['code'] = encode(FieldMeta('', '', False, 'primitive'), code)
|
|
123
|
+
_result = await self._target.send('BluetoothEmulation.simulateGATTOperationResponse', _params)
|
|
124
|
+
return None
|
|
125
|
+
|
|
126
|
+
async def simulate_characteristic_operation_response(self, *, characteristic_id: str, type_: CharacteristicOperationType, code: int, data: Optional[str] = None) -> None:
|
|
127
|
+
"""
|
|
128
|
+
Simulates the response from the characteristic with |characteristicId| for a
|
|
129
|
+
characteristic operation of |type|. The |code| value follows the Error
|
|
130
|
+
Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
|
|
131
|
+
The |data| is expected to exist when simulating a successful read operation
|
|
132
|
+
response.
|
|
133
|
+
:param characteristic_id:
|
|
134
|
+
:param type_:
|
|
135
|
+
:param code:
|
|
136
|
+
:param data:
|
|
137
|
+
"""
|
|
138
|
+
_params: Dict[str, Any] = {}
|
|
139
|
+
_params['characteristicId'] = encode(FieldMeta('', '', False, 'primitive'), characteristic_id)
|
|
140
|
+
_params['type'] = encode(FieldMeta('', '', False, 'enum', ref='BluetoothEmulation.CharacteristicOperationType'), type_)
|
|
141
|
+
_params['code'] = encode(FieldMeta('', '', False, 'primitive'), code)
|
|
142
|
+
if data is not None:
|
|
143
|
+
_params['data'] = encode(FieldMeta('', '', False, 'primitive'), data)
|
|
144
|
+
_result = await self._target.send('BluetoothEmulation.simulateCharacteristicOperationResponse', _params)
|
|
145
|
+
return None
|
|
146
|
+
|
|
147
|
+
async def simulate_descriptor_operation_response(self, *, descriptor_id: str, type_: DescriptorOperationType, code: int, data: Optional[str] = None) -> None:
|
|
148
|
+
"""
|
|
149
|
+
Simulates the response from the descriptor with |descriptorId| for a
|
|
150
|
+
descriptor operation of |type|. The |code| value follows the Error
|
|
151
|
+
Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response.
|
|
152
|
+
The |data| is expected to exist when simulating a successful read operation
|
|
153
|
+
response.
|
|
154
|
+
:param descriptor_id:
|
|
155
|
+
:param type_:
|
|
156
|
+
:param code:
|
|
157
|
+
:param data:
|
|
158
|
+
"""
|
|
159
|
+
_params: Dict[str, Any] = {}
|
|
160
|
+
_params['descriptorId'] = encode(FieldMeta('', '', False, 'primitive'), descriptor_id)
|
|
161
|
+
_params['type'] = encode(FieldMeta('', '', False, 'enum', ref='BluetoothEmulation.DescriptorOperationType'), type_)
|
|
162
|
+
_params['code'] = encode(FieldMeta('', '', False, 'primitive'), code)
|
|
163
|
+
if data is not None:
|
|
164
|
+
_params['data'] = encode(FieldMeta('', '', False, 'primitive'), data)
|
|
165
|
+
_result = await self._target.send('BluetoothEmulation.simulateDescriptorOperationResponse', _params)
|
|
166
|
+
return None
|
|
167
|
+
|
|
168
|
+
async def add_service(self, *, address: str, service_uuid: str) -> AddServiceReturn:
|
|
169
|
+
"""
|
|
170
|
+
Adds a service with |serviceUuid| to the peripheral with |address|.
|
|
171
|
+
:param address:
|
|
172
|
+
:param service_uuid:
|
|
173
|
+
"""
|
|
174
|
+
_params: Dict[str, Any] = {}
|
|
175
|
+
_params['address'] = encode(FieldMeta('', '', False, 'primitive'), address)
|
|
176
|
+
_params['serviceUuid'] = encode(FieldMeta('', '', False, 'primitive'), service_uuid)
|
|
177
|
+
_result = await self._target.send('BluetoothEmulation.addService', _params)
|
|
178
|
+
return AddServiceReturn.from_json(_result)
|
|
179
|
+
|
|
180
|
+
async def remove_service(self, *, service_id: str) -> None:
|
|
181
|
+
"""
|
|
182
|
+
Removes the service respresented by |serviceId| from the simulated central.
|
|
183
|
+
:param service_id:
|
|
184
|
+
"""
|
|
185
|
+
_params: Dict[str, Any] = {}
|
|
186
|
+
_params['serviceId'] = encode(FieldMeta('', '', False, 'primitive'), service_id)
|
|
187
|
+
_result = await self._target.send('BluetoothEmulation.removeService', _params)
|
|
188
|
+
return None
|
|
189
|
+
|
|
190
|
+
async def add_characteristic(self, *, service_id: str, characteristic_uuid: str, properties: CharacteristicProperties) -> AddCharacteristicReturn:
|
|
191
|
+
"""
|
|
192
|
+
Adds a characteristic with |characteristicUuid| and |properties| to the
|
|
193
|
+
service represented by |serviceId|.
|
|
194
|
+
:param service_id:
|
|
195
|
+
:param characteristic_uuid:
|
|
196
|
+
:param properties:
|
|
197
|
+
"""
|
|
198
|
+
_params: Dict[str, Any] = {}
|
|
199
|
+
_params['serviceId'] = encode(FieldMeta('', '', False, 'primitive'), service_id)
|
|
200
|
+
_params['characteristicUuid'] = encode(FieldMeta('', '', False, 'primitive'), characteristic_uuid)
|
|
201
|
+
_params['properties'] = encode(FieldMeta('', '', False, 'object', ref='BluetoothEmulation.CharacteristicProperties'), properties)
|
|
202
|
+
_result = await self._target.send('BluetoothEmulation.addCharacteristic', _params)
|
|
203
|
+
return AddCharacteristicReturn.from_json(_result)
|
|
204
|
+
|
|
205
|
+
async def remove_characteristic(self, *, characteristic_id: str) -> None:
|
|
206
|
+
"""
|
|
207
|
+
Removes the characteristic respresented by |characteristicId| from the
|
|
208
|
+
simulated central.
|
|
209
|
+
:param characteristic_id:
|
|
210
|
+
"""
|
|
211
|
+
_params: Dict[str, Any] = {}
|
|
212
|
+
_params['characteristicId'] = encode(FieldMeta('', '', False, 'primitive'), characteristic_id)
|
|
213
|
+
_result = await self._target.send('BluetoothEmulation.removeCharacteristic', _params)
|
|
214
|
+
return None
|
|
215
|
+
|
|
216
|
+
async def add_descriptor(self, *, characteristic_id: str, descriptor_uuid: str) -> AddDescriptorReturn:
|
|
217
|
+
"""
|
|
218
|
+
Adds a descriptor with |descriptorUuid| to the characteristic respresented
|
|
219
|
+
by |characteristicId|.
|
|
220
|
+
:param characteristic_id:
|
|
221
|
+
:param descriptor_uuid:
|
|
222
|
+
"""
|
|
223
|
+
_params: Dict[str, Any] = {}
|
|
224
|
+
_params['characteristicId'] = encode(FieldMeta('', '', False, 'primitive'), characteristic_id)
|
|
225
|
+
_params['descriptorUuid'] = encode(FieldMeta('', '', False, 'primitive'), descriptor_uuid)
|
|
226
|
+
_result = await self._target.send('BluetoothEmulation.addDescriptor', _params)
|
|
227
|
+
return AddDescriptorReturn.from_json(_result)
|
|
228
|
+
|
|
229
|
+
async def remove_descriptor(self, *, descriptor_id: str) -> None:
|
|
230
|
+
"""
|
|
231
|
+
Removes the descriptor with |descriptorId| from the simulated central.
|
|
232
|
+
:param descriptor_id:
|
|
233
|
+
"""
|
|
234
|
+
_params: Dict[str, Any] = {}
|
|
235
|
+
_params['descriptorId'] = encode(FieldMeta('', '', False, 'primitive'), descriptor_id)
|
|
236
|
+
_result = await self._target.send('BluetoothEmulation.removeDescriptor', _params)
|
|
237
|
+
return None
|
|
238
|
+
|
|
239
|
+
async def simulate_gatt_disconnection(self, *, address: str) -> None:
|
|
240
|
+
"""
|
|
241
|
+
Simulates a GATT disconnection from the peripheral with |address|.
|
|
242
|
+
:param address:
|
|
243
|
+
"""
|
|
244
|
+
_params: Dict[str, Any] = {}
|
|
245
|
+
_params['address'] = encode(FieldMeta('', '', False, 'primitive'), address)
|
|
246
|
+
_result = await self._target.send('BluetoothEmulation.simulateGATTDisconnection', _params)
|
|
247
|
+
return None
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Custom types and enums for the BluetoothEmulation domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Any, ClassVar, Dict, List, Literal, Optional
|
|
7
|
+
|
|
8
|
+
from ..mixins.datatype import DataType, FieldMeta, register
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@register("BluetoothEmulation.CentralState")
|
|
12
|
+
class CentralState(str, Enum):
|
|
13
|
+
"""Indicates the various states of Central."""
|
|
14
|
+
ABSENT = 'absent'
|
|
15
|
+
POWERED_OFF = 'powered-off'
|
|
16
|
+
POWERED_ON = 'powered-on'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@register("BluetoothEmulation.GATTOperationType")
|
|
20
|
+
class GATTOperationType(str, Enum):
|
|
21
|
+
"""Indicates the various types of GATT event."""
|
|
22
|
+
CONNECTION = 'connection'
|
|
23
|
+
DISCOVERY = 'discovery'
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@register("BluetoothEmulation.CharacteristicWriteType")
|
|
27
|
+
class CharacteristicWriteType(str, Enum):
|
|
28
|
+
"""Indicates the various types of characteristic write."""
|
|
29
|
+
WRITE_DEFAULT_DEPRECATED = 'write-default-deprecated'
|
|
30
|
+
WRITE_WITH_RESPONSE = 'write-with-response'
|
|
31
|
+
WRITE_WITHOUT_RESPONSE = 'write-without-response'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@register("BluetoothEmulation.CharacteristicOperationType")
|
|
35
|
+
class CharacteristicOperationType(str, Enum):
|
|
36
|
+
"""Indicates the various types of characteristic operation."""
|
|
37
|
+
READ = 'read'
|
|
38
|
+
WRITE = 'write'
|
|
39
|
+
SUBSCRIBE_TO_NOTIFICATIONS = 'subscribe-to-notifications'
|
|
40
|
+
UNSUBSCRIBE_FROM_NOTIFICATIONS = 'unsubscribe-from-notifications'
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@register("BluetoothEmulation.DescriptorOperationType")
|
|
44
|
+
class DescriptorOperationType(str, Enum):
|
|
45
|
+
"""Indicates the various types of descriptor operation."""
|
|
46
|
+
READ = 'read'
|
|
47
|
+
WRITE = 'write'
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@register("BluetoothEmulation.ManufacturerData")
|
|
51
|
+
@dataclass
|
|
52
|
+
class ManufacturerData(DataType):
|
|
53
|
+
"""Stores the manufacturer data"""
|
|
54
|
+
key: int
|
|
55
|
+
data: str
|
|
56
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
57
|
+
FieldMeta('key', 'key', False, 'primitive'),
|
|
58
|
+
FieldMeta('data', 'data', False, 'primitive'),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@register("BluetoothEmulation.ScanRecord")
|
|
63
|
+
@dataclass
|
|
64
|
+
class ScanRecord(DataType):
|
|
65
|
+
"""Stores the byte data of the advertisement packet sent by a Bluetooth device."""
|
|
66
|
+
name: Optional[str] = None
|
|
67
|
+
uuids: Optional[List[str]] = None
|
|
68
|
+
appearance: Optional[int] = None
|
|
69
|
+
tx_power: Optional[int] = None
|
|
70
|
+
manufacturer_data: Optional[List[ManufacturerData]] = None
|
|
71
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
72
|
+
FieldMeta('name', 'name', True, 'primitive'),
|
|
73
|
+
FieldMeta('uuids', 'uuids', True, 'array', inner=FieldMeta('', '', False, 'primitive')),
|
|
74
|
+
FieldMeta('appearance', 'appearance', True, 'primitive'),
|
|
75
|
+
FieldMeta('tx_power', 'txPower', True, 'primitive'),
|
|
76
|
+
FieldMeta('manufacturer_data', 'manufacturerData', True, 'array', inner=FieldMeta('', '', False, 'object', ref='BluetoothEmulation.ManufacturerData')),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@register("BluetoothEmulation.ScanEntry")
|
|
81
|
+
@dataclass
|
|
82
|
+
class ScanEntry(DataType):
|
|
83
|
+
"""Stores the advertisement packet information that is sent by a Bluetooth device."""
|
|
84
|
+
device_address: str
|
|
85
|
+
rssi: int
|
|
86
|
+
scan_record: ScanRecord
|
|
87
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
88
|
+
FieldMeta('device_address', 'deviceAddress', False, 'primitive'),
|
|
89
|
+
FieldMeta('rssi', 'rssi', False, 'primitive'),
|
|
90
|
+
FieldMeta('scan_record', 'scanRecord', False, 'object', ref='BluetoothEmulation.ScanRecord'),
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@register("BluetoothEmulation.CharacteristicProperties")
|
|
95
|
+
@dataclass
|
|
96
|
+
class CharacteristicProperties(DataType):
|
|
97
|
+
"""
|
|
98
|
+
Describes the properties of a characteristic. This follows Bluetooth Core
|
|
99
|
+
Specification BT 4.2 Vol 3 Part G 3.3.1. Characteristic Properties.
|
|
100
|
+
"""
|
|
101
|
+
broadcast: Optional[bool] = None
|
|
102
|
+
read: Optional[bool] = None
|
|
103
|
+
write_without_response: Optional[bool] = None
|
|
104
|
+
write: Optional[bool] = None
|
|
105
|
+
notify: Optional[bool] = None
|
|
106
|
+
indicate: Optional[bool] = None
|
|
107
|
+
authenticated_signed_writes: Optional[bool] = None
|
|
108
|
+
extended_properties: Optional[bool] = None
|
|
109
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
110
|
+
FieldMeta('broadcast', 'broadcast', True, 'primitive'),
|
|
111
|
+
FieldMeta('read', 'read', True, 'primitive'),
|
|
112
|
+
FieldMeta('write_without_response', 'writeWithoutResponse', True, 'primitive'),
|
|
113
|
+
FieldMeta('write', 'write', True, 'primitive'),
|
|
114
|
+
FieldMeta('notify', 'notify', True, 'primitive'),
|
|
115
|
+
FieldMeta('indicate', 'indicate', True, 'primitive'),
|
|
116
|
+
FieldMeta('authenticated_signed_writes', 'authenticatedSignedWrites', True, 'primitive'),
|
|
117
|
+
FieldMeta('extended_properties', 'extendedProperties', True, 'primitive'),
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
__all__ = ["CentralState", "CharacteristicOperationType", "CharacteristicProperties", "CharacteristicWriteType", "DescriptorOperationType", "GATTOperationType", "ManufacturerData", "ScanEntry", "ScanRecord"]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""The Browser CDP domain (generated).
|
|
2
|
+
|
|
3
|
+
Importing ``Browser`` from ``parsek_cdp.cdp`` gives a namespace with this
|
|
4
|
+
domain's events and types as attributes (``Browser.SomeEvent`` /
|
|
5
|
+
``Browser.SomeType``); commands run on a target via ``page.cdp.Browser``.
|
|
6
|
+
"""
|
|
7
|
+
from . import events, functions, types
|
|
8
|
+
from .functions import Browser
|
|
9
|
+
from .events import * # noqa: F401,F403 -- expose events on the namespace
|
|
10
|
+
from .types import * # noqa: F401,F403 -- expose types on the namespace
|
|
11
|
+
|
|
12
|
+
#: Protocol domain name (used by features that declare ``domains=(Browser,)``).
|
|
13
|
+
DOMAIN = "Browser"
|
|
14
|
+
|
|
15
|
+
__all__ = ["events", "functions", "types", "Browser", "DOMAIN"]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Events for the Browser domain (generated)."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Literal, Optional
|
|
6
|
+
|
|
7
|
+
from ..mixins.datatype import FieldMeta
|
|
8
|
+
from ..mixins.event import Event, register_event
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ..page.types import FrameId as Page_FrameId
|
|
12
|
+
|
|
13
|
+
@register_event("Browser.downloadWillBegin")
|
|
14
|
+
@dataclass
|
|
15
|
+
class DownloadWillBegin(Event):
|
|
16
|
+
"""Fired when page is about to start a download."""
|
|
17
|
+
frame_id: Page_FrameId
|
|
18
|
+
guid: str
|
|
19
|
+
url: str
|
|
20
|
+
suggested_filename: str
|
|
21
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
22
|
+
FieldMeta('frame_id', 'frameId', False, 'primitive'),
|
|
23
|
+
FieldMeta('guid', 'guid', False, 'primitive'),
|
|
24
|
+
FieldMeta('url', 'url', False, 'primitive'),
|
|
25
|
+
FieldMeta('suggested_filename', 'suggestedFilename', False, 'primitive'),
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@register_event("Browser.downloadProgress")
|
|
30
|
+
@dataclass
|
|
31
|
+
class DownloadProgress(Event):
|
|
32
|
+
"""Fired when download makes progress. Last call has |done| == true."""
|
|
33
|
+
guid: str
|
|
34
|
+
total_bytes: float
|
|
35
|
+
received_bytes: float
|
|
36
|
+
state: Literal['inProgress', 'completed', 'canceled']
|
|
37
|
+
file_path: Optional[str] = None
|
|
38
|
+
__FIELDS__: ClassVar[tuple] = (
|
|
39
|
+
FieldMeta('guid', 'guid', False, 'primitive'),
|
|
40
|
+
FieldMeta('total_bytes', 'totalBytes', False, 'primitive'),
|
|
41
|
+
FieldMeta('received_bytes', 'receivedBytes', False, 'primitive'),
|
|
42
|
+
FieldMeta('state', 'state', False, 'primitive'),
|
|
43
|
+
FieldMeta('file_path', 'filePath', True, 'primitive'),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
__all__ = ["DownloadProgress", "DownloadWillBegin"]
|