-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store UserActiveModeTriggerBitmap into ICD storage
- Loading branch information
1 parent
44ea4eb
commit 84dfc33
Showing
4 changed files
with
104 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* | ||
* Copyright (c) 2023 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "ICDClientInfo.h" | ||
#include "ICDStorageKeyDelegate.h" | ||
#include <crypto/CHIPCryptoPAL.h> | ||
#include <lib/core/CHIPConfig.h> | ||
#include <lib/core/CHIPPersistentStorageDelegate.h> | ||
#include <lib/core/DataModelTypes.h> | ||
#include <lib/core/ScopedNodeId.h> | ||
#include <lib/support/CodeUtils.h> | ||
#include <lib/support/CommonIterator.h> | ||
#include <lib/support/StorageKeyName.h> | ||
#include <stddef.h> | ||
|
||
namespace chip { | ||
namespace app { | ||
|
||
/** | ||
* The ICDClientStorage class is an abstract interface that defines the operations | ||
* for storing, retrieving and deleting ICD client information in persistent storage. | ||
*/ | ||
class ICDClientStorage | ||
{ | ||
public: | ||
using ICDClientInfoIterator = CommonIterator<ICDClientInfo>; | ||
|
||
virtual ~ICDClientStorage() = default; | ||
|
||
/** | ||
* Iterate through persisted ICD Client Info | ||
* | ||
* @return A valid iterator on success. Use CommonIterator accessor to retrieve ICDClientInfo | ||
*/ | ||
virtual ICDClientInfoIterator * IterateICDClientInfo() = 0; | ||
|
||
/** | ||
* Called during ICD device registration in commissioning, sdk provides the clientInfo and application | ||
* provides raw key data, the shared key handle in clientInfo is updated based upon raw key data | ||
* | ||
* @param[inout] aICDClientInfo the ICD Client information to be updated with keyData and be saved | ||
* @param[in] aKeyData raw key data provided by application | ||
*/ | ||
virtual CHIP_ERROR SetKey(ICDClientInfo & aClientInfo, const ByteSpan aKeyData) = 0; | ||
|
||
/** | ||
* Store updated ICD ClientInfo to storage when ICD registration completes or check-in message | ||
* comes. | ||
* | ||
* @param[in] aICDClientInfo the updated ICD Client Info. | ||
*/ | ||
virtual CHIP_ERROR StoreEntry(ICDClientInfo & aICDClientInfo) = 0; | ||
/** | ||
* Delete ICD Client persistent information associated with the specified scoped node Id. | ||
* when ICD device is unpaired/removed, the corresponding entry in ICD storage is removed. | ||
* @param aPeerNodeId scoped node with peer node id and fabric index | ||
*/ | ||
virtual CHIP_ERROR DeleteEntry(ScopedNodeId aPeerNodeId) = 0; | ||
|
||
/** | ||
* Remove all ICDClient persistent informations associated with the specified | ||
* fabric index. If no entries for the fabric index exist, this is a no-op | ||
* and is considered successful. | ||
* When the whole fabric is removed, all entries from persistent storage in current fabric index is removed. | ||
* | ||
* @param[in] fabricIndex the index of the fabric for which to remove ICDClient persistent information | ||
*/ | ||
virtual CHIP_ERROR DeleteAllEntries(FabricIndex aFabricIndex) = 0; | ||
|
||
/** | ||
* Validate received ICD Check-in message payload, return true when the key decription is successful | ||
* Consumer has to provide keys and see whether it's the right key, then return the correponding ICDClientInfo | ||
* @param[in] aPayload received checkIn Message payload | ||
* @param[out] ICDClientInfo matched clientInfo | ||
*/ | ||
virtual bool ValidateCheckInPayload(const ByteSpan & aPayload, ICDClientInfo & aClientInfo) = 0; | ||
}; | ||
} // namespace app | ||
} // namespace chip |