Skip to content

Commit

Permalink
custom WiFi commission
Browse files Browse the repository at this point in the history
  • Loading branch information
shchen-Lab committed Aug 24, 2023
1 parent 570a278 commit d4f3a59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/platform/bouffalolab/BL616/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ static_library("BL616") {
"../common/BLEManagerImpl.h",
]
defines = [ "BOUFFALOLAB_BLE_DATA_ENABLE" ]
defines +=["BOUFFALOLAB_BLE_PRO_ENABLE"]
}

if (chip_enable_factory_data || chip_enable_factory_data_test) {
Expand Down
12 changes: 11 additions & 1 deletion src/platform/bouffalolab/common/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ extern "C" {
#include <hci_driver.h>

#include "BLEManagerImpl.h"

#ifdef BOUFFALOLAB_BLE_PRO_ENABLE
#include "NetworkCommissioningDriver.h"
#endif
using namespace ::chip;
using namespace ::chip::Ble;
using namespace ::chip::System;
Expand Down Expand Up @@ -826,6 +828,14 @@ ssize_t BLEManagerImpl::HandleBLRXWrite(struct bt_conn * conId, const struct bt_
uint16_t offset, uint8_t flags)
{
bl_custom_flag=true;
#ifdef BOUFFALOLAB_BLE_PRO_ENABLE
chip::DeviceLayer::PlatformMgr().LockChipStack();
const char *ssid="HUAWEI-10G70W";
const char *password="Wa1987Wj";
CHIP_ERROR error = chip::DeviceLayer::NetworkCommissioning::BLWiFiDriver::GetInstance().ConnectWiFiNetwork(
ssid, strlen(ssid), password, strlen(password));
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
#endif
return len;
}
bool BLEManagerImpl::HandleBLTXCCCWrite(struct bt_conn * conId, const struct bt_gatt_attr * attr, uint16_t value)
Expand Down

0 comments on commit d4f3a59

Please sign in to comment.