Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / app / clusters / network-commissioning / network-commissioning-ember.cpp
1 /*
2  *
3  *    Copyright (c) 2021 Project CHIP Authors
4  *    All rights reserved.
5  *
6  *    Licensed under the Apache License, Version 2.0 (the "License");
7  *    you may not use this file except in compliance with the License.
8  *    You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *    Unless required by applicable law or agreed to in writing, software
13  *    distributed under the License is distributed on an "AS IS" BASIS,
14  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *    See the License for the specific language governing permissions and
16  *    limitations under the License.
17  */
18
19 #include "network-commissioning.h"
20
21 #include <cstring>
22
23 #include <gen/att-storage.h>
24 #include <gen/attribute-id.h>
25 #include <gen/attribute-type.h>
26 #include <gen/callback.h>
27 #include <gen/cluster-id.h>
28 #include <gen/command-id.h>
29 #include <gen/enums.h>
30 #include <util/af.h>
31
32 using namespace chip;
33
34 bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(ByteSpan operationalDataset, uint64_t breadcrumb,
35                                                                 uint32_t timeoutMs)
36 {
37     EmberAfNetworkCommissioningError err = chip::app::clusters::NetworkCommissioning::OnAddThreadNetworkCommandCallbackInternal(
38         nullptr, emberAfCurrentEndpoint(), operationalDataset, breadcrumb, timeoutMs);
39     emberAfSendImmediateDefaultResponse(err == EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS ? EMBER_ZCL_STATUS_SUCCESS
40                                                                                              : EMBER_ZCL_STATUS_FAILURE);
41     return true;
42 }
43
44 bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(ByteSpan ssid, ByteSpan credentials, uint64_t breadcrumb,
45                                                               uint32_t timeoutMs)
46 {
47     EmberAfNetworkCommissioningError err = chip::app::clusters::NetworkCommissioning::OnAddWiFiNetworkCommandCallbackInternal(
48         nullptr, emberAfCurrentEndpoint(), ssid, credentials, breadcrumb, timeoutMs);
49     emberAfSendImmediateDefaultResponse(err == EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS ? EMBER_ZCL_STATUS_SUCCESS
50                                                                                              : EMBER_ZCL_STATUS_FAILURE);
51     return true;
52 }
53
54 bool emberAfNetworkCommissioningClusterEnableNetworkCallback(ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs)
55 {
56     EmberAfNetworkCommissioningError err = chip::app::clusters::NetworkCommissioning::OnEnableNetworkCommandCallbackInternal(
57         nullptr, emberAfCurrentEndpoint(), networkID, breadcrumb, timeoutMs);
58     emberAfSendImmediateDefaultResponse(err == EMBER_ZCL_NETWORK_COMMISSIONING_ERROR_SUCCESS ? EMBER_ZCL_STATUS_SUCCESS
59                                                                                              : EMBER_ZCL_STATUS_FAILURE);
60     return true;
61 }
62
63 // TODO: The following commands needed to be implemented.
64 // These commands are not implemented thus not handled yet, return false so ember will return a error.
65
66 bool emberAfNetworkCommissioningClusterDisableNetworkCallback(ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs)
67 {
68     return false;
69 }
70
71 bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(uint32_t timeoutMs)
72 {
73     return false;
74 }
75
76 bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(ByteSpan NetworkID, uint64_t Breadcrumb, uint32_t TimeoutMs)
77 {
78     return false;
79 }
80
81 bool emberAfNetworkCommissioningClusterScanNetworksCallback(ByteSpan ssid, uint64_t breadcrumb, uint32_t timeoutMs)
82 {
83     return false;
84 }
85 bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(ByteSpan operationalDataset, uint64_t breadcrumb,
86                                                                    uint32_t timeoutMs)
87 {
88     return false;
89 }
90
91 bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(ByteSpan ssid, ByteSpan credentials, uint64_t breadcrumb,
92                                                                  uint32_t timeoutMs)
93 {
94     return false;
95 }