blob: 1b70e43e01be1a0794c231191a74a67f07cd43fb [file] [log] [blame]
/**
*
* 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
typedef void (^MTRQueryImageCompletionHandler)(
MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable data, NSError * _Nullable error);
typedef void (^MTRApplyUpdateRequestCompletionHandler)(
MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable data, NSError * _Nullable error);
typedef void (^MTRBDXQueryCompletionHandler)(NSData * _Nullable data, BOOL isEOF);
/**
* The protocol definition for the MTROTAProviderDelegate
*
* All delegate methods will be called on the supplied Delegate Queue.
*/
@protocol MTROTAProviderDelegate <NSObject>
@required
/**
* Notify the delegate when the query image command is received from some node.
* The controller identifies the fabric the node is on, and the nodeID
* identifies the node within that fabric.
*
* If completion is passed a non-nil error, that will be converted into
* an error response to the client. Otherwise it must have a non-nil data,
* which will be returned to the client.
*/
- (void)handleQueryImageForNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller
params:(MTROTASoftwareUpdateProviderClusterQueryImageParams *)params
completion:(MTRQueryImageCompletionHandler)completion;
/**
* Notify the delegate when the apply update request command is received from
* some node. The controller identifies the fabric the node is on, and the
* nodeID identifies the node within that fabric.
*
* If completion is passed a non-nil error, that will be converted into
* an error response to the client. Otherwise it must have a non-nil data,
* which will be returned to the client.
*/
- (void)handleApplyUpdateRequestForNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller
params:(MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams *)params
completion:(MTRApplyUpdateRequestCompletionHandler)completion;
/**
* Notify the delegate when the notify update applied command is received from
* some node. The controller identifies the fabric the node is on, and the
* nodeID identifies the node within that fabric.
*
* If completion is passed a non-nil error, that will be converted into
* an error response to the client. Otherwise a success response will be sent.
*/
- (void)handleNotifyUpdateAppliedForNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller
params:(MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams *)params
completion:(MTRStatusCompletion)completion;
/**
* Notify the delegate when a BDX Session starts for some node. The controller
* identifies the fabric the node is on, and the nodeID identifies the node
* within that fabric.
*/
- (void)handleBDXTransferSessionBeginForNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller
fileDesignator:(NSString *)fileDesignator
offset:(NSNumber *)offset
completion:(MTRStatusCompletion)completion;
/**
* Notify the delegate when a BDX Session ends for some node. The controller
* identifies the fabric the node is on, and the nodeID identifies the node
* within that fabric.
*/
- (void)handleBDXTransferSessionEndForNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller
error:(NSError * _Nullable)error;
/**
* Notify the delegate when a BDX Query message has been received for some node.
* The controller identifies the fabric the node is on, and the nodeID
* identifies the node within that fabric.
*/
- (void)handleBDXQueryForNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller
blockSize:(NSNumber *)blockSize
blockIndex:(NSNumber *)blockIndex
bytesToSkip:(NSNumber *)bytesToSkip
completion:(MTRBDXQueryCompletionHandler)completion;
@end
NS_ASSUME_NONNULL_END