Loading system/gd/shim/l2cap.cc +4 −4 Original line number Diff line number Diff line Loading @@ -607,7 +607,7 @@ void L2cap::impl::SendLoopbackResponse(std::function<void()> function) { function(); } void L2cap::RegisterService( void L2cap::RegisterClassicService( uint16_t raw_psm, bool use_ertm, uint16_t mtu, Loading @@ -629,13 +629,13 @@ void L2cap::RegisterService( std::move(register_promise))); } void L2cap::UnregisterService(uint16_t raw_psm, UnregisterServicePromise unregister_promise) { void L2cap::UnregisterClassicService(uint16_t raw_psm, UnregisterServicePromise unregister_promise) { l2cap::Psm psm{raw_psm}; GetHandler()->Post(common::BindOnce( &L2cap::impl::UnregisterService, common::Unretained(pimpl_.get()), psm, std::move(unregister_promise))); } void L2cap::CreateConnection( void L2cap::CreateClassicConnection( uint16_t raw_psm, const std::string address_string, ConnectionCompleteCallback on_complete, Loading @@ -653,7 +653,7 @@ void L2cap::CreateConnection( std::move(create_promise))); } void L2cap::CloseConnection(uint16_t raw_cid) { void L2cap::CloseClassicConnection(uint16_t raw_cid) { ConnectionInterfaceDescriptor cid(raw_cid); GetHandler()->Post(common::Bind(&L2cap::impl::CloseConnection, common::Unretained(pimpl_.get()), cid)); } Loading system/gd/shim/l2cap.h +4 −4 Original line number Diff line number Diff line Loading @@ -37,20 +37,20 @@ using CreateConnectionPromise = std::promise<uint16_t>; class L2cap : public bluetooth::Module { public: void RegisterService( void RegisterClassicService( uint16_t psm, bool use_ertm, uint16_t mtu, ConnectionCompleteCallback on_complete, RegisterServicePromise register_promise); void UnregisterService(uint16_t psm, UnregisterServicePromise unregister_promise); void UnregisterClassicService(uint16_t psm, UnregisterServicePromise unregister_promise); void CreateConnection( void CreateClassicConnection( uint16_t psm, const std::string address_string, ConnectionCompleteCallback on_complete, CreateConnectionPromise create_promise); void CloseConnection(uint16_t cid); void CloseClassicConnection(uint16_t cid); void SetReadDataReadyCallback(uint16_t cid, ReadDataReadyCallback on_data_ready); void SetConnectionClosedCallback(uint16_t cid, ConnectionClosedCallback on_closed); Loading system/gd/shim/l2cap_test.cc +7 −7 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ class ShimL2capTest : public ::testing::Test { std::promise<uint16_t> promise; auto future = promise.get_future(); shim_l2cap_->CreateConnection( shim_l2cap_->CreateClassicConnection( psm, device_address, std::bind( Loading Loading @@ -285,7 +285,7 @@ TEST_F(ShimL2capTest, CreateThenDisconnectBeforeCompletion) { WaitConnectionFuture(); ASSERT_EQ(NumberOfConnections(), 1); shim_l2cap_->CloseConnection(cid); shim_l2cap_->CloseClassicConnection(cid); } TEST_F(ShimL2capTest, MaxCreatedConnections) { Loading Loading @@ -348,7 +348,7 @@ TEST_F(ShimL2capTest, ConnectFail) { ASSERT_EQ(connection_connected_, false); shim_l2cap_->CloseConnection(cid); shim_l2cap_->CloseClassicConnection(cid); } TEST_F(ShimL2capTest, ConnectOpen) { Loading Loading @@ -388,7 +388,7 @@ TEST_F(ShimL2capTest, ConnectOpen) { ASSERT_EQ(connection_connected_, true); auto future = test_link_.connection_closed_promise_.get_future(); shim_l2cap_->CloseConnection(cid); shim_l2cap_->CloseClassicConnection(cid); future.wait(); } Loading @@ -397,7 +397,7 @@ TEST_F(ShimL2capTest, RegisterService_Success) { auto registration_pending = registration_promise.get_future(); SetRegistrationFuture(); shim_l2cap_->RegisterService( shim_l2cap_->RegisterClassicService( kPsm, kNoUseErtm, kMtu, Loading Loading @@ -428,7 +428,7 @@ TEST_F(ShimL2capTest, RegisterService_Duplicate) { auto future = promise.get_future(); SetRegistrationFuture(); shim_l2cap_->RegisterService( shim_l2cap_->RegisterClassicService( kPsm, kNoUseErtm, kMtu, Loading Loading @@ -460,7 +460,7 @@ TEST_F(ShimL2capTest, RegisterService_Invalid) { SetRegistrationFuture(); shim_l2cap_->RegisterService( shim_l2cap_->RegisterClassicService( kPsm, kNoUseErtm, kMtu, Loading system/main/shim/l2cap.cc +6 −6 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ uint16_t bluetooth::shim::legacy::L2cap::RegisterService( use_ertm = true; } constexpr auto mtu = 1000; // TODO: Let client decide bluetooth::shim::GetL2cap()->RegisterService( bluetooth::shim::GetL2cap()->RegisterClassicService( psm, use_ertm, mtu, std::bind( &bluetooth::shim::legacy::L2cap::OnRemoteInitiatedConnectionCreated, Loading Loading @@ -215,8 +215,8 @@ void bluetooth::shim::legacy::L2cap::UnregisterService(uint16_t psm) { LOG_DEBUG("Unregistering service on psm:%hd", psm); UnregisterServicePromise unregister_promise; auto service_unregistered = unregister_promise.get_future(); bluetooth::shim::GetL2cap()->UnregisterService(psm, std::move(unregister_promise)); bluetooth::shim::GetL2cap()->UnregisterClassicService( psm, std::move(unregister_promise)); service_unregistered.wait(); Classic().UnregisterPsm(psm); } Loading @@ -233,7 +233,7 @@ uint16_t bluetooth::shim::legacy::L2cap::CreateConnection( LOG_DEBUG("Initiating local connection to psm:%hd address:%s", psm, raw_address.ToString().c_str()); bluetooth::shim::GetL2cap()->CreateConnection( bluetooth::shim::GetL2cap()->CreateClassicConnection( psm, raw_address.ToString(), std::bind( &bluetooth::shim::legacy::L2cap::OnLocalInitiatedConnectionCreated, Loading Loading @@ -273,7 +273,7 @@ void bluetooth::shim::legacy::L2cap::OnLocalInitiatedConnectionCreated( LOG_DEBUG("Connection Closed before presentation to upper layer"); if (connected) { SetDownstreamCallbacks(cid); bluetooth::shim::GetL2cap()->CloseConnection(cid); bluetooth::shim::GetL2cap()->CloseClassicConnection(cid); } else { LOG_DEBUG("Connection failed after initiator closed"); } Loading Loading @@ -394,7 +394,7 @@ bool bluetooth::shim::legacy::L2cap::DisconnectRequest(uint16_t cid) { } LOG_DEBUG("%s initiated locally cid:%hu", __func__, cid); cid_closing_set_.insert(cid); bluetooth::shim::GetL2cap()->CloseConnection(cid); bluetooth::shim::GetL2cap()->CloseClassicConnection(cid); return true; } Loading Loading
system/gd/shim/l2cap.cc +4 −4 Original line number Diff line number Diff line Loading @@ -607,7 +607,7 @@ void L2cap::impl::SendLoopbackResponse(std::function<void()> function) { function(); } void L2cap::RegisterService( void L2cap::RegisterClassicService( uint16_t raw_psm, bool use_ertm, uint16_t mtu, Loading @@ -629,13 +629,13 @@ void L2cap::RegisterService( std::move(register_promise))); } void L2cap::UnregisterService(uint16_t raw_psm, UnregisterServicePromise unregister_promise) { void L2cap::UnregisterClassicService(uint16_t raw_psm, UnregisterServicePromise unregister_promise) { l2cap::Psm psm{raw_psm}; GetHandler()->Post(common::BindOnce( &L2cap::impl::UnregisterService, common::Unretained(pimpl_.get()), psm, std::move(unregister_promise))); } void L2cap::CreateConnection( void L2cap::CreateClassicConnection( uint16_t raw_psm, const std::string address_string, ConnectionCompleteCallback on_complete, Loading @@ -653,7 +653,7 @@ void L2cap::CreateConnection( std::move(create_promise))); } void L2cap::CloseConnection(uint16_t raw_cid) { void L2cap::CloseClassicConnection(uint16_t raw_cid) { ConnectionInterfaceDescriptor cid(raw_cid); GetHandler()->Post(common::Bind(&L2cap::impl::CloseConnection, common::Unretained(pimpl_.get()), cid)); } Loading
system/gd/shim/l2cap.h +4 −4 Original line number Diff line number Diff line Loading @@ -37,20 +37,20 @@ using CreateConnectionPromise = std::promise<uint16_t>; class L2cap : public bluetooth::Module { public: void RegisterService( void RegisterClassicService( uint16_t psm, bool use_ertm, uint16_t mtu, ConnectionCompleteCallback on_complete, RegisterServicePromise register_promise); void UnregisterService(uint16_t psm, UnregisterServicePromise unregister_promise); void UnregisterClassicService(uint16_t psm, UnregisterServicePromise unregister_promise); void CreateConnection( void CreateClassicConnection( uint16_t psm, const std::string address_string, ConnectionCompleteCallback on_complete, CreateConnectionPromise create_promise); void CloseConnection(uint16_t cid); void CloseClassicConnection(uint16_t cid); void SetReadDataReadyCallback(uint16_t cid, ReadDataReadyCallback on_data_ready); void SetConnectionClosedCallback(uint16_t cid, ConnectionClosedCallback on_closed); Loading
system/gd/shim/l2cap_test.cc +7 −7 Original line number Diff line number Diff line Loading @@ -201,7 +201,7 @@ class ShimL2capTest : public ::testing::Test { std::promise<uint16_t> promise; auto future = promise.get_future(); shim_l2cap_->CreateConnection( shim_l2cap_->CreateClassicConnection( psm, device_address, std::bind( Loading Loading @@ -285,7 +285,7 @@ TEST_F(ShimL2capTest, CreateThenDisconnectBeforeCompletion) { WaitConnectionFuture(); ASSERT_EQ(NumberOfConnections(), 1); shim_l2cap_->CloseConnection(cid); shim_l2cap_->CloseClassicConnection(cid); } TEST_F(ShimL2capTest, MaxCreatedConnections) { Loading Loading @@ -348,7 +348,7 @@ TEST_F(ShimL2capTest, ConnectFail) { ASSERT_EQ(connection_connected_, false); shim_l2cap_->CloseConnection(cid); shim_l2cap_->CloseClassicConnection(cid); } TEST_F(ShimL2capTest, ConnectOpen) { Loading Loading @@ -388,7 +388,7 @@ TEST_F(ShimL2capTest, ConnectOpen) { ASSERT_EQ(connection_connected_, true); auto future = test_link_.connection_closed_promise_.get_future(); shim_l2cap_->CloseConnection(cid); shim_l2cap_->CloseClassicConnection(cid); future.wait(); } Loading @@ -397,7 +397,7 @@ TEST_F(ShimL2capTest, RegisterService_Success) { auto registration_pending = registration_promise.get_future(); SetRegistrationFuture(); shim_l2cap_->RegisterService( shim_l2cap_->RegisterClassicService( kPsm, kNoUseErtm, kMtu, Loading Loading @@ -428,7 +428,7 @@ TEST_F(ShimL2capTest, RegisterService_Duplicate) { auto future = promise.get_future(); SetRegistrationFuture(); shim_l2cap_->RegisterService( shim_l2cap_->RegisterClassicService( kPsm, kNoUseErtm, kMtu, Loading Loading @@ -460,7 +460,7 @@ TEST_F(ShimL2capTest, RegisterService_Invalid) { SetRegistrationFuture(); shim_l2cap_->RegisterService( shim_l2cap_->RegisterClassicService( kPsm, kNoUseErtm, kMtu, Loading
system/main/shim/l2cap.cc +6 −6 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ uint16_t bluetooth::shim::legacy::L2cap::RegisterService( use_ertm = true; } constexpr auto mtu = 1000; // TODO: Let client decide bluetooth::shim::GetL2cap()->RegisterService( bluetooth::shim::GetL2cap()->RegisterClassicService( psm, use_ertm, mtu, std::bind( &bluetooth::shim::legacy::L2cap::OnRemoteInitiatedConnectionCreated, Loading Loading @@ -215,8 +215,8 @@ void bluetooth::shim::legacy::L2cap::UnregisterService(uint16_t psm) { LOG_DEBUG("Unregistering service on psm:%hd", psm); UnregisterServicePromise unregister_promise; auto service_unregistered = unregister_promise.get_future(); bluetooth::shim::GetL2cap()->UnregisterService(psm, std::move(unregister_promise)); bluetooth::shim::GetL2cap()->UnregisterClassicService( psm, std::move(unregister_promise)); service_unregistered.wait(); Classic().UnregisterPsm(psm); } Loading @@ -233,7 +233,7 @@ uint16_t bluetooth::shim::legacy::L2cap::CreateConnection( LOG_DEBUG("Initiating local connection to psm:%hd address:%s", psm, raw_address.ToString().c_str()); bluetooth::shim::GetL2cap()->CreateConnection( bluetooth::shim::GetL2cap()->CreateClassicConnection( psm, raw_address.ToString(), std::bind( &bluetooth::shim::legacy::L2cap::OnLocalInitiatedConnectionCreated, Loading Loading @@ -273,7 +273,7 @@ void bluetooth::shim::legacy::L2cap::OnLocalInitiatedConnectionCreated( LOG_DEBUG("Connection Closed before presentation to upper layer"); if (connected) { SetDownstreamCallbacks(cid); bluetooth::shim::GetL2cap()->CloseConnection(cid); bluetooth::shim::GetL2cap()->CloseClassicConnection(cid); } else { LOG_DEBUG("Connection failed after initiator closed"); } Loading Loading @@ -394,7 +394,7 @@ bool bluetooth::shim::legacy::L2cap::DisconnectRequest(uint16_t cid) { } LOG_DEBUG("%s initiated locally cid:%hu", __func__, cid); cid_closing_set_.insert(cid); bluetooth::shim::GetL2cap()->CloseConnection(cid); bluetooth::shim::GetL2cap()->CloseClassicConnection(cid); return true; } Loading