-
Notifications
You must be signed in to change notification settings - Fork 232
/
Copy pathHAPBLEAccessoryServer+Broadcast.h
109 lines (97 loc) · 3.61 KB
/
HAPBLEAccessoryServer+Broadcast.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
// 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_BLE_ACCESSORY_SERVER_BROADCAST_H
#define HAP_BLE_ACCESSORY_SERVER_BROADCAST_H
#ifdef __cplusplus
extern "C" {
#endif
#include "HAP+Internal.h"
#if __has_feature(nullability)
#pragma clang assume_nonnull begin
#endif
/**
* BLE: Broadcast encryption key.
*
* @see HomeKit Accessory Protocol Specification R14
* Section 7.4.7.3 Broadcast Encryption Key Generation
*/
typedef struct {
uint8_t value[32]; /**< Value. */
} HAPBLEAccessoryServerBroadcastEncryptionKey;
HAP_STATIC_ASSERT(
sizeof(HAPBLEAccessoryServerBroadcastEncryptionKey) == 32,
HAPBLEAccessoryServerBroadcastEncryptionKey);
HAP_NONNULL_SUPPORT(HAPBLEAccessoryServerBroadcastEncryptionKey)
/**
* BLE: Fetches broadcast encryption key parameters.
*
* @param keyValueStore Key-value store.
* @param[out] keyExpirationGSN GSN after which the broadcast encryption key expires. 0 if key is expired.
* @param[out] broadcastKey Broadcast encryption key, if available.
* @param[out] advertisingID Accessory advertising identifier.
*
* @return kHAPError_None If successful.
* @return kHAPError_Unknown If an I/O error occurred.
*
* @see HomeKit Accessory Protocol Specification R14
* Section 7.4.7.3 Broadcast Encryption Key Generation
*/
HAP_RESULT_USE_CHECK
HAPError HAPBLEAccessoryServerBroadcastGetParameters(
HAPPlatformKeyValueStoreRef keyValueStore,
uint16_t* keyExpirationGSN,
HAPBLEAccessoryServerBroadcastEncryptionKey* _Nullable broadcastKey,
HAPDeviceID* _Nullable advertisingID);
/**
* BLE: Generate a new broadcast encryption key.
*
* @param session Session that requested generation of the broadcast encryption key. Must be secured.
* @param advertisingID New accessory advertising identifier. If null, the identifier is not changed.
*
* @return kHAPError_None If successful.
* @return kHAPError_Unknown If an I/O error occurred.
*
* @see HomeKit Accessory Protocol Specification R14
* Section 7.4.7.3 Broadcast Encryption Key Generation
*/
HAP_RESULT_USE_CHECK
HAPError HAPBLEAccessoryServerBroadcastGenerateKey(HAPSessionRef* session, const HAPDeviceID* _Nullable advertisingID);
/**
* BLE: Set accessory advertising identifier.
*
* @param keyValueStore Key-value store.
* @param advertisingID New accessory advertising identifier.
*
* @return kHAPError_None If successful.
* @return kHAPError_Unknown If an I/O error occurred.
*
* @see HomeKit Accessory Protocol Specification R14
* Section 7.4.7.3 Broadcast Encryption Key Generation
*/
HAP_RESULT_USE_CHECK
HAPError HAPBLEAccessoryServerBroadcastSetAdvertisingID(
HAPPlatformKeyValueStoreRef keyValueStore,
const HAPDeviceID* advertisingID);
/**
* BLE: Invalidate broadcast encryption key.
*
* @param keyValueStore Key-value store.
*
* @return kHAPError_None If successful.
* @return kHAPError_Unknown If an I/O error occurred.
*
* @see HomeKit Accessory Protocol Specification R14
* Section 7.4.7.4 Broadcast Encryption Key expiration and refresh
*/
HAP_RESULT_USE_CHECK
HAPError HAPBLEAccessoryServerBroadcastExpireKey(HAPPlatformKeyValueStoreRef keyValueStore);
#if __has_feature(nullability)
#pragma clang assume_nonnull end
#endif
#ifdef __cplusplus
}
#endif
#endif