-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ReadClient and ReaderHandler and interactionModelDelegate
Problem: Need read client to send IM read request and process report and read handler to process read request, need interaction model delegate to notify zcl the actions in corresponse for particular IM callback. Summary of Changes: -- Add read client to send IM read request and process report. -- Add read handler to process read request -- Add interaction model delgate to notify when each IM event stream is received and all reports have been received and so on. Note: This is PR splited from large PR #4800
- Loading branch information
1 parent
12bcaa7
commit 5e33b73
Showing
16 changed files
with
1,259 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* | ||
* Copyright (c) 2021 Project CHIP Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* @file | ||
* This file defines the delegate the SDK consumer needs to implement to receive notifications from the interaction model. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <core/CHIPCore.h> | ||
#include <messaging/ExchangeContext.h> | ||
#include <system/SystemPacketBuffer.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
class ReadClient; | ||
struct EventPathParams; | ||
|
||
/** | ||
* @brief | ||
* This class defines the API for a delegate that an SDK consumer can use to interface with the interaction model. | ||
*/ | ||
class InteractionModelDelegate | ||
{ | ||
public: | ||
/** | ||
* Notification that the interaction model has received a list of events in response to a Read request and that list | ||
* of events needs to be processed. | ||
* @param[in] apExchangeContext An exchange context that represents the exchange the Report Data came in on. | ||
* This can be used to recover the NodeId of the node that sent the Report Data. | ||
* It is managed externally and should not be closed by the SDK consumer. | ||
* @param[in] apEventListReader TLV reader positioned at the list that contains the events. The | ||
* implementation of EventStreamReceived is expected to call Next() on the reader to | ||
* advance it to the first element of the list, then process the elements from beginning to the | ||
* end. The callee is expected to consume all events. | ||
* | ||
* @retval # CHIP_ERROR_NOT_IMPLEMENTED if not implemented | ||
*/ | ||
virtual CHIP_ERROR EventStreamReceived(const Messaging::ExchangeContext * apExchangeContext, TLV::TLVReader * apEventListReader) | ||
{ | ||
return CHIP_ERROR_NOT_IMPLEMENTED; | ||
} | ||
|
||
/** | ||
* Notification that the last message for a Report Data action for the given ReadClient has been received and processed. | ||
* @param[in] apReadClient A current readClient which can identify the read to the consumer, particularly during | ||
* multiple read interactions | ||
* @retval # CHIP_ERROR_NOT_IMPLEMENTED if not implemented | ||
*/ | ||
virtual CHIP_ERROR ReportProcessed(const ReadClient * apReadClient) { return CHIP_ERROR_NOT_IMPLEMENTED; } | ||
|
||
/** | ||
* Notification that a read attempt encountered an asynchronous failure. | ||
* @param[in] apReadClient A current readClient which can identify the read to the consumer, particularly during | ||
* multiple read interactions | ||
* @param[in] aError A error that could be CHIP_ERROR_TIMEOUT when read client fails to receive, or other error when | ||
* fail to process report data. | ||
* @retval # CHIP_ERROR_NOT_IMPLEMENTED if not implemented | ||
*/ | ||
virtual CHIP_ERROR ReportError(const ReadClient * apReadClient, CHIP_ERROR aError) { return CHIP_ERROR_NOT_IMPLEMENTED; } | ||
|
||
virtual ~InteractionModelDelegate() = default; | ||
}; | ||
|
||
} // namespace app | ||
} // namespace chip |
Oops, something went wrong.