3 * Copyright (c) 2020 Project CHIP Authors
4 * Copyright (c) 2013-2017 Nest Labs, Inc.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 * Declaration of DevicePairingDelegate of CHIP Device Controller for Python
28 #include <controller/CHIPDeviceController.h>
30 #include <platform/internal/DeviceNetworkInfo.h>
31 #include <transport/RendezvousSessionDelegate.h>
34 namespace Controller {
37 typedef void (*DevicePairingDelegate_OnPairingCompleteFunct)(CHIP_ERROR err);
40 class ScriptDevicePairingDelegate final : public Controller::DevicePairingDelegate
43 ~ScriptDevicePairingDelegate() = default;
44 void SetWifiCredential(const char * ssid, const char * password);
45 void SetThreadCredential(uint8_t channel, uint16_t panId,
46 uint8_t (&masterKey)[chip::DeviceLayer::Internal::kThreadMasterKeyLength]);
47 void SetKeyExchangeCallback(DevicePairingDelegate_OnPairingCompleteFunct callback);
49 void OnNetworkCredentialsRequested(RendezvousDeviceCredentialsDelegate * callback) override;
51 void OnOperationalCredentialsRequested(const char * csr, size_t csr_length,
52 RendezvousDeviceCredentialsDelegate * callback) override;
54 void OnPairingComplete(CHIP_ERROR error) override;
57 // WiFi Provisioning Data
58 char mWifiSSID[chip::DeviceLayer::Internal::kMaxWiFiSSIDLength + 1];
59 char mWifiPassword[chip::DeviceLayer::Internal::kMaxWiFiKeyLength];
61 // Thread Provisioning Data
62 chip::DeviceLayer::Internal::DeviceNetworkInfo mThreadInfo = {};
70 Mode mMode = Mode::Wifi;
71 DevicePairingDelegate_OnPairingCompleteFunct mOnPairingCompleteCallback = nullptr;
74 } // namespace Controller