uint16_t raw_psm,
bool use_ertm,
uint16_t mtu,
+ uint16_t required_remote_mtu,
ConnectionCompleteCallback on_complete,
RegisterServicePromise register_promise) {
l2cap::Psm psm{raw_psm};
l2cap::classic::DynamicChannelConfigurationOption::RetransmissionAndFlowControlMode::ENHANCED_RETRANSMISSION;
}
option.incoming_mtu = mtu;
+ option.minimal_remote_mtu = required_remote_mtu;
GetHandler()->Post(common::BindOnce(
&L2cap::impl::RegisterService,
common::Unretained(pimpl_.get()),
uint16_t psm,
bool use_ertm,
uint16_t mtu,
+ uint16_t required_remote_mtu,
ConnectionCompleteCallback on_complete,
RegisterServicePromise register_promise);
void UnregisterClassicService(uint16_t psm, UnregisterServicePromise unregister_promise);
kPsm,
kNoUseErtm,
kMtu,
+ kMtu,
std::bind(
&bluetooth::shim::ShimL2capTest::OnConnectionComplete,
this,
kPsm,
kNoUseErtm,
kMtu,
+ kMtu,
std::bind(
&bluetooth::shim::ShimL2capTest::OnConnectionComplete,
this,
kPsm,
kNoUseErtm,
kMtu,
+ kMtu,
std::bind(
&bluetooth::shim::ShimL2capTest::OnConnectionComplete,
this,
const tL2CAP_APPL_INFO& callbacks,
bool enable_snoop,
tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu) {
+ uint16_t my_mtu,
+ uint16_t required_remote_mtu) {
if (L2C_INVALID_PSM(client_psm)) {
LOG_ERROR("%s Invalid classic psm:%hd", __func__, client_psm);
return 0;
return 0;
}
LOG_INFO("%s classic client_psm:%hd psm:%hd", __func__, client_psm, psm);
-
+ // Minimum acceptable MTU is 48 bytes
+ required_remote_mtu = std::max<uint16_t>(required_remote_mtu, 48);
return shim_l2cap.RegisterService(psm, callbacks, enable_snoop, p_ertm_info,
- required_mtu);
+ my_mtu, required_remote_mtu);
}
void bluetooth::shim::L2CA_Deregister(uint16_t client_psm) {
******************************************************************************/
uint16_t L2CA_Register(uint16_t psm, const tL2CAP_APPL_INFO& p_cb_info,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu);
+ uint16_t my_mtu, uint16_t required_remote_mtu);
/*******************************************************************************
*
uint16_t bluetooth::shim::legacy::L2cap::RegisterService(
uint16_t psm, const tL2CAP_APPL_INFO& callbacks, bool enable_snoop,
- tL2CAP_ERTM_INFO* p_ertm_info, uint16_t required_mtu) {
+ tL2CAP_ERTM_INFO* p_ertm_info, uint16_t my_mtu,
+ uint16_t required_remote_mtu) {
if (Classic().IsPsmRegistered(psm)) {
LOG_WARN("Service is already registered psm:%hd", psm);
return 0;
use_ertm = true;
}
bluetooth::shim::GetL2cap()->RegisterClassicService(
- psm, use_ertm, required_mtu,
+ psm, use_ertm, my_mtu, required_remote_mtu,
std::bind(
&bluetooth::shim::legacy::L2cap::OnRemoteInitiatedConnectionCreated,
this, std::placeholders::_1, std::placeholders::_2,
public:
uint16_t RegisterService(uint16_t psm, const tL2CAP_APPL_INFO& callbacks,
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
- uint16_t required_mtu);
+ uint16_t my_mtu, uint16_t required_remote_mtu);
void UnregisterService(uint16_t psm);
uint16_t CreateConnection(uint16_t psm, const RawAddress& raw_address);
bool enable_snoop, tL2CAP_ERTM_INFO* p_ertm_info,
uint16_t my_mtu, uint16_t required_remote_mtu) {
if (bluetooth::shim::is_gd_shim_enabled()) {
- return bluetooth::shim::L2CA_Register(psm, p_cb_info, enable_snoop,
- p_ertm_info, my_mtu);
+ return bluetooth::shim::L2CA_Register(
+ psm, p_cb_info, enable_snoop, p_ertm_info, my_mtu, required_remote_mtu);
}
tL2C_RCB* p_rcb;