75d24c15
yangbin
123
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
//
// RTKOTACoordinator.h
// RTKOTASDK
//
// Created by jerome_gu on 2020/3/19.
// Copyright © 2020 jerome_gu. All rights reserved.
//
#import <Foundation/Foundation.h>
#ifdef RTK_SDK_IS_STATIC_LIBRARY
#import "RTKOTAUpgradeBin.h"
#import "RTKOTADeviceInfo.h"
#import "RTKOTAUpgrade.h"
#else
#import <RTKOTASDK/RTKOTAUpgradeBin.h>
#import <RTKOTASDK/RTKOTADeviceInfo.h>
#import <RTKOTASDK/RTKOTAUpgrade.h>
#endif
NS_ASSUME_NONNULL_BEGIN
@class RTKOTACoordinator;
/**
* The RTKOTACoordinatorDelegate protocol defines methods that you use to receive events from an RTKOTACoordinator object.
*/
@protocol RTKOTACoordinatorDelegate <NSObject>
@optional
/**
* Tells the delegate that the remote device information is determined.
*/
- (void)OTACoordinatorDidBeReadyForUpgrade:(RTKOTACoordinator *)coordinator withDeviceInfo:(RTKOTADeviceInfo *)info;
/**
* Tells the delegate that coordinator could not get ready for upgrade.
*/
- (void)OTACoordinator:(RTKOTACoordinator *)coordinator couldNotUpgradeWithError:(NSError *)error;
/**
* Tells the delegate that a image will be send to remote device.
*/
- (void)OTACoordinator:(RTKOTACoordinator *)coordinator willUpgradeImage:(RTKOTAUpgradeBin *)image;
/**
* Tells the delegate that a image did be send to remote device.
*/
- (void)OTACoordinator:(RTKOTACoordinator *)coordinator didUpgradeImage:(RTKOTAUpgradeBin *)image;
/**
* Tells the delegate that images did take effect in remote device.
*/
- (void)OTACoordinator:(RTKOTACoordinator *)coordinator didActiveImages:(NSArray<RTKOTAUpgradeBin*>*)images;
/**
* Tells the delegate that upgrade task did finish. If upgrade succees, the error parameter is nil, otherwise a error object is passed in.
*/
- (void)OTACoordinator:(RTKOTACoordinator *)coordinator didCompleteUpgradeWithError:(nullable NSError *)error;
@end
/**
* The RTKOTACoordinator object is responsible for coordinate OTA upgrades of multiple images on one remote device or both RWS buds.
* It is an abstract class encapsulating the common API to RTKAccessoryOTACoordinator and RTKLEOTACoordinator. You should use the concrete OTACoordinator instance.
*/
@interface RTKOTACoordinator : NSObject <NSProgressReporting, RTKOTAUpgradeDelegate>
/**
* The delegate object specified to receive OTA upgrade events.
*/
@property (nonatomic, weak) id<RTKOTACoordinatorDelegate> delegate;
/**
* The actual upgrade object current in effect.
*/
@property (nonatomic, readonly) RTKOTAUpgrade *upgrade;
/**
* Indicate whether there is upgrading task now.
*/
@property (nonatomic, readonly) BOOL isUpgrading;
/**
* The upgrade image current upgrading.
*/
@property (nonatomic, readonly, nullable) RTKOTAUpgradeBin *imageInUpgrading;
/**
* Start a upgrade with one image.
*
* @discussion If upgrade more than one images, use -upgradeWithImages: instead.
*/
- (void)upgradeWithImage:(RTKOTAUpgradeBin *)image;
/**
* The upgrade images current upgrading.
*/
@property (readonly, nullable) NSArray <RTKOTAUpgradeBin*> *upgradeImages;
/**
* Start upgrade with multiple images.
*
* @discussion According to peripheral capability and state, reboot may occur between one or several image upgrade.
*/
- (void)upgradeWithImages:(NSArray <RTKOTAUpgradeBin*> *)images;
/**
* Start upgrade with each images to RWS buds.
*
* @discussion When upgrading RWS pair, each bud will be upgraded using -upgradeWithImages: with corresponding images. When upgrade the other bud, the bud object is assigned automatically(eg LE) or manually (eg iAP).
*/
- (void)upgradeRWSWithPrimaryBudImages:(NSArray <RTKOTAUpgradeBin*> *)primaryImages secondaryBudImages:(NSArray <RTKOTAUpgradeBin*> *)secondaryImages;
/**
* Cancel ongoing upgrade task.
*/
- (void)cancelUpgrade;
@end
NS_ASSUME_NONNULL_END
|