3 * Copyright (c) 2021 Project CHIP Authors
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include "network-commissioning.h"
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>
34 bool emberAfNetworkCommissioningClusterAddThreadNetworkCallback(ByteSpan operationalDataset, uint64_t breadcrumb,
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);
44 bool emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(ByteSpan ssid, ByteSpan credentials, uint64_t breadcrumb,
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);
54 bool emberAfNetworkCommissioningClusterEnableNetworkCallback(ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs)
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);
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.
66 bool emberAfNetworkCommissioningClusterDisableNetworkCallback(ByteSpan networkID, uint64_t breadcrumb, uint32_t timeoutMs)
71 bool emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(uint32_t timeoutMs)
76 bool emberAfNetworkCommissioningClusterRemoveNetworkCallback(ByteSpan NetworkID, uint64_t Breadcrumb, uint32_t TimeoutMs)
81 bool emberAfNetworkCommissioningClusterScanNetworksCallback(ByteSpan ssid, uint64_t breadcrumb, uint32_t timeoutMs)
85 bool emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(ByteSpan operationalDataset, uint64_t breadcrumb,
91 bool emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(ByteSpan ssid, ByteSpan credentials, uint64_t breadcrumb,