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
|
//
// RTKOTAUpgrade.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 "RTKOTAPeripheral.h"
#import "RTKDFUPeripheral.h"
#else
#import <RTKOTASDK/RTKOTAUpgradeBin.h>
#import <RTKOTASDK/RTKOTADeviceInfo.h>
#import <RTKOTASDK/RTKOTAPeripheral.h>
#import <RTKOTASDK/RTKDFUPeripheral.h>
#endif
NS_ASSUME_NONNULL_BEGIN
@class RTKOTAUpgrade;
@protocol RTKOTAUpgradeDelegate<NSObject>
@optional
- (void)OTAUpgradeDidGetReadyForUpgrade:(RTKOTAUpgrade *)upgradeController;
- (void)OTAUpgrade:(RTKOTAUpgrade *)upgradeController couldNotUpgradeWithError:(NSError *)err;
- (BOOL)OTAUpgradeShouldActiveSendedImage:(RTKOTAUpgrade *)upgradeController;
- (void)OTAUpgrade:(RTKOTAUpgrade *)upgradeController didFinishWithError:(nullable NSError *)err;
@end
/**
* RTKOTAUpgrade is a abstract class which provide common upgrade API.
*
* @discussion Not like RTKOTACoordinator, a RTKOTAUpgrade represents a upgrade task.
*/
@interface RTKOTAUpgrade : NSObject <NSProgressReporting> {
@protected
RTKDFUPhase _phase;
RTKOTAUpgradeBin *_upgradingImage;
}
@property (nonatomic, weak) id<RTKOTAUpgradeDelegate> delegate;
/**
* Start the preparation for upgrad.
*/
- (void)prepareForUpgrade;
/**
* The OTA related information.
*
* @discussion The deviceInfo is determined when -[RTKOTAUpgradeDelegate OTAUpgradeDidGetReadyForUpgrade:] get called.
*/
@property (nonatomic, nullable) RTKOTADeviceInfo *deviceInfo;
/**
* The image is current upgrading.
*/
@property (readonly, nullable) RTKOTAUpgradeBin *upgradingImage;
@property (nonatomic, readonly) RTKDFUPhase phase;
/**
* Start upgrade image.
*/
- (void)upgradeImage:(RTKOTAUpgradeBin *)image;
/**
* Cancel ongoing upgrade.
*/
- (void)cancelUpgrade;
@end
NS_ASSUME_NONNULL_END
|