Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tizen] Get GATT connection MTU #27626

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/platform/Tizen/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ BLEManagerImpl BLEManagerImpl::sInstance;
struct BLEConnection
{
char * peerAddr;
uint16_t mtu;
unsigned int mtu;
bool subscribed;
bt_gatt_h gattCharC1Handle;
bt_gatt_h gattCharC2Handle;
Expand Down Expand Up @@ -798,6 +798,13 @@ void BLEManagerImpl::AddConnectionData(const char * remoteAddr)
conn = static_cast<BLEConnection *>(g_malloc0(sizeof(BLEConnection)));
conn->peerAddr = g_strdup(remoteAddr);

int ret;
if ((ret = bt_gatt_server_get_device_mtu(remoteAddr, &conn->mtu) != BT_ERROR_NONE))
{
ChipLogError(DeviceLayer, "Failed to get MTU for [%s]. ret: %s", StringOrNullMarker(remoteAddr),
get_error_message(ret));
}

if (sInstance.mIsCentral)
{
/* Local Device is BLE Central Role */
Expand Down Expand Up @@ -1185,7 +1192,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const
{
auto conn = static_cast<BLEConnection *>(conId);
return (conn != nullptr) ? conn->mtu : 0;
return (conn != nullptr) ? static_cast<uint16_t>(conn->mtu) : 0;
}

bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
Expand Down