Skip to content

Conversation

@zxzxwu
Copy link
Collaborator

@zxzxwu zxzxwu commented Oct 13, 2023

self.up_queue.put_nowait(pdu)


class CocChannelProxy(ChannelProxy):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: rename to DynamicChannelProxy


@channel.once('close')
def on_close() -> None:
self.disconnection_result.set_result(None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.disconnection_result.set_result(None)
self.channel = None
self.disconnection_result.set_result(None)

self.channel.write(data)

@property
def closed(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace by ?

    @property
    def closed(self):
        return self.channel is None

self, channel: Union[l2cap.ClassicChannel, l2cap.LeCreditBasedChannel]
) -> None:
super().__init__()
self.channel = channel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.channel = channel
self.channel: Union[l2cap.ClassicChannel, l2cap.LeCreditBasedChannel, None] = channel


connection = self.device.lookup_connection(connection_handle)
if connection is None:
raise RuntimeError('Connection not exist')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isnt the connection field optional ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought you don't want to support this feature?
google/bt-test-interfaces#8 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for this because I can only admit that I was wrong. The reason I forgot about at first was: For timing issue we need to be able listen for incoming L2CAP channel connection before ACL's connect. I'm wondering if we need to change the APIs, WDYT ? @DeltaEvo ? Also, we need to remove the fixed field from the ConnectRquest

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may mark it optional or totally remove it.

channel_proxy = FixedChannelProxy(
connection_handle=connection_handle, cid=cid, device=self.device
)
self.channels[connection_handle][cid] = channel_proxy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing remove from the map later

handle = channel.connection.handle
# Filter channels from non-specified connection
if handle != connection_handle:
connection.abort_on('disconnect', channel.disconnect())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to have multiple OnConnection in parallel, we should not disconnect when filtering

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, that's the problem of this interface. Since Bumble L2CAP server is based on CID instead of connection-cid pair, there must be no more than 1 server for the same cid. The same restriction also exists on Android.

Copy link
Contributor

@uael uael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First batch done!
Thanks you and well done Josh 💯

@uael
Copy link
Contributor

uael commented Oct 13, 2023

I did some experiments here! github.com/google/bumble/

@zxzxwu zxzxwu closed this Nov 10, 2023
@zxzxwu zxzxwu deleted the l2cap_pandora branch January 19, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants