From 085cea9df1f04db61f8f2d1d4aae43af0a2d0f6f Mon Sep 17 00:00:00 2001 From: yunhanw Date: Wed, 8 Dec 2021 23:57:55 -0800 Subject: [PATCH] MinInternval is allowed to equal to MaxInterval Per IM spec --- src/app/ReadClient.cpp | 2 +- src/app/ReadHandler.cpp | 2 +- src/app/tests/integration/chip_im_initiator.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 2110044bd996b3..5f51a5d60716e8 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -635,7 +635,7 @@ CHIP_ERROR ReadClient::SendSubscribeRequest(ReadPrepareParams & aReadPreparePara VerifyOrExit(mpCallback != nullptr, err = CHIP_ERROR_INCORRECT_STATE); msgBuf = System::PacketBufferHandle::New(kMaxSecureSduLengthBytes); VerifyOrExit(!msgBuf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - VerifyOrExit(aReadPrepareParams.mMinIntervalFloorSeconds < aReadPrepareParams.mMaxIntervalCeilingSeconds, + VerifyOrExit(aReadPrepareParams.mMinIntervalFloorSeconds <= aReadPrepareParams.mMaxIntervalCeilingSeconds, err = CHIP_ERROR_INVALID_ARGUMENT); writer.Init(std::move(msgBuf)); diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 6587d56c5effd4..6564f6f7f6e47d 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -604,7 +604,7 @@ CHIP_ERROR ReadHandler::ProcessSubscribeRequest(System::PacketBufferHandle && aP ReturnErrorOnFailure(subscribeRequestParser.GetMinIntervalFloorSeconds(&mMinIntervalFloorSeconds)); ReturnErrorOnFailure(subscribeRequestParser.GetMaxIntervalCeilingSeconds(&mMaxIntervalCeilingSeconds)); - VerifyOrReturnError(mMinIntervalFloorSeconds < mMaxIntervalCeilingSeconds, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(mMinIntervalFloorSeconds <= mMaxIntervalCeilingSeconds, CHIP_ERROR_INVALID_ARGUMENT); ReturnErrorOnFailure(subscribeRequestParser.GetIsFabricFiltered(&mIsFabricFiltered)); ReturnErrorOnFailure(Crypto::DRBG_get_bytes(reinterpret_cast(&mSubscriptionId), sizeof(mSubscriptionId))); diff --git a/src/app/tests/integration/chip_im_initiator.cpp b/src/app/tests/integration/chip_im_initiator.cpp index 44b9ed4f4479ff..c317ec59db2178 100644 --- a/src/app/tests/integration/chip_im_initiator.cpp +++ b/src/app/tests/integration/chip_im_initiator.cpp @@ -391,7 +391,7 @@ CHIP_ERROR SendSubscribeRequest() readPrepareParams.mAttributePathParamsListSize = 1; - readPrepareParams.mMinIntervalFloorSeconds = 2; + readPrepareParams.mMinIntervalFloorSeconds = 5; readPrepareParams.mMaxIntervalCeilingSeconds = 5; printf("\nSend subscribe request message to Node: %" PRIu64 "\n", chip::kTestDeviceNodeId);