Skip to content

Commit

Permalink
WIP: working
Browse files Browse the repository at this point in the history
  • Loading branch information
rosahay-silabs committed Dec 7, 2024
1 parent eb0146d commit 1dfd4bd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/platform/silabs/rs911x/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr)

void BLEManagerImpl::DriveBLEState(void)
{
ChipLogDetail(DeviceLayer, "[DBG] DriveBLEState");
CHIP_ERROR err = CHIP_NO_ERROR;

// Check if BLE stack is initialized ( TODO )
Expand Down Expand Up @@ -636,10 +637,7 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void)
ChipLogError(DeviceLayer, "rsi_ble_set_advertise_data() failed: %ld", result);
ExitNow();
}
else
{
ChipLogError(DeviceLayer, "rsi_ble_set_advertise_data() success: %ld", result);
}

index = 0;
responseData[index++] = 0x02; // length
responseData[index++] = CHIP_ADV_DATA_TYPE_FLAGS; // AD type : flags
Expand Down Expand Up @@ -724,7 +722,10 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void)

exit:
// TODO: Add MapBLEError to return the correct error code
ChipLogError(DeviceLayer, "StartAdvertising() End error: %s", ErrorStr(err));
if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "StartAdvertising() End error: %s", ErrorStr(err));
}
return err;
}

Expand Down Expand Up @@ -763,7 +764,7 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
{
// Since DriveBLEState is not called the device is still advertising
status = rsi_ble_stop_advertising();
if (status != RSI_SUCCESS)
if (status == RSI_SUCCESS || status == 0x4E0C)
{
mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
Expand Down
4 changes: 2 additions & 2 deletions src/platform/silabs/wifi/SiWx/WifiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ sl_status_t JoinWifiNetwork(void)
// failure only happens when the firmware returns an error
ChipLogError(DeviceLayer, "sl_net_up failed: 0x%lx", static_cast<uint32_t>(status));

//Deactivate the network interface before activating it on the next retry.
// Deactivate the network interface before activating it on the next retry.
if ((status == SL_STATUS_SI91X_SCAN_ISSUED_IN_ASSOCIATED_STATE) || (status == SL_STATUS_SI91X_COMMAND_GIVEN_IN_INVALID_STATE))
{
status = sl_net_down((sl_net_interface_t) SL_NET_WIFI_CLIENT_INTERFACE);
Expand Down Expand Up @@ -918,7 +918,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip)
sl_status_t ConfigurePowerSave(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_si91x_performance_profile_t sl_si91x_wifi_state,
uint32_t listenInterval)
{
int32_t error = rsi_bt_power_save_profile(sl_si91x_ble_state, 0);
int32_t error = rsi_bt_power_save_profile(sl_si91x_ble_state, RSI_MAX_PSP);
VerifyOrReturnError(error == RSI_SUCCESS, SL_STATUS_FAIL,
ChipLogError(DeviceLayer, "rsi_bt_power_save_profile failed: %ld", error));

Expand Down
3 changes: 2 additions & 1 deletion src/platform/silabs/wifi/icd/WifiSleepManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include <app/icd/server/ICDConfigurationData.h>
#include <examples/platform/silabs/BaseApplication.h>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/silabs/wifi/WifiInterfaceAbstraction.h>
#include <platform/silabs/wifi/icd/WifiSleepManager.h>
Expand Down Expand Up @@ -162,7 +163,7 @@ CHIP_ERROR WifiSleepManager::VerifyAndTransitionToLowPowerMode()
VerifyOrReturnError(ConfigurePowerSave() == SL_STATUS_OK, CHIP_ERROR_INTERNAL);
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
return CHIP_NO_ERROR;
#else // wf200
#else // wf200
return CHIP_NO_ERROR;
#endif
}
Expand Down
3 changes: 0 additions & 3 deletions src/platform/silabs/wifi/rs911x/WifiInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -943,9 +943,6 @@ int32_t wfx_rsi_send_data(void * p, uint16_t len)
sl_status_t ConfigurePowerSave(void)
{
int32_t status;
// RSI_SLEEP_2 is supported for associated stations only
// RSI_SLEEP_8 is non-associated sleep.
// FW will switch modes automatically
#ifdef RSI_BLE_ENABLE
status = rsi_bt_power_save_profile(RSI_SLEEP_MODE_2, RSI_MAX_PSP);
if (status != RSI_SUCCESS)
Expand Down

0 comments on commit 1dfd4bd

Please sign in to comment.