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
|
//
// RTKDFUPeripheral.h
// RTKOTASDK
//
// Created by jerome_gu on 2019/4/16.
// Copyright © 2019 Realtek. All rights reserved.
//
#ifdef RTK_SDK_IS_STATIC_LIBRARY
#import "libRTKLEFoundation.h"
#import "RTKOTAPeripheral.h"
#import "RTKOTAUpgradeBin.h"
#else
#import <RTKLEFoundation/RTKLEFoundation.h>
#import <RTKOTASDK/RTKOTAPeripheral.h>
#import <RTKOTASDK/RTKOTAUpgradeBin.h>
#endif
typedef enum : NSUInteger {
RTKDFUPhaseNone,
RTKDFUPhaseSending,
RTKDFUPhaseActivating,
RTKDFUPhaseResetting,
RTKDFUPhaseCanceling,
RTKDFUPhaseReconnecting,
RTKDFUPhaseEncounterError,
} RTKDFUPhase;
NS_ASSUME_NONNULL_BEGIN
@class RTKDFUPeripheral;
@protocol RTKDFUPeripheralDelegate <RTKLEPeripheralDelegate>
@required
- (void)DFUPeripheral:(RTKDFUPeripheral *)peripheral didFinishWithError:(nullable NSError *)err;
@optional
- (void)DFUPeripheral:(RTKDFUPeripheral *)peripheral didSend:(NSUInteger)length totalToSend:(NSUInteger)totalLength;
- (BOOL)DFUPeripheral:(RTKDFUPeripheral *)peripheral shouldWaitForDisconnectionOnCompleteSend:(RTKOTAUpgradeBin *)image;
@end
@class RTKOTAProfile;
@interface RTKDFUPeripheral : RTKLEPeripheral {
@protected
RTKDFUPhase _phase;
RTKOTAUpgradeBin *_upgradingImage;
}
@property (nonatomic, weak) id <RTKDFUPeripheralDelegate> delegate;
@property (nonatomic, readonly) RTKOTAPeripheral *OTAPeripheral;
@property (nonatomic, readonly) RTKDFUPhase phase;
@property (readonly, nullable) RTKOTAUpgradeBin *upgradingImage;
/**
* The AES key, used to encrypte image data when peripheral support.
* @discussion If no encryptKey set, the default key is used.
*/
- (void)setEncryptKey:(NSData * _Nonnull)encryptKey;
- (instancetype)initWithCBPeripheral:(CBPeripheral *)peripheral OTAPeripheral:(nullable RTKOTAPeripheral *)OTAPeri profile:(RTKOTAProfile *)profile;
- (void)upgradeImage:(RTKOTAUpgradeBin *)image;
- (void)cancelUpgrade;
@property (nonatomic) NSUInteger retryCountWhenBufferCheckFail;
/* Protected */
@property (readonly) RTKPackageCommunication *controlPoint;
- (void)beginWaitForLEDisconnection;
- (void)cancelWaitForLEDisconnection;
- (void)handleActiveMessageSendCompletion:(BOOL)success withError:(nullable NSError *)err;
/**
* 模板方法,不要在外部调用
*/
- (void)sendReceiveFWImageMessage;
- (void)sendValidateImageMessage;
- (void)sendActiveResetToNormalMessage;
- (void)sendActiveResetToOTAMessage;
- (void)getImageVersionsOf:(BOOL)activeBank withCompletionHandler:(void(^)(BOOL success, NSError *error, NSArray<RTKOTAInstalledBin*> *bins))handler;
typedef NS_OPTIONS(uint32_t, RTKDFUTestModeFlag) {
RTKDFUTestModeFlag_AES = 1 << 0,
RTKDFUTestModeFlag_Stress = 1 << 1,
RTKDFUTestModeFlag_CopyFail = 1 << 2,
RTKDFUTestModeFlag_SkipFail = 1 << 3,
RTKDFUTestModeFlag_BufferCheckDisable = 1 << 4,
};
@property (nonatomic) RTKDFUTestModeFlag testFlag;
- (void)handleImageSendCompletion;
- (void)reportDFUCommunicationFailWithError:(NSError *)err;
- (BOOL)upgradeCanceledInspect;
/**
* Connection Parameter Update 参数单位:ms
*/
-(void)setConnectionParametersWithMinInterval:(uint16_t)intervalMin maxInterval:(uint16_t)intervalMax latency:(uint16_t)latency supervisionTimeout:(uint16_t)timeout;
@end
NS_ASSUME_NONNULL_END
|