diff --git a/src/inet/InetLayer.cpp b/src/inet/InetLayer.cpp index c92d019fe78049..9e698bb764bea2 100644 --- a/src/inet/InetLayer.cpp +++ b/src/inet/InetLayer.cpp @@ -1066,12 +1066,10 @@ chip::System::Error InetLayer::HandleInetLayerEvent(chip::System::Object & aTarg static_cast(aTarget).HandleIncomingConnection(reinterpret_cast(aArgument)); break; - case kInetEvent_TCPDataReceived: { - chip::System::PacketBufferHandle buf; - buf.Adopt(reinterpret_cast(aArgument)); - static_cast(aTarget).HandleDataReceived(std::move(buf)); - } - break; + case kInetEvent_TCPDataReceived: + static_cast(aTarget).HandleDataReceived( + System::PacketBufferHandle::Create(reinterpret_cast(aArgument))); + break; case kInetEvent_TCPDataSent: static_cast(aTarget).HandleDataSent(static_cast(aArgument)); @@ -1083,21 +1081,17 @@ chip::System::Error InetLayer::HandleInetLayerEvent(chip::System::Object & aTarg #endif // INET_CONFIG_ENABLE_TCP_ENDPOINT #if INET_CONFIG_ENABLE_RAW_ENDPOINT - case kInetEvent_RawDataReceived: { - chip::System::PacketBufferHandle buf; - buf.Adopt(reinterpret_cast(aArgument)); - static_cast(aTarget).HandleDataReceived(std::move(buf)); - } - break; + case kInetEvent_RawDataReceived: + static_cast(aTarget).HandleDataReceived( + System::PacketBufferHandle::Create(reinterpret_cast(aArgument))); + break; #endif // INET_CONFIG_ENABLE_RAW_ENDPOINT #if INET_CONFIG_ENABLE_UDP_ENDPOINT - case kInetEvent_UDPDataReceived: { - chip::System::PacketBufferHandle buf; - buf.Adopt(reinterpret_cast(aArgument)); - static_cast(aTarget).HandleDataReceived(std::move(buf)); - } - break; + case kInetEvent_UDPDataReceived: + static_cast(aTarget).HandleDataReceived( + System::PacketBufferHandle::Create(reinterpret_cast(aArgument))); + break; #endif // INET_CONFIG_ENABLE_UDP_ENDPOINT #if INET_CONFIG_ENABLE_DNS_RESOLVER diff --git a/src/platform/EFR32/BLEManagerImpl.cpp b/src/platform/EFR32/BLEManagerImpl.cpp index 5773672d9332c6..c0db6adfc76ce7 100644 --- a/src/platform/EFR32/BLEManagerImpl.cpp +++ b/src/platform/EFR32/BLEManagerImpl.cpp @@ -376,12 +376,8 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLEWriteReceived: { ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - { - System::PacketBufferHandle data_ForNow; - data_ForNow.Adopt(event->CHIPoBLEWriteReceived.Data); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, - std::move(data_ForNow)); - } + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + PacketBufferHandle::Create(event->CHIPoBLEWriteReceived.Data)); } break; diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index 33e842ee7a34d6..b9561c06037b39 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -248,13 +248,10 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); break; - case DeviceEventType::kCHIPoBLEWriteReceived: { - System::PacketBufferHandle data_ForNow; - data_ForNow.Adopt(event->CHIPoBLEWriteReceived.Data); + case DeviceEventType::kCHIPoBLEWriteReceived: HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, - std::move(data_ForNow)); - } - break; + PacketBufferHandle::Create(event->CHIPoBLEWriteReceived.Data)); + break; case DeviceEventType::kCHIPoBLEIndicateConfirm: HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index 2545c3321b7921..bdee4efa422692 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -241,13 +241,10 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); break; - case DeviceEventType::kCHIPoBLEWriteReceived: { - System::PacketBufferHandle data_ForNow; - data_ForNow.Adopt(event->CHIPoBLEWriteReceived.Data); + case DeviceEventType::kCHIPoBLEWriteReceived: HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, - std::move(data_ForNow)); - } - break; + PacketBufferHandle::Create(event->CHIPoBLEWriteReceived.Data)); + break; case DeviceEventType::kCHIPoBLEIndicateConfirm: HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_TX); diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index e11f4085d15bcd..2532f3dcee0dde 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -214,13 +214,10 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); break; - case DeviceEventType::kCHIPoBLEWriteReceived: { - System::PacketBufferHandle data_ForNow; - data_ForNow.Adopt(event->CHIPoBLEWriteReceived.Data); + case DeviceEventType::kCHIPoBLEWriteReceived: HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, - std::move(data_ForNow)); - } - break; + PacketBufferHandle::Create(event->CHIPoBLEWriteReceived.Data)); + break; case DeviceEventType::kCHIPoBLEIndicateConfirm: HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); diff --git a/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp b/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp index eb515eb1302bde..378081925b444f 100644 --- a/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp +++ b/src/platform/Zephyr/GenericBLEManagerImpl_Zephyr.cpp @@ -480,9 +480,8 @@ CHIP_ERROR GenericBLEManagerImpl_Zephyr::HandleRXCharWrite(const Chip ChipLogDetail(DeviceLayer, "Write request received for CHIPoBLE RX characteristic (ConnId 0x%02" PRIx16 ")", bt_conn_index(c1WriteEvent->BtConn)); - PacketBufferHandle data_ForNow; - data_ForNow.Adopt(c1WriteEvent->Data); - HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, std::move(data_ForNow)); + HandleWriteReceived(c1WriteEvent->BtConn, &CHIP_BLE_SVC_ID, &chipUUID_CHIPoBLEChar_RX, + PacketBufferHandle::Create(c1WriteEvent->Data)); bt_conn_unref(c1WriteEvent->BtConn); return CHIP_NO_ERROR;