Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / controller / python / ChipDeviceController-ScriptDevicePairingDelegate.h
1 /*
2  *
3  *    Copyright (c) 2020 Project CHIP Authors
4  *    Copyright (c) 2013-2017 Nest Labs, Inc.
5  *    All rights reserved.
6  *
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
10  *
11  *        http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 /**
21  *    @file
22  *      Declaration of DevicePairingDelegate of CHIP Device Controller for Python
23  *
24  */
25
26 #pragma once
27
28 #include <controller/CHIPDeviceController.h>
29
30 #include <platform/internal/DeviceNetworkInfo.h>
31 #include <transport/RendezvousSessionDelegate.h>
32
33 namespace chip {
34 namespace Controller {
35
36 extern "C" {
37 typedef void (*DevicePairingDelegate_OnPairingCompleteFunct)(CHIP_ERROR err);
38 }
39
40 class ScriptDevicePairingDelegate final : public Controller::DevicePairingDelegate
41 {
42 public:
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);
48
49     void OnNetworkCredentialsRequested(RendezvousDeviceCredentialsDelegate * callback) override;
50
51     void OnOperationalCredentialsRequested(const char * csr, size_t csr_length,
52                                            RendezvousDeviceCredentialsDelegate * callback) override;
53
54     void OnPairingComplete(CHIP_ERROR error) override;
55
56 private:
57     // WiFi Provisioning Data
58     char mWifiSSID[chip::DeviceLayer::Internal::kMaxWiFiSSIDLength + 1];
59     char mWifiPassword[chip::DeviceLayer::Internal::kMaxWiFiKeyLength];
60
61     // Thread Provisioning Data
62     chip::DeviceLayer::Internal::DeviceNetworkInfo mThreadInfo = {};
63
64     enum class Mode
65     {
66         Wifi,
67         Thread
68     };
69
70     Mode mMode                                                              = Mode::Wifi;
71     DevicePairingDelegate_OnPairingCompleteFunct mOnPairingCompleteCallback = nullptr;
72 };
73
74 } // namespace Controller
75 } // namespace chip