RTKAccessoryOTACoordinator.h
2.45 KB
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
//
// RTKAccessoryOTACoordinator.h
// RTKOTASDK
//
// Created by jerome_gu on 2020/3/10.
// Copyright © 2020 jerome_gu. All rights reserved.
//
#import <Foundation/Foundation.h>
#ifdef RTK_SDK_IS_STATIC_LIBRARY
#import "RTKOTACoordinator.h"
#else
#import <RTKOTASDK/RTKOTACoordinator.h>
#endif
NS_ASSUME_NONNULL_BEGIN
@class RTKAccessoryOTACoordinator;
@protocol RTKAccessoryOTACoordinatorDelegate <RTKOTACoordinatorDelegate>
@optional
/**
* Return a time interval used when wait for connection with accessory. If not be implemeted, the defaut 30 seconds is used.
*/
- (NSTimeInterval)timeoutIntervalForConnectionOfOTACoordinator:(RTKAccessoryOTACoordinator *)coordinator;
/**
* Request delegate object to reconnect the accessory.
*/
- (void)OTACoordinator:(RTKAccessoryOTACoordinator *)coordinator requestToReconnectTo:(RTKAccessory *)accessory;
/**
* Request delegate object to connect the companion accessory.
*
* @discussion When the companion accessory connected, you should call -onConnectedToCompanionAccessory:ofAccessory: to specify the companion accessory.
*/
- (void)OTACoordinator:(RTKAccessoryOTACoordinator *)coordinator requestToConnectToCompanionOf:(RTKAccessory *)accessory;
@end
/**
* A concrete RTKOTACoordinator class which is dedicated to iAP accessory OTA upgrade.
*/
@interface RTKAccessoryOTACoordinator : RTKOTACoordinator
@property (nonatomic, weak) id<RTKAccessoryOTACoordinatorDelegate> delegate;
/**
* The accessory current in upgrading.
*/
@property (nonatomic, readonly, nullable) RTKAccessory *upgradingAccessory;
/**
* Before start a upgrade, you call -prepareForAccessory: or -prepareForAccessory:ofAccessory: to specify the upgrading target device.
*
* @discussion This method will communicate with accessory exclusively. Any exist communication will become invalid.
*/
- (void)prepareForAccessory:(RTKAccessory *)accessory;
/**
* Specify a upgrading accessory with already created underlying message communication channel. This is usally used when a message communication is created for another interaction.
*/
- (void)prepareForAccessory:(RTKAccessory *)accessory withExistMessageCommunication:(RTKPackageCommunication *)messageCommunication;
/**
* Call this method to specify the companion accessory and start upgrade of the companion accessory. the companion accessory must be connected.
*/
- (void)onConnectedToCompanionAccessory:(RTKAccessory *)companionAccessory ofAccessory:(RTKAccessory *)accessory;
@end
NS_ASSUME_NONNULL_END