-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathHAPAccessorySetupInfo.h
130 lines (112 loc) · 3.83 KB
/
HAPAccessorySetupInfo.h
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
127
128
129
130
// Copyright (c) 2015-2019 The HomeKit ADK Contributors
//
// Licensed under the Apache License, Version 2.0 (the “License”);
// you may not use this file except in compliance with the License.
// See [CONTRIBUTORS.md] for the list of HomeKit ADK project authors.
#ifndef HAP_ACCESSORY_SETUP_INFO_H
#define HAP_ACCESSORY_SETUP_INFO_H
#ifdef __cplusplus
extern "C" {
#endif
#include "HAP+Internal.h"
#if __has_feature(nullability)
#pragma clang assume_nonnull begin
#endif
/**
* Duration after which a dynamic setup code expires.
*
* @see HomeKit Accessory Protocol Specification R14
* Section 4.4.2.1 Requirements
*/
#define kHAPAccessorySetupInfo_DynamicRefreshInterval ((HAPTime)(5 * HAPMinute))
/**
* Fetches the currently active setup info.
*
* - This may only be called while a pairing attempt is in progress.
*
* @param server Accessory server.
* @param restorePrevious Whether or not a setup info from a previous pairing attempt should be reused.
*
* @return Setup info, if available. NULL otherwise. Always non-NULL if restorePrevious is false.
*/
HAPSetupInfo* _Nullable HAPAccessorySetupInfoGetSetupInfo(HAPAccessoryServerRef* server, bool restorePrevious);
/**
* Handles accessory server start.
*
* - This starts periodically generating setup codes for displays.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoHandleAccessoryServerStart(HAPAccessoryServerRef* server);
/**
* Handles accessory server stop.
*
* - This invalidates generated setup codes for displays and exits NFC pairing mode.
*
* - Must not be called if there are still active connections.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoHandleAccessoryServerStop(HAPAccessoryServerRef* server);
/**
* Handles accessory server state update.
*
* - This starts periodically generating setup codes for displays if the accessory server was unpaired.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoHandleAccessoryServerStateUpdate(HAPAccessoryServerRef* server);
/**
* Handles start of a pairing attempt.
*
* - This locks the current setup code so it does not change during the pairing attempt.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoHandlePairingStart(HAPAccessoryServerRef* server);
/**
* Handles completion of a pairing attempt.
*
* - If pairing is successful, this stops advertising a setup code.
* Otherwise for displays a new setup code is generated.
*
* @param server Accessory server.
* @param keepSetupInfo Whether or not the current setup info should be preserved for next pairing attempt.
*/
void HAPAccessorySetupInfoHandlePairingStop(HAPAccessoryServerRef* server, bool keepSetupInfo);
/**
* Refreshes the setup payload.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoRefreshSetupPayload(HAPAccessoryServerRef* server);
/**
* Enters NFC pairing mode.
*
* - NFC pairing mode exits automatically after 5 minutes or when pairing completes.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoEnterNFCPairingMode(HAPAccessoryServerRef* server);
/**
* Exits NFC pairing mode.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoExitNFCPairingMode(HAPAccessoryServerRef* server);
/**
* Enters legacy pairing mode.
*
* - Legacy pairing mode exits automatically after 5 minutes or when pairing completes or is cancelled.
* In legacy pairing mode, displays are not refreshed automatically.
*
* @param server Accessory server.
*/
void HAPAccessorySetupInfoEnterLegacyPairingMode(HAPAccessoryServerRef* server);
#if __has_feature(nullability)
#pragma clang assume_nonnull end
#endif
#ifdef __cplusplus
}
#endif
#endif