Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BouffaloLab]update sdk to support open network #29070

Merged
merged 13 commits into from
Sep 7, 2023
16 changes: 11 additions & 5 deletions src/platform/bouffalolab/BL602/NetworkCommissioningDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ CHIP_ERROR BLWiFiDriver::Init(NetworkStatusChangeCallback * networkStatusChangeC
size_t ssidLen = 0;
size_t credentialsLen = 0;

err = PersistedStorage::KeyValueStoreMgr().Get(BLConfig::kConfigKey_WiFiSSID, mSavedNetwork.credentials,
err = PersistedStorage::KeyValueStoreMgr().Get(BLConfig::kConfigKey_WiFiPassword, mSavedNetwork.credentials,
sizeof(mSavedNetwork.credentials), &credentialsLen);
SuccessOrExit(err);
err = PersistedStorage::KeyValueStoreMgr().Get(BLConfig::kConfigKey_WiFiPassword, mSavedNetwork.ssid,
sizeof(mSavedNetwork.ssid), &ssidLen);
err = PersistedStorage::KeyValueStoreMgr().Get(BLConfig::kConfigKey_WiFiSSID, mSavedNetwork.ssid, sizeof(mSavedNetwork.ssid),
&ssidLen);
SuccessOrExit(err);

mSavedNetwork.credentialsLen = credentialsLen;
Expand Down Expand Up @@ -160,8 +160,14 @@ CHIP_ERROR BLWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen,
memcpy(passwd, key, keyLen);
wifi_interface_t wifi_interface;
wifi_interface = wifi_mgmr_sta_enable();
wifi_mgmr_sta_connect(&wifi_interface, wifi_ssid, passwd, NULL, NULL, 0, 0);

if (keyLen < 8 && keyLen != 5)
andy31415 marked this conversation as resolved.
Show resolved Hide resolved
{
wifi_mgmr_sta_connect(&wifi_interface, wifi_ssid, NULL, NULL, NULL, 0, 0);
}
else
{
wifi_mgmr_sta_connect(&wifi_interface, wifi_ssid, passwd, NULL, NULL, 0, 0);
}
return CHIP_NO_ERROR;
}

Expand Down
33 changes: 28 additions & 5 deletions src/platform/bouffalolab/common/BLConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,21 @@ CHIP_ERROR BLConfig::WriteConfigValue(const char * key, uint8_t * val, size_t si

ef_port_env_lock();

if (size && val)
if (size)
{
ret = ef_set_env_blob(key, val, size);
if (val)
{
ret = ef_set_env_blob(key, val, size);
}
else
{
ret = EF_ENV_ARG_ERR;
}
}
else
{
uint32_t value_null = 0;
ret = ef_set_env_blob(key, &value_null, size);
}

ef_port_env_unlock();
Expand Down Expand Up @@ -240,11 +252,22 @@ CHIP_ERROR BLConfig::WriteKVS(const char * key, const void * value, size_t value

ef_port_env_lock();

if (value && value_size)
if (value_size)
{
ret = ef_set_env_blob(key, value, value_size);
if (value)
{
ret = ef_set_env_blob(key, value, value_size);
}
else
{
ret = EF_ENV_ARG_ERR;
}
}
else
{
uint32_t value_null = 0;
ret = ef_set_env_blob(key, &value_null, value_size);
}

ef_port_env_unlock();

if (ret == EF_NO_ERR)
Expand Down
3 changes: 2 additions & 1 deletion third_party/bouffalolab/bl702/bl_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,8 @@ template("bl_iot_sdk") {
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_entropy.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_linkmetric.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_logging.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_misc.c",

#"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_misc.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_radio.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_settings.c",
]
Expand Down
3 changes: 2 additions & 1 deletion third_party/bouffalolab/bl702l/bl_iot_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,8 @@ template("bl_iot_sdk") {
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_entropy.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_linkmetric.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_logging.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_misc.c",

#"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_misc.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_radio.c",
"${bl_iot_sdk_root}/components/network/thread/openthread_port/ot_settings.c",

Expand Down
2 changes: 1 addition & 1 deletion third_party/bouffalolab/repo
Submodule repo updated 2 files
+1 −1 components
+1 −1 customer_app