-
Notifications
You must be signed in to change notification settings - Fork 28
/
RequestHandler.swift
35 lines (29 loc) · 2.1 KB
/
RequestHandler.swift
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
import MatterSupport
// The extension is launched in response to `MatterAddDeviceRequest.perform()` and this class is the entry point
// for the extension operations.
class RequestHandler: MatterAddDeviceExtensionRequestHandler {
override func validateDeviceCredential(_ deviceCredential: MatterAddDeviceExtensionRequestHandler.DeviceCredential) async throws {
// Use this function to perform additional attestation checks if that is useful for your ecosystem.
}
override func selectWiFiNetwork(from wifiScanResults: [MatterAddDeviceExtensionRequestHandler.WiFiScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.WiFiNetworkAssociation {
// Use this function to select a Wi-Fi network for the device if your ecosystem has special requirements.
// Or, return `.defaultSystemNetwork` to use the iOS device's current network.
return .defaultSystemNetwork
}
override func selectThreadNetwork(from threadScanResults: [MatterAddDeviceExtensionRequestHandler.ThreadScanResult]) async throws -> MatterAddDeviceExtensionRequestHandler.ThreadNetworkAssociation {
// Use this function to select a Thread network for the device if your ecosystem has special requirements.
// Or, return `.defaultSystemNetwork` to use the default Thread network.
return .defaultSystemNetwork
}
override func commissionDevice(in home: MatterAddDeviceRequest.Home?, onboardingPayload: String, commissioningID: UUID) async throws {
// Use this function to commission the device with your Matter stack.
}
override func rooms(in home: MatterAddDeviceRequest.Home?) async -> [MatterAddDeviceRequest.Room] {
// Use this function to return the rooms your ecosystem manages.
// If your ecosystem manages multiple homes, ensure you are returning rooms that belong to the provided home.
return [.init(displayName: "Living Room")]
}
override func configureDevice(named name: String, in room: MatterAddDeviceRequest.Room?) async {
// Use this function to configure the (now) commissioned device with the given name and room.
}
}