mirror of
https://github.com/google/bumble.git
synced 2026-05-08 03:58:01 +00:00
add doc and fix types
This commit is contained in:
@@ -129,8 +129,12 @@ RFCOMM_DYNAMIC_CHANNEL_NUMBER_END = 30
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
def make_service_sdp_records(
|
def make_service_sdp_records(
|
||||||
service_record_handle: int, channel: int, uuid: UUID = None
|
service_record_handle: int, channel: int, uuid: Optional[UUID] = None
|
||||||
) -> List[ServiceAttribute]:
|
) -> List[ServiceAttribute]:
|
||||||
|
"""
|
||||||
|
Create SDP records for an RFComm service given a channel number and an
|
||||||
|
optional UUID. A Service Class Attribute is included only if the UUID is not None.
|
||||||
|
"""
|
||||||
records = [
|
records = [
|
||||||
ServiceAttribute(
|
ServiceAttribute(
|
||||||
SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID,
|
SDP_SERVICE_RECORD_HANDLE_ATTRIBUTE_ID,
|
||||||
@@ -160,7 +164,7 @@ def make_service_sdp_records(
|
|||||||
records.append(
|
records.append(
|
||||||
ServiceAttribute(
|
ServiceAttribute(
|
||||||
SDP_SERVICE_CLASS_ID_LIST_ATTRIBUTE_ID,
|
SDP_SERVICE_CLASS_ID_LIST_ATTRIBUTE_ID,
|
||||||
DataElement.sequence([DataElement.uuid(UUID(uuid))]),
|
DataElement.sequence([DataElement.uuid(uuid)]),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from bumble.core import UUID
|
||||||
from bumble.device import Device
|
from bumble.device import Device
|
||||||
from bumble.transport import open_transport_or_link
|
from bumble.transport import open_transport_or_link
|
||||||
from bumble.rfcomm import Server
|
from bumble.rfcomm import Server
|
||||||
@@ -32,7 +33,7 @@ def sdp_records(channel, uuid):
|
|||||||
service_record_handle = 0x00010001
|
service_record_handle = 0x00010001
|
||||||
return {
|
return {
|
||||||
service_record_handle: make_service_sdp_records(
|
service_record_handle: make_service_sdp_records(
|
||||||
service_record_handle, channel, uuid
|
service_record_handle, channel, UUID(uuid)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user