-
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.
[OTA] Add Darwin Framework APIs for OTA Provider delegate (#20295)
- Loading branch information
1 parent
86f66d8
commit 2447504
Showing
5 changed files
with
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* | ||
* Copyright (c) 2022 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. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Matter/Matter.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* The protocol definition for the MTROTAProviderDelegate | ||
* | ||
* All delegate methods will be called on the supplied Delegate Queue. | ||
*/ | ||
@protocol MTROTAProviderDelegate <NSObject> | ||
@optional | ||
/** | ||
* Notify the delegate when query image command is received | ||
* | ||
*/ | ||
- (void)handleQueryImage:(MTROtaSoftwareUpdateProviderClusterQueryImageParams *)params | ||
completionHandler:(void (^)(MTROtaSoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, | ||
NSError * _Nullable error))completionHandler; | ||
|
||
/** | ||
* Notify the delegate when apply update request command is received | ||
* | ||
*/ | ||
- (void)handleApplyUpdateRequest:(MTROtaSoftwareUpdateProviderClusterApplyUpdateRequestParams *)params | ||
completionHandler:(void (^)(MTROtaSoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, | ||
NSError * _Nullable error))completionHandler; | ||
|
||
/** | ||
* Notify the delegate when notify update applied command is received | ||
* | ||
*/ | ||
- (void)handleNotifyUpdateApplied:(MTROtaSoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params | ||
completionHandler:(StatusCompletion)completionHandler; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
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,49 @@ | ||
/** | ||
* | ||
* Copyright (c) 2022 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. | ||
*/ | ||
|
||
#import "MTROTAProviderDelegate.h" | ||
|
||
#include <app/clusters/ota-provider/ota-provider-delegate.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
class MTROTAProviderDelegateBridge : public chip::app::Clusters::OTAProviderDelegate | ||
{ | ||
public: | ||
MTROTAProviderDelegateBridge(); | ||
~MTROTAProviderDelegateBridge(); | ||
|
||
void setDelegate(id<MTROTAProviderDelegate> delegate, dispatch_queue_t queue); | ||
|
||
void HandleQueryImage( | ||
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, | ||
const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::DecodableType & commandData) override; | ||
|
||
void HandleApplyUpdateRequest( | ||
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, | ||
const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::DecodableType & commandData) override; | ||
|
||
void HandleNotifyUpdateApplied( | ||
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, | ||
const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::DecodableType & commandData) override; | ||
|
||
private: | ||
_Nullable id<MTROTAProviderDelegate> mDelegate; | ||
_Nullable dispatch_queue_t mQueue; | ||
}; | ||
|
||
NS_ASSUME_NONNULL_END |
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