bumble 0.0.199__py3-none-any.whl → 0.0.201__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.
- bumble/_version.py +2 -2
- bumble/a2dp.py +502 -202
- bumble/apps/controller_info.py +60 -0
- bumble/apps/player/player.py +608 -0
- bumble/apps/speaker/speaker.py +25 -27
- bumble/att.py +2 -2
- bumble/avc.py +1 -2
- bumble/avdtp.py +54 -97
- bumble/avrcp.py +48 -29
- bumble/codecs.py +214 -68
- bumble/device.py +19 -11
- bumble/hci.py +31 -5
- bumble/hfp.py +52 -48
- bumble/host.py +12 -0
- bumble/profiles/hap.py +27 -18
- bumble/rtp.py +110 -0
- bumble/transport/android_netsim.py +31 -11
- bumble/transport/grpc_protobuf/netsim/__init__.py +0 -0
- bumble/transport/grpc_protobuf/{common_pb2.py → netsim/common_pb2.py} +9 -8
- bumble/transport/grpc_protobuf/{common_pb2.pyi → netsim/common_pb2.pyi} +11 -5
- bumble/transport/grpc_protobuf/netsim/hci_packet_pb2.py +29 -0
- bumble/transport/grpc_protobuf/{hci_packet_pb2.pyi → netsim/hci_packet_pb2.pyi} +13 -7
- bumble/transport/grpc_protobuf/netsim/model_pb2.py +63 -0
- bumble/transport/grpc_protobuf/netsim/model_pb2.pyi +238 -0
- bumble/transport/grpc_protobuf/netsim/packet_streamer_pb2.py +32 -0
- bumble/transport/grpc_protobuf/{packet_streamer_pb2.pyi → netsim/packet_streamer_pb2.pyi} +6 -6
- bumble/transport/grpc_protobuf/{packet_streamer_pb2_grpc.py → netsim/packet_streamer_pb2_grpc.py} +7 -7
- bumble/transport/grpc_protobuf/netsim/startup_pb2.py +41 -0
- bumble/transport/grpc_protobuf/netsim/startup_pb2.pyi +76 -0
- bumble/transport/grpc_protobuf/netsim/startup_pb2_grpc.py +4 -0
- bumble/transport/grpc_protobuf/rootcanal/__init__.py +0 -0
- bumble/transport/grpc_protobuf/rootcanal/configuration_pb2.py +39 -0
- bumble/transport/grpc_protobuf/rootcanal/configuration_pb2.pyi +78 -0
- bumble/transport/grpc_protobuf/rootcanal/configuration_pb2_grpc.py +4 -0
- bumble/transport/pyusb.py +2 -1
- {bumble-0.0.199.dist-info → bumble-0.0.201.dist-info}/METADATA +2 -2
- {bumble-0.0.199.dist-info → bumble-0.0.201.dist-info}/RECORD +44 -34
- {bumble-0.0.199.dist-info → bumble-0.0.201.dist-info}/WHEEL +1 -1
- {bumble-0.0.199.dist-info → bumble-0.0.201.dist-info}/entry_points.txt +1 -0
- bumble/transport/grpc_protobuf/hci_packet_pb2.py +0 -28
- bumble/transport/grpc_protobuf/packet_streamer_pb2.py +0 -31
- bumble/transport/grpc_protobuf/startup_pb2.py +0 -32
- bumble/transport/grpc_protobuf/startup_pb2.pyi +0 -46
- /bumble/transport/grpc_protobuf/{common_pb2_grpc.py → netsim/common_pb2_grpc.py} +0 -0
- /bumble/transport/grpc_protobuf/{hci_packet_pb2_grpc.py → netsim/hci_packet_pb2_grpc.py} +0 -0
- /bumble/transport/grpc_protobuf/{startup_pb2_grpc.py → netsim/model_pb2_grpc.py} +0 -0
- {bumble-0.0.199.dist-info → bumble-0.0.201.dist-info}/LICENSE +0 -0
- {bumble-0.0.199.dist-info → bumble-0.0.201.dist-info}/top_level.txt +0 -0
bumble/profiles/hap.py
CHANGED
|
@@ -25,7 +25,7 @@ from bumble.utils import AsyncRunner, OpenIntEnum
|
|
|
25
25
|
from bumble.hci import Address
|
|
26
26
|
from dataclasses import dataclass, field
|
|
27
27
|
import logging
|
|
28
|
-
from typing import Dict, List, Optional, Set, Union
|
|
28
|
+
from typing import Any, Dict, List, Optional, Set, Union
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
# -----------------------------------------------------------------------------
|
|
@@ -271,24 +271,12 @@ class HearingAccessService(gatt.TemplateService):
|
|
|
271
271
|
def on_disconnection(_reason) -> None:
|
|
272
272
|
self.currently_connected_clients.remove(connection)
|
|
273
273
|
|
|
274
|
-
#
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
connection.peer_address
|
|
278
|
-
not in self.preset_changed_operations_history_per_device
|
|
279
|
-
):
|
|
280
|
-
self.preset_changed_operations_history_per_device[
|
|
281
|
-
connection.peer_address
|
|
282
|
-
] = []
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
async def on_connection_async() -> None:
|
|
286
|
-
# Send all the PresetChangedOperation that occur when not connected
|
|
287
|
-
await self._preset_changed_operation(connection)
|
|
288
|
-
# Update the active preset index if needed
|
|
289
|
-
await self.notify_active_preset_for_connection(connection)
|
|
274
|
+
@connection.on('pairing') # type: ignore
|
|
275
|
+
def on_pairing(*_: Any) -> None:
|
|
276
|
+
self.on_incoming_paired_connection(connection)
|
|
290
277
|
|
|
291
|
-
connection.
|
|
278
|
+
if connection.peer_resolvable_address:
|
|
279
|
+
self.on_incoming_paired_connection(connection)
|
|
292
280
|
|
|
293
281
|
self.hearing_aid_features_characteristic = gatt.Characteristic(
|
|
294
282
|
uuid=gatt.GATT_HEARING_AID_FEATURES_CHARACTERISTIC,
|
|
@@ -325,6 +313,27 @@ class HearingAccessService(gatt.TemplateService):
|
|
|
325
313
|
]
|
|
326
314
|
)
|
|
327
315
|
|
|
316
|
+
def on_incoming_paired_connection(self, connection: Connection):
|
|
317
|
+
'''Setup initial operations to handle a remote bonded HAP device'''
|
|
318
|
+
# TODO Should we filter on HAP device only ?
|
|
319
|
+
self.currently_connected_clients.add(connection)
|
|
320
|
+
if (
|
|
321
|
+
connection.peer_address
|
|
322
|
+
not in self.preset_changed_operations_history_per_device
|
|
323
|
+
):
|
|
324
|
+
self.preset_changed_operations_history_per_device[
|
|
325
|
+
connection.peer_address
|
|
326
|
+
] = []
|
|
327
|
+
return
|
|
328
|
+
|
|
329
|
+
async def on_connection_async() -> None:
|
|
330
|
+
# Send all the PresetChangedOperation that occur when not connected
|
|
331
|
+
await self._preset_changed_operation(connection)
|
|
332
|
+
# Update the active preset index if needed
|
|
333
|
+
await self.notify_active_preset_for_connection(connection)
|
|
334
|
+
|
|
335
|
+
connection.abort_on('disconnection', on_connection_async())
|
|
336
|
+
|
|
328
337
|
def _on_read_active_preset_index(
|
|
329
338
|
self, __connection__: Optional[Connection]
|
|
330
339
|
) -> bytes:
|
bumble/rtp.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Copyright 2024 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# -----------------------------------------------------------------------------
|
|
16
|
+
# Imports
|
|
17
|
+
# -----------------------------------------------------------------------------
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
import struct
|
|
20
|
+
from typing import List
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# -----------------------------------------------------------------------------
|
|
24
|
+
class MediaPacket:
|
|
25
|
+
@staticmethod
|
|
26
|
+
def from_bytes(data: bytes) -> MediaPacket:
|
|
27
|
+
version = (data[0] >> 6) & 0x03
|
|
28
|
+
padding = (data[0] >> 5) & 0x01
|
|
29
|
+
extension = (data[0] >> 4) & 0x01
|
|
30
|
+
csrc_count = data[0] & 0x0F
|
|
31
|
+
marker = (data[1] >> 7) & 0x01
|
|
32
|
+
payload_type = data[1] & 0x7F
|
|
33
|
+
sequence_number = struct.unpack_from('>H', data, 2)[0]
|
|
34
|
+
timestamp = struct.unpack_from('>I', data, 4)[0]
|
|
35
|
+
ssrc = struct.unpack_from('>I', data, 8)[0]
|
|
36
|
+
csrc_list = [
|
|
37
|
+
struct.unpack_from('>I', data, 12 + i)[0] for i in range(csrc_count)
|
|
38
|
+
]
|
|
39
|
+
payload = data[12 + csrc_count * 4 :]
|
|
40
|
+
|
|
41
|
+
return MediaPacket(
|
|
42
|
+
version,
|
|
43
|
+
padding,
|
|
44
|
+
extension,
|
|
45
|
+
marker,
|
|
46
|
+
sequence_number,
|
|
47
|
+
timestamp,
|
|
48
|
+
ssrc,
|
|
49
|
+
csrc_list,
|
|
50
|
+
payload_type,
|
|
51
|
+
payload,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
def __init__(
|
|
55
|
+
self,
|
|
56
|
+
version: int,
|
|
57
|
+
padding: int,
|
|
58
|
+
extension: int,
|
|
59
|
+
marker: int,
|
|
60
|
+
sequence_number: int,
|
|
61
|
+
timestamp: int,
|
|
62
|
+
ssrc: int,
|
|
63
|
+
csrc_list: List[int],
|
|
64
|
+
payload_type: int,
|
|
65
|
+
payload: bytes,
|
|
66
|
+
) -> None:
|
|
67
|
+
self.version = version
|
|
68
|
+
self.padding = padding
|
|
69
|
+
self.extension = extension
|
|
70
|
+
self.marker = marker
|
|
71
|
+
self.sequence_number = sequence_number & 0xFFFF
|
|
72
|
+
self.timestamp = timestamp & 0xFFFFFFFF
|
|
73
|
+
self.timestamp_seconds = 0.0
|
|
74
|
+
self.ssrc = ssrc
|
|
75
|
+
self.csrc_list = csrc_list
|
|
76
|
+
self.payload_type = payload_type
|
|
77
|
+
self.payload = payload
|
|
78
|
+
|
|
79
|
+
def __bytes__(self) -> bytes:
|
|
80
|
+
header = bytes(
|
|
81
|
+
[
|
|
82
|
+
self.version << 6
|
|
83
|
+
| self.padding << 5
|
|
84
|
+
| self.extension << 4
|
|
85
|
+
| len(self.csrc_list),
|
|
86
|
+
self.marker << 7 | self.payload_type,
|
|
87
|
+
]
|
|
88
|
+
) + struct.pack(
|
|
89
|
+
'>HII',
|
|
90
|
+
self.sequence_number,
|
|
91
|
+
self.timestamp,
|
|
92
|
+
self.ssrc,
|
|
93
|
+
)
|
|
94
|
+
for csrc in self.csrc_list:
|
|
95
|
+
header += struct.pack('>I', csrc)
|
|
96
|
+
return header + self.payload
|
|
97
|
+
|
|
98
|
+
def __str__(self) -> str:
|
|
99
|
+
return (
|
|
100
|
+
f'RTP(v={self.version},'
|
|
101
|
+
f'p={self.padding},'
|
|
102
|
+
f'x={self.extension},'
|
|
103
|
+
f'm={self.marker},'
|
|
104
|
+
f'pt={self.payload_type},'
|
|
105
|
+
f'sn={self.sequence_number},'
|
|
106
|
+
f'ts={self.timestamp},'
|
|
107
|
+
f'ssrc={self.ssrc},'
|
|
108
|
+
f'csrcs={self.csrc_list},'
|
|
109
|
+
f'payload_size={len(self.payload)})'
|
|
110
|
+
)
|
|
@@ -20,12 +20,14 @@ import atexit
|
|
|
20
20
|
import logging
|
|
21
21
|
import os
|
|
22
22
|
import pathlib
|
|
23
|
+
import platform
|
|
23
24
|
import sys
|
|
24
25
|
from typing import Dict, Optional
|
|
25
26
|
|
|
26
27
|
import grpc.aio
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
import bumble
|
|
30
|
+
from bumble.transport.common import (
|
|
29
31
|
ParserSource,
|
|
30
32
|
PumpedTransport,
|
|
31
33
|
PumpedPacketSource,
|
|
@@ -36,15 +38,15 @@ from .common import (
|
|
|
36
38
|
)
|
|
37
39
|
|
|
38
40
|
# pylint: disable=no-name-in-module
|
|
39
|
-
from .grpc_protobuf.packet_streamer_pb2_grpc import (
|
|
41
|
+
from .grpc_protobuf.netsim.packet_streamer_pb2_grpc import (
|
|
40
42
|
PacketStreamerStub,
|
|
41
43
|
PacketStreamerServicer,
|
|
42
44
|
add_PacketStreamerServicer_to_server,
|
|
43
45
|
)
|
|
44
|
-
from .grpc_protobuf.packet_streamer_pb2 import PacketRequest, PacketResponse
|
|
45
|
-
from .grpc_protobuf.hci_packet_pb2 import HCIPacket
|
|
46
|
-
from .grpc_protobuf.startup_pb2 import Chip, ChipInfo
|
|
47
|
-
from .grpc_protobuf.common_pb2 import ChipKind
|
|
46
|
+
from .grpc_protobuf.netsim.packet_streamer_pb2 import PacketRequest, PacketResponse
|
|
47
|
+
from .grpc_protobuf.netsim.hci_packet_pb2 import HCIPacket
|
|
48
|
+
from .grpc_protobuf.netsim.startup_pb2 import Chip, ChipInfo, DeviceInfo
|
|
49
|
+
from .grpc_protobuf.netsim.common_pb2 import ChipKind
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
# -----------------------------------------------------------------------------
|
|
@@ -58,6 +60,7 @@ logger = logging.getLogger(__name__)
|
|
|
58
60
|
# -----------------------------------------------------------------------------
|
|
59
61
|
DEFAULT_NAME = 'bumble0'
|
|
60
62
|
DEFAULT_MANUFACTURER = 'Bumble'
|
|
63
|
+
DEFAULT_VARIANT = ''
|
|
61
64
|
|
|
62
65
|
|
|
63
66
|
# -----------------------------------------------------------------------------
|
|
@@ -70,6 +73,9 @@ def get_ini_dir() -> Optional[pathlib.Path]:
|
|
|
70
73
|
elif sys.platform == 'linux':
|
|
71
74
|
if xdg_runtime_dir := os.environ.get('XDG_RUNTIME_DIR', None):
|
|
72
75
|
return pathlib.Path(xdg_runtime_dir)
|
|
76
|
+
tmpdir = os.environ.get('TMPDIR', '/tmp')
|
|
77
|
+
if pathlib.Path(tmpdir).is_dir():
|
|
78
|
+
return pathlib.Path(tmpdir)
|
|
73
79
|
elif sys.platform == 'win32':
|
|
74
80
|
if local_app_data_dir := os.environ.get('LOCALAPPDATA', None):
|
|
75
81
|
return pathlib.Path(local_app_data_dir) / 'Temp'
|
|
@@ -196,7 +202,6 @@ async def open_android_netsim_controller_transport(
|
|
|
196
202
|
data = (
|
|
197
203
|
bytes([request.hci_packet.packet_type]) + request.hci_packet.packet
|
|
198
204
|
)
|
|
199
|
-
logger.debug(f'<<< PACKET: {data.hex()}')
|
|
200
205
|
self.on_data_received(data)
|
|
201
206
|
|
|
202
207
|
async def send_packet(self, data):
|
|
@@ -250,7 +255,7 @@ async def open_android_netsim_controller_transport(
|
|
|
250
255
|
|
|
251
256
|
# Check that we don't already have a device
|
|
252
257
|
if self.device:
|
|
253
|
-
logger.debug('
|
|
258
|
+
logger.debug('Busy, already serving a device')
|
|
254
259
|
return PacketResponse(error='Busy')
|
|
255
260
|
|
|
256
261
|
# Instantiate a new device
|
|
@@ -309,16 +314,24 @@ async def open_android_netsim_host_transport_with_channel(
|
|
|
309
314
|
):
|
|
310
315
|
# Wrapper for I/O operations
|
|
311
316
|
class HciDevice:
|
|
312
|
-
def __init__(self, name, manufacturer, hci_device):
|
|
317
|
+
def __init__(self, name, variant, manufacturer, hci_device):
|
|
313
318
|
self.name = name
|
|
319
|
+
self.variant = variant
|
|
314
320
|
self.manufacturer = manufacturer
|
|
315
321
|
self.hci_device = hci_device
|
|
316
322
|
|
|
317
323
|
async def start(self): # Send the startup info
|
|
318
|
-
|
|
324
|
+
device_info = DeviceInfo(
|
|
319
325
|
name=self.name,
|
|
320
|
-
|
|
326
|
+
kind='BUMBLE',
|
|
327
|
+
version=bumble.__version__,
|
|
328
|
+
sdk_version=platform.python_version(),
|
|
329
|
+
build_id=platform.platform(),
|
|
330
|
+
arch=platform.machine(),
|
|
331
|
+
variant=self.variant,
|
|
321
332
|
)
|
|
333
|
+
chip = Chip(kind=ChipKind.BLUETOOTH, manufacturer=self.manufacturer)
|
|
334
|
+
chip_info = ChipInfo(name=self.name, chip=chip, device_info=device_info)
|
|
322
335
|
logger.debug(f'Sending chip info to netsim: {chip_info}')
|
|
323
336
|
await self.hci_device.write(PacketRequest(initial_info=chip_info))
|
|
324
337
|
|
|
@@ -346,12 +359,16 @@ async def open_android_netsim_host_transport_with_channel(
|
|
|
346
359
|
)
|
|
347
360
|
|
|
348
361
|
name = DEFAULT_NAME if options is None else options.get('name', DEFAULT_NAME)
|
|
362
|
+
variant = (
|
|
363
|
+
DEFAULT_VARIANT if options is None else options.get('variant', DEFAULT_VARIANT)
|
|
364
|
+
)
|
|
349
365
|
manufacturer = DEFAULT_MANUFACTURER
|
|
350
366
|
|
|
351
367
|
# Connect as a host
|
|
352
368
|
service = PacketStreamerStub(channel)
|
|
353
369
|
hci_device = HciDevice(
|
|
354
370
|
name=name,
|
|
371
|
+
variant=variant,
|
|
355
372
|
manufacturer=manufacturer,
|
|
356
373
|
hci_device=service.StreamPackets(),
|
|
357
374
|
)
|
|
@@ -401,6 +418,9 @@ async def open_android_netsim_transport(spec: Optional[str]) -> Transport:
|
|
|
401
418
|
The "chip" name, used to identify the "chip" instance. This
|
|
402
419
|
may be useful when several clients are connected, since each needs to use a
|
|
403
420
|
different name.
|
|
421
|
+
variant=<variant>
|
|
422
|
+
The device info variant field, which may be used to convey a device or
|
|
423
|
+
application type (ex: "virtual-speaker", or "keyboard")
|
|
404
424
|
|
|
405
425
|
In `controller` mode:
|
|
406
426
|
The <host>:<port> part is required. <host> may be the address of a local network
|
|
File without changes
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
-
# source: common.proto
|
|
3
|
+
# source: netsim/common.proto
|
|
4
|
+
# Protobuf Python Version: 4.25.1
|
|
4
5
|
"""Generated protocol buffer code."""
|
|
5
|
-
from google.protobuf.internal import builder as _builder
|
|
6
6
|
from google.protobuf import descriptor as _descriptor
|
|
7
7
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
8
|
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
9
10
|
# @@protoc_insertion_point(imports)
|
|
10
11
|
|
|
11
12
|
_sym_db = _symbol_database.Default()
|
|
@@ -13,13 +14,13 @@ _sym_db = _symbol_database.Default()
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13netsim/common.proto\x12\rnetsim.common*S\n\x08\x43hipKind\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\r\n\tBLUETOOTH\x10\x01\x12\x08\n\x04WIFI\x10\x02\x12\x07\n\x03UWB\x10\x03\x12\x14\n\x10\x42LUETOOTH_BEACON\x10\x04\x62\x06proto3')
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
_builder.
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'netsim.common_pb2', _globals)
|
|
20
22
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
21
|
-
|
|
22
23
|
DESCRIPTOR._options = None
|
|
23
|
-
_CHIPKIND._serialized_start=
|
|
24
|
-
_CHIPKIND._serialized_end=
|
|
24
|
+
_globals['_CHIPKIND']._serialized_start=38
|
|
25
|
+
_globals['_CHIPKIND']._serialized_end=121
|
|
25
26
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -2,11 +2,17 @@ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
|
|
|
2
2
|
from google.protobuf import descriptor as _descriptor
|
|
3
3
|
from typing import ClassVar as _ClassVar
|
|
4
4
|
|
|
5
|
-
BLUETOOTH: ChipKind
|
|
6
5
|
DESCRIPTOR: _descriptor.FileDescriptor
|
|
7
|
-
UNSPECIFIED: ChipKind
|
|
8
|
-
UWB: ChipKind
|
|
9
|
-
WIFI: ChipKind
|
|
10
6
|
|
|
11
7
|
class ChipKind(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
12
|
-
__slots__ =
|
|
8
|
+
__slots__ = ()
|
|
9
|
+
UNSPECIFIED: _ClassVar[ChipKind]
|
|
10
|
+
BLUETOOTH: _ClassVar[ChipKind]
|
|
11
|
+
WIFI: _ClassVar[ChipKind]
|
|
12
|
+
UWB: _ClassVar[ChipKind]
|
|
13
|
+
BLUETOOTH_BEACON: _ClassVar[ChipKind]
|
|
14
|
+
UNSPECIFIED: ChipKind
|
|
15
|
+
BLUETOOTH: ChipKind
|
|
16
|
+
WIFI: ChipKind
|
|
17
|
+
UWB: ChipKind
|
|
18
|
+
BLUETOOTH_BEACON: ChipKind
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: netsim/hci_packet.proto
|
|
4
|
+
# Protobuf Python Version: 4.25.1
|
|
5
|
+
"""Generated protocol buffer code."""
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
10
|
+
# @@protoc_insertion_point(imports)
|
|
11
|
+
|
|
12
|
+
_sym_db = _symbol_database.Default()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17netsim/hci_packet.proto\x12\rnetsim.packet\"\xb2\x01\n\tHCIPacket\x12\x38\n\x0bpacket_type\x18\x01 \x01(\x0e\x32#.netsim.packet.HCIPacket.PacketType\x12\x0e\n\x06packet\x18\x02 \x01(\x0c\"[\n\nPacketType\x12\x1a\n\x16HCI_PACKET_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x43OMMAND\x10\x01\x12\x07\n\x03\x41\x43L\x10\x02\x12\x07\n\x03SCO\x10\x03\x12\t\n\x05\x45VENT\x10\x04\x12\x07\n\x03ISO\x10\x05\x42J\n\x1f\x63om.android.emulation.bluetoothP\x01\xf8\x01\x01\xa2\x02\x03\x41\x45\x42\xaa\x02\x1b\x41ndroid.Emulation.Bluetoothb\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'netsim.hci_packet_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
_globals['DESCRIPTOR']._options = None
|
|
24
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\037com.android.emulation.bluetoothP\001\370\001\001\242\002\003AEB\252\002\033Android.Emulation.Bluetooth'
|
|
25
|
+
_globals['_HCIPACKET']._serialized_start=43
|
|
26
|
+
_globals['_HCIPACKET']._serialized_end=221
|
|
27
|
+
_globals['_HCIPACKET_PACKETTYPE']._serialized_start=130
|
|
28
|
+
_globals['_HCIPACKET_PACKETTYPE']._serialized_end=221
|
|
29
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -6,17 +6,23 @@ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
|
|
|
6
6
|
DESCRIPTOR: _descriptor.FileDescriptor
|
|
7
7
|
|
|
8
8
|
class HCIPacket(_message.Message):
|
|
9
|
-
__slots__ =
|
|
9
|
+
__slots__ = ("packet_type", "packet")
|
|
10
10
|
class PacketType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
|
|
11
|
-
__slots__ =
|
|
12
|
-
|
|
11
|
+
__slots__ = ()
|
|
12
|
+
HCI_PACKET_UNSPECIFIED: _ClassVar[HCIPacket.PacketType]
|
|
13
|
+
COMMAND: _ClassVar[HCIPacket.PacketType]
|
|
14
|
+
ACL: _ClassVar[HCIPacket.PacketType]
|
|
15
|
+
SCO: _ClassVar[HCIPacket.PacketType]
|
|
16
|
+
EVENT: _ClassVar[HCIPacket.PacketType]
|
|
17
|
+
ISO: _ClassVar[HCIPacket.PacketType]
|
|
18
|
+
HCI_PACKET_UNSPECIFIED: HCIPacket.PacketType
|
|
13
19
|
COMMAND: HCIPacket.PacketType
|
|
20
|
+
ACL: HCIPacket.PacketType
|
|
21
|
+
SCO: HCIPacket.PacketType
|
|
14
22
|
EVENT: HCIPacket.PacketType
|
|
15
|
-
HCI_PACKET_UNSPECIFIED: HCIPacket.PacketType
|
|
16
23
|
ISO: HCIPacket.PacketType
|
|
17
|
-
PACKET_FIELD_NUMBER: _ClassVar[int]
|
|
18
24
|
PACKET_TYPE_FIELD_NUMBER: _ClassVar[int]
|
|
19
|
-
|
|
20
|
-
packet: bytes
|
|
25
|
+
PACKET_FIELD_NUMBER: _ClassVar[int]
|
|
21
26
|
packet_type: HCIPacket.PacketType
|
|
27
|
+
packet: bytes
|
|
22
28
|
def __init__(self, packet_type: _Optional[_Union[HCIPacket.PacketType, str]] = ..., packet: _Optional[bytes] = ...) -> None: ...
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: netsim/model.proto
|
|
4
|
+
# Protobuf Python Version: 4.25.1
|
|
5
|
+
"""Generated protocol buffer code."""
|
|
6
|
+
from google.protobuf import descriptor as _descriptor
|
|
7
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
8
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
9
|
+
from google.protobuf.internal import builder as _builder
|
|
10
|
+
# @@protoc_insertion_point(imports)
|
|
11
|
+
|
|
12
|
+
_sym_db = _symbol_database.Default()
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from bumble.transport.grpc_protobuf.netsim import common_pb2 as netsim_dot_common__pb2
|
|
16
|
+
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
|
17
|
+
from bumble.transport.grpc_protobuf.rootcanal import configuration_pb2 as rootcanal_dot_configuration__pb2
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12netsim/model.proto\x12\x0cnetsim.model\x1a\x13netsim/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1drootcanal/configuration.proto\"+\n\x08Position\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"7\n\x0bOrientation\x12\x0b\n\x03yaw\x18\x01 \x01(\x02\x12\r\n\x05pitch\x18\x02 \x01(\x02\x12\x0c\n\x04roll\x18\x03 \x01(\x02\"\x84\x0c\n\x04\x43hip\x12%\n\x04kind\x18\x01 \x01(\x0e\x32\x17.netsim.common.ChipKind\x12\n\n\x02id\x18\x02 \x01(\r\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x14\n\x0cmanufacturer\x18\x04 \x01(\t\x12\x14\n\x0cproduct_name\x18\x05 \x01(\t\x12*\n\x02\x62t\x18\x06 \x01(\x0b\x32\x1c.netsim.model.Chip.BluetoothH\x00\x12\x32\n\nble_beacon\x18\t \x01(\x0b\x32\x1c.netsim.model.Chip.BleBeaconH\x00\x12\'\n\x03uwb\x18\x07 \x01(\x0b\x32\x18.netsim.model.Chip.RadioH\x00\x12(\n\x04wifi\x18\x08 \x01(\x0b\x32\x18.netsim.model.Chip.RadioH\x00\x12+\n\x06offset\x18\x0f \x01(\x0b\x32\x16.netsim.model.PositionH\x01\x88\x01\x01\x1aX\n\x05Radio\x12\x12\n\x05state\x18\x01 \x01(\x08H\x00\x88\x01\x01\x12\r\n\x05range\x18\x02 \x01(\x02\x12\x10\n\x08tx_count\x18\x03 \x01(\x05\x12\x10\n\x08rx_count\x18\x04 \x01(\x05\x42\x08\n\x06_state\x1a\xb1\x01\n\tBluetooth\x12,\n\nlow_energy\x18\x01 \x01(\x0b\x32\x18.netsim.model.Chip.Radio\x12)\n\x07\x63lassic\x18\x02 \x01(\x0b\x32\x18.netsim.model.Chip.Radio\x12\x0f\n\x07\x61\x64\x64ress\x18\x03 \x01(\t\x12:\n\rbt_properties\x18\x04 \x01(\x0b\x32#.rootcanal.configuration.Controller\x1a\x8d\x07\n\tBleBeacon\x12(\n\x02\x62t\x18\x01 \x01(\x0b\x32\x1c.netsim.model.Chip.Bluetooth\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12@\n\x08settings\x18\x03 \x01(\x0b\x32..netsim.model.Chip.BleBeacon.AdvertiseSettings\x12<\n\x08\x61\x64v_data\x18\x04 \x01(\x0b\x32*.netsim.model.Chip.BleBeacon.AdvertiseData\x12\x41\n\rscan_response\x18\x05 \x01(\x0b\x32*.netsim.model.Chip.BleBeacon.AdvertiseData\x1a\xaa\x03\n\x11\x41\x64vertiseSettings\x12V\n\x0e\x61\x64vertise_mode\x18\x01 \x01(\x0e\x32<.netsim.model.Chip.BleBeacon.AdvertiseSettings.AdvertiseModeH\x00\x12\x16\n\x0cmilliseconds\x18\x02 \x01(\x04H\x00\x12Y\n\x0etx_power_level\x18\x03 \x01(\x0e\x32?.netsim.model.Chip.BleBeacon.AdvertiseSettings.AdvertiseTxPowerH\x01\x12\r\n\x03\x64\x62m\x18\x04 \x01(\x05H\x01\x12\x11\n\tscannable\x18\x05 \x01(\x08\x12\x0f\n\x07timeout\x18\x06 \x01(\x04\"=\n\rAdvertiseMode\x12\r\n\tLOW_POWER\x10\x00\x12\x0c\n\x08\x42\x41LANCED\x10\x01\x12\x0f\n\x0bLOW_LATENCY\x10\x02\"@\n\x10\x41\x64vertiseTxPower\x12\r\n\tULTRA_LOW\x10\x00\x12\x07\n\x03LOW\x10\x01\x12\n\n\x06MEDIUM\x10\x02\x12\x08\n\x04HIGH\x10\x03\x42\n\n\x08intervalB\n\n\x08tx_power\x1a\xd4\x01\n\rAdvertiseData\x12\x1b\n\x13include_device_name\x18\x01 \x01(\x08\x12\x1e\n\x16include_tx_power_level\x18\x02 \x01(\x08\x12\x19\n\x11manufacturer_data\x18\x03 \x01(\x0c\x12\x44\n\x08services\x18\x04 \x03(\x0b\x32\x32.netsim.model.Chip.BleBeacon.AdvertiseData.Service\x1a%\n\x07Service\x12\x0c\n\x04uuid\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x42\x06\n\x04\x63hipB\t\n\x07_offset\"\xea\x03\n\nChipCreate\x12%\n\x04kind\x18\x01 \x01(\x0e\x32\x17.netsim.common.ChipKind\x12\x0f\n\x07\x61\x64\x64ress\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x14\n\x0cmanufacturer\x18\x04 \x01(\t\x12\x14\n\x0cproduct_name\x18\x05 \x01(\t\x12>\n\nble_beacon\x18\x06 \x01(\x0b\x32(.netsim.model.ChipCreate.BleBeaconCreateH\x00\x12:\n\rbt_properties\x18\x07 \x01(\x0b\x32#.rootcanal.configuration.Controller\x1a\xe5\x01\n\x0f\x42leBeaconCreate\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12@\n\x08settings\x18\x03 \x01(\x0b\x32..netsim.model.Chip.BleBeacon.AdvertiseSettings\x12<\n\x08\x61\x64v_data\x18\x04 \x01(\x0b\x32*.netsim.model.Chip.BleBeacon.AdvertiseData\x12\x41\n\rscan_response\x18\x05 \x01(\x0b\x32*.netsim.model.Chip.BleBeacon.AdvertiseDataB\x06\n\x04\x63hip\"\xc1\x01\n\x06\x44\x65vice\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x14\n\x07visible\x18\x03 \x01(\x08H\x00\x88\x01\x01\x12(\n\x08position\x18\x04 \x01(\x0b\x32\x16.netsim.model.Position\x12.\n\x0borientation\x18\x05 \x01(\x0b\x32\x19.netsim.model.Orientation\x12!\n\x05\x63hips\x18\x06 \x03(\x0b\x32\x12.netsim.model.ChipB\n\n\x08_visible\"\x9f\x01\n\x0c\x44\x65viceCreate\x12\x0c\n\x04name\x18\x01 \x01(\t\x12(\n\x08position\x18\x02 \x01(\x0b\x32\x16.netsim.model.Position\x12.\n\x0borientation\x18\x03 \x01(\x0b\x32\x19.netsim.model.Orientation\x12\'\n\x05\x63hips\x18\x04 \x03(\x0b\x32\x18.netsim.model.ChipCreate\".\n\x05Scene\x12%\n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x14.netsim.model.Device\"\xd1\x01\n\x07\x43\x61pture\x12\n\n\x02id\x18\x01 \x01(\r\x12*\n\tchip_kind\x18\x02 \x01(\x0e\x32\x17.netsim.common.ChipKind\x12\x13\n\x0b\x64\x65vice_name\x18\x03 \x01(\t\x12\x12\n\x05state\x18\x04 \x01(\x08H\x00\x88\x01\x01\x12\x0c\n\x04size\x18\x05 \x01(\x05\x12\x0f\n\x07records\x18\x06 \x01(\x05\x12-\n\ttimestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05valid\x18\x08 \x01(\x08\x42\x08\n\x06_state*e\n\x07PhyKind\x12\x08\n\x04NONE\x10\x00\x12\x15\n\x11\x42LUETOOTH_CLASSIC\x10\x01\x12\x18\n\x14\x42LUETOOTH_LOW_ENERGY\x10\x02\x12\x08\n\x04WIFI\x10\x03\x12\x07\n\x03UWB\x10\x04\x12\x0c\n\x08WIFI_RTT\x10\x05\x62\x06proto3')
|
|
21
|
+
|
|
22
|
+
_globals = globals()
|
|
23
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
24
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'netsim.model_pb2', _globals)
|
|
25
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
26
|
+
DESCRIPTOR._options = None
|
|
27
|
+
_globals['_PHYKIND']._serialized_start=2877
|
|
28
|
+
_globals['_PHYKIND']._serialized_end=2978
|
|
29
|
+
_globals['_POSITION']._serialized_start=121
|
|
30
|
+
_globals['_POSITION']._serialized_end=164
|
|
31
|
+
_globals['_ORIENTATION']._serialized_start=166
|
|
32
|
+
_globals['_ORIENTATION']._serialized_end=221
|
|
33
|
+
_globals['_CHIP']._serialized_start=224
|
|
34
|
+
_globals['_CHIP']._serialized_end=1764
|
|
35
|
+
_globals['_CHIP_RADIO']._serialized_start=565
|
|
36
|
+
_globals['_CHIP_RADIO']._serialized_end=653
|
|
37
|
+
_globals['_CHIP_BLUETOOTH']._serialized_start=656
|
|
38
|
+
_globals['_CHIP_BLUETOOTH']._serialized_end=833
|
|
39
|
+
_globals['_CHIP_BLEBEACON']._serialized_start=836
|
|
40
|
+
_globals['_CHIP_BLEBEACON']._serialized_end=1745
|
|
41
|
+
_globals['_CHIP_BLEBEACON_ADVERTISESETTINGS']._serialized_start=1104
|
|
42
|
+
_globals['_CHIP_BLEBEACON_ADVERTISESETTINGS']._serialized_end=1530
|
|
43
|
+
_globals['_CHIP_BLEBEACON_ADVERTISESETTINGS_ADVERTISEMODE']._serialized_start=1379
|
|
44
|
+
_globals['_CHIP_BLEBEACON_ADVERTISESETTINGS_ADVERTISEMODE']._serialized_end=1440
|
|
45
|
+
_globals['_CHIP_BLEBEACON_ADVERTISESETTINGS_ADVERTISETXPOWER']._serialized_start=1442
|
|
46
|
+
_globals['_CHIP_BLEBEACON_ADVERTISESETTINGS_ADVERTISETXPOWER']._serialized_end=1506
|
|
47
|
+
_globals['_CHIP_BLEBEACON_ADVERTISEDATA']._serialized_start=1533
|
|
48
|
+
_globals['_CHIP_BLEBEACON_ADVERTISEDATA']._serialized_end=1745
|
|
49
|
+
_globals['_CHIP_BLEBEACON_ADVERTISEDATA_SERVICE']._serialized_start=1708
|
|
50
|
+
_globals['_CHIP_BLEBEACON_ADVERTISEDATA_SERVICE']._serialized_end=1745
|
|
51
|
+
_globals['_CHIPCREATE']._serialized_start=1767
|
|
52
|
+
_globals['_CHIPCREATE']._serialized_end=2257
|
|
53
|
+
_globals['_CHIPCREATE_BLEBEACONCREATE']._serialized_start=2020
|
|
54
|
+
_globals['_CHIPCREATE_BLEBEACONCREATE']._serialized_end=2249
|
|
55
|
+
_globals['_DEVICE']._serialized_start=2260
|
|
56
|
+
_globals['_DEVICE']._serialized_end=2453
|
|
57
|
+
_globals['_DEVICECREATE']._serialized_start=2456
|
|
58
|
+
_globals['_DEVICECREATE']._serialized_end=2615
|
|
59
|
+
_globals['_SCENE']._serialized_start=2617
|
|
60
|
+
_globals['_SCENE']._serialized_end=2663
|
|
61
|
+
_globals['_CAPTURE']._serialized_start=2666
|
|
62
|
+
_globals['_CAPTURE']._serialized_end=2875
|
|
63
|
+
# @@protoc_insertion_point(module_scope)
|