forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMTRControllerFactory.h
137 lines (117 loc) · 4.21 KB
/
MTRControllerFactory.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
131
132
133
134
135
136
137
/**
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* An object that allows creating Matter controllers. There can be only one such
* object in a given process.
*/
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol MTRStorage;
@protocol MTRPersistentStorageDelegate;
@protocol MTROTAProviderDelegate;
@protocol MTRKeypair;
@class MTRDeviceController;
@class MTRDeviceControllerStartupParams;
@interface MTRControllerFactoryParams : NSObject
/*
* Storage delegate must be provided for correct functioning of Matter
* controllers. It is used to store persistent information for the fabrics the
* controllers ends up interacting with.
*/
@property (nonatomic, strong, readonly) id<MTRStorage> storage MTR_NEWLY_AVAILABLE;
/*
* OTA Provider delegate to be called when an OTA Requestor is requesting a software update.
* Defaults to nil.
*/
@property (nonatomic, strong, nullable) id<MTROTAProviderDelegate> otaProviderDelegate;
/*
* The Product Attestation Authority certificates that are trusted to sign
* device attestation information. Defaults to nil.
*
*/
@property (nonatomic, copy, nullable) NSArray<NSData *> * paaCerts;
/*
* The Certificate Declaration certificates that are trusted to sign
* device attestation information. Defaults to nil.
*
*/
@property (nonatomic, copy, nullable) NSArray<NSData *> * cdCerts;
/*
* The network port to bind to. If not specified, an ephemeral port will be
* used.
*/
@property (nonatomic, copy, nullable) NSNumber * port;
/*
* Whether to run a server capable of accepting incoming CASE
* connections. Defaults to NO.
*/
@property (nonatomic, assign) BOOL startServer;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithStorage:(id<MTRStorage>)storage;
@end
@interface MTRControllerFactory : NSObject
@property (readonly, nonatomic) BOOL isRunning;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
* Return the single MTRControllerFactory we support existing. It starts off
* in a "not started" state.
*/
+ (instancetype)sharedInstance;
/**
* Start the controller factory. Repeated calls to startup without calls to
* shutdown in between are NO-OPs. Use the isRunning property to check whether
* the controller factory needs to be started up.
*
* @param[in] startupParams data needed to start up the controller factory.
*
* @return Whether startup succeded.
*/
- (BOOL)startup:(MTRControllerFactoryParams *)startupParams;
/**
* Shut down the controller factory. This will shut down any outstanding
* controllers as part of the factory shutdown.
*
* Repeated calls to shutdown without calls to startup in between are
* NO-OPs.
*/
- (void)shutdown;
/**
* Create a MTRDeviceController on an existing fabric. Returns nil on failure.
*
* This method will fail if there is no such fabric or if there is
* already a controller started for that fabric.
*
* The fabric is identified by the root public key and fabric id in
* the startupParams.
*/
- (MTRDeviceController * _Nullable)startControllerOnExistingFabric:(MTRDeviceControllerStartupParams *)startupParams;
/**
* Create a MTRDeviceController on a new fabric. Returns nil on failure.
*
* This method will fail if the given fabric already exists.
*
* The fabric is identified by the root public key and fabric id in
* the startupParams.
*/
- (MTRDeviceController * _Nullable)startControllerOnNewFabric:(MTRDeviceControllerStartupParams *)startupParams;
@end
@interface MTRControllerFactoryParams (Deprecated)
@property (nonatomic, strong, readonly) id<MTRPersistentStorageDelegate> storageDelegate MTR_NEWLY_DEPRECATED(
"Please use the storage property");
@end
NS_ASSUME_NONNULL_END