Skip to content

Commit

Permalink
[Silabs][SiWx917] Factory data provider for SiWx917 (#24747)
Browse files Browse the repository at this point in the history
* Adding the temp logic for the factory device data provider for SiWx917

* Restyled by whitespace

* Added some comments

* restyling the PR

* Added the device config for other applications

* Restyled by clang-format

* Addressed review comments

* Setting the device config to default values and using static cast

* Restyled by whitespace

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 5, 2024
1 parent ccca3bc commit 2186722
Show file tree
Hide file tree
Showing 13 changed files with 366 additions and 37 deletions.
7 changes: 7 additions & 0 deletions examples/light-switch-app/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ declare_args() {
# Argument to force enable WPA3 security
rs91x_wpa3_only = false

# use commissionable data for SiWx917
siwx917_commissionable_data = false

#default WiFi SSID
chip_default_wifi_ssid = ""

Expand All @@ -84,6 +87,10 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||

defines = []

if (siwx917_commissionable_data) {
defines += [ "SIWX917_USE_COMISSIONABLE_DATA=1" ]
}

# WiFi settings
if (chip_enable_wifi) {
if (chip_default_wifi_ssid != "") {
Expand Down
40 changes: 40 additions & 0 deletions examples/light-switch-app/silabs/SiWx917/include/DeviceConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#ifdef SIWX917_USE_COMISSIONABLE_DATA

uint32_t discriminatorValue = 3840;
uint64_t passcode = 20202021;
uint32_t spake2Interation = 1000;
char spake2Salt[] = "U1BBS0UyUCBLZXkgU2FsdA==";
char spake2Verifier[] = "uWFwqugDNGiEck/po7KHwwMwwqZgN10XuyBajPGuyzUEV/iree4lOrao5GuwnlQ65CJzbeUB49s31EH+NEkg0JVI5MGCQGMMT/"
"SRPFNRODm3wH/MBiehuFc6FJ/NH6Rmzw==";
char genSpake2Path[] = "";
uint32_t productId = 32773;
uint32_t vendorId = 65521;
char productName[] = "";
char vendorName[] = "";
char hwVersionString[] = "";
uint32_t rotatingId;
uint32_t commissionableFlow = 1;
uint8_t rendezvousFlag = 2;

#endif
7 changes: 7 additions & 0 deletions examples/lighting-app/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ declare_args() {
# Argument to force enable WPA3 security on rs91x
rs91x_wpa3_only = false

# use commissionable data for SiWx917
siwx917_commissionable_data = false

#default WiFi SSID
chip_default_wifi_ssid = ""

Expand Down Expand Up @@ -158,6 +161,10 @@ efr32_sdk("sdk") {
]
}

if (siwx917_commissionable_data) {
defines += [ "SIWX917_USE_COMISSIONABLE_DATA=1" ]
}

# WiFi Settings
if (chip_enable_wifi) {
if (use_SiWx917) {
Expand Down
40 changes: 40 additions & 0 deletions examples/lighting-app/silabs/SiWx917/include/DeviceConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#ifdef SIWX917_USE_COMISSIONABLE_DATA

uint32_t discriminatorValue = 3840;
uint64_t passcode = 20202021;
uint32_t spake2Interation = 1000;
char spake2Salt[] = "U1BBS0UyUCBLZXkgU2FsdA==";
char spake2Verifier[] = "uWFwqugDNGiEck/po7KHwwMwwqZgN10XuyBajPGuyzUEV/iree4lOrao5GuwnlQ65CJzbeUB49s31EH+NEkg0JVI5MGCQGMMT/"
"SRPFNRODm3wH/MBiehuFc6FJ/NH6Rmzw==";
char genSpake2Path[] = "";
uint32_t productId = 32773;
uint32_t vendorId = 65521;
char productName[] = "";
char vendorName[] = "";
char hwVersionString[] = "";
uint32_t rotatingId;
uint32_t commissionableFlow = 1;
uint8_t rendezvousFlag = 2;

#endif
7 changes: 7 additions & 0 deletions examples/lock-app/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ declare_args() {
# Argument to force enable WPA3 security
rs91x_wpa3_only = false

# use commissionable data for SiWx917
siwx917_commissionable_data = false

#default WiFi SSID
chip_default_wifi_ssid = ""

Expand All @@ -84,6 +87,10 @@ if (silabs_board == "BRD4166A" || silabs_board == "BRD2601B" ||

defines = []

if (siwx917_commissionable_data) {
defines += [ "SIWX917_USE_COMISSIONABLE_DATA=1" ]
}

# WiFi settings
if (chip_enable_wifi) {
if (chip_default_wifi_ssid != "") {
Expand Down
40 changes: 40 additions & 0 deletions examples/lock-app/silabs/SiWx917/include/DeviceConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* Copyright (c) 2020 Project CHIP Authors
* Copyright (c) 2019 Google LLC.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#ifdef SIWX917_USE_COMISSIONABLE_DATA

uint32_t discriminatorValue = 3840;
uint64_t passcode = 20202021;
uint32_t spake2Interation = 1000;
char spake2Salt[] = "U1BBS0UyUCBLZXkgU2FsdA==";
char spake2Verifier[] = "uWFwqugDNGiEck/po7KHwwMwwqZgN10XuyBajPGuyzUEV/iree4lOrao5GuwnlQ65CJzbeUB49s31EH+NEkg0JVI5MGCQGMMT/"
"SRPFNRODm3wH/MBiehuFc6FJ/NH6Rmzw==";
char genSpake2Path[] = "";
uint32_t productId = 32773;
uint32_t vendorId = 65521;
char productName[] = "";
char vendorName[] = "";
char hwVersionString[] = "";
uint32_t rotatingId;
uint32_t commissionableFlow = 1;
uint8_t rendezvousFlag = 2;

#endif
2 changes: 1 addition & 1 deletion examples/platform/silabs/SiWx917/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ CHIP_ERROR BaseApplication::Init(Identify * identifyObj)
char qrCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1];
chip::MutableCharSpan QRCode(qrCodeBuffer);

if (EFR32::EFR32DeviceDataProvider::GetDeviceDataProvider().GetSetupPayload(QRCode) == CHIP_NO_ERROR)
if (SIWx917::SIWx917DeviceDataProvider::GetDeviceDataProvider().GetSetupPayload(QRCode) == CHIP_NO_ERROR)
{
// Print setup info on LCD if available
#ifdef QR_CODE_ENABLED
Expand Down
Loading

0 comments on commit 2186722

Please sign in to comment.