zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# DO NOT EDIT THIS FILE!
#
# This file is generated from the CDP specification. If you need to make
# changes, edit the generator and regenerate all of the modules.
#
# CDP domain: Tethering (experimental)
from __future__ import annotations
from .util import event_class, T_JSON_DICT
from dataclasses import dataclass
import enum
import typing
 
def bind(
        port: int
    ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
    '''
    Request browser port binding.
 
    :param port: Port number to bind.
    '''
    params: T_JSON_DICT = dict()
    params['port'] = port
    cmd_dict: T_JSON_DICT = {
        'method': 'Tethering.bind',
        'params': params,
    }
    json = yield cmd_dict
 
 
def unbind(
        port: int
    ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
    '''
    Request browser port unbinding.
 
    :param port: Port number to unbind.
    '''
    params: T_JSON_DICT = dict()
    params['port'] = port
    cmd_dict: T_JSON_DICT = {
        'method': 'Tethering.unbind',
        'params': params,
    }
    json = yield cmd_dict
 
 
@event_class('Tethering.accepted')
@dataclass
class Accepted:
    '''
    Informs that port was successfully bound and got a specified connection id.
    '''
    #: Port number that was successfully bound.
    port: int
    #: Connection id to be used.
    connection_id: str
 
    @classmethod
    def from_json(cls, json: T_JSON_DICT) -> Accepted:
        return cls(
            port=int(json['port']),
            connection_id=str(json['connectionId'])
        )