3 * Copyright (c) 2020 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #ifndef CHIP_DEVICE_CONTROLLER_H
19 #define CHIP_DEVICE_CONTROLLER_H
21 #import <Foundation/Foundation.h>
25 NS_ASSUME_NONNULL_BEGIN
27 @protocol CHIPDevicePairingDelegate;
28 @protocol CHIPPersistentStorageDelegate;
30 @interface CHIPDeviceController : NSObject
32 @property (readonly, nonatomic) BOOL isRunning;
34 - (BOOL)pairDevice:(uint64_t)deviceID
35 discriminator:(uint16_t)discriminator
36 setupPINCode:(uint32_t)setupPINCode
37 error:(NSError * __autoreleasing *)error;
38 - (BOOL)unpairDevice:(uint64_t)deviceID error:(NSError * __autoreleasing *)error;
39 - (BOOL)stopDevicePairing:(uint64_t)deviceID error:(NSError * __autoreleasing *)error;
40 - (void)sendWiFiCredentials:(NSString *)ssid password:(NSString *)password;
41 - (void)sendThreadCredentials:(NSData *)threadDataSet;
43 - (CHIPDevice *)getPairedDevice:(uint64_t)deviceID error:(NSError * __autoreleasing *)error;
45 - (instancetype)init NS_UNAVAILABLE;
46 + (instancetype)new NS_UNAVAILABLE;
49 * Return the single CHIPDeviceController we support existing.
51 + (CHIPDeviceController *)sharedController;
54 * Return the Node Id assigned to the controller.
56 - (NSNumber *)getControllerNodeId;
59 * Set the Delegate for the Device Pairing as well as the Queue on which the Delegate callbacks will be triggered
61 * @param[in] delegate The delegate the pairing process should use
63 * @param[in] queue The queue on which the callbacks will be delivered
65 - (void)setPairingDelegate:(id<CHIPDevicePairingDelegate>)delegate queue:(dispatch_queue_t)queue;
68 * Start the CHIP Stack. Repeated calls to startup without calls to shutdown in between are NO-OPs. Use the isRunning property to
69 * check if the stack needs to be started up.
71 * @param[in] storageDelegate The delegate for persistent storage
73 * @param[in] queue The queue on which the storage callbacks will be delivered
75 - (BOOL)startup:(id<CHIPPersistentStorageDelegate>)storageDelegate queue:(dispatch_queue_t)queue;
78 * Shutdown the CHIP Stack. Repeated calls to shutdown without calls to startup in between are NO-OPs.
86 #endif /* CHIP_DEVICE_CONTROLLER_H */