Skip to content

Commit

Permalink
Use node ID provided in the NOC (#8826)
Browse files Browse the repository at this point in the history
* Use node ID and fabric ID provided in the NOC

* update CHIPTool for modified opcreds cluster

* remove more checks for NodeID

* split cluster changes from the current PR

* rename functions and variables

* address review comments

* Fix build issues
  • Loading branch information
pan-apple authored Aug 11, 2021
1 parent 6672e78 commit 6a36256
Show file tree
Hide file tree
Showing 49 changed files with 398 additions and 5,725 deletions.
4 changes: 2 additions & 2 deletions examples/all-clusters-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class SetupListModel : public ListScreen::Model
if (i == 0)
{
ConnectivityMgr().ClearWiFiStationProvision();
OpenDefaultPairingWindow(ResetFabrics::kYes);
OpenBasicCommissioningWindow(ResetFabrics::kYes);
}
else if (i == 1)
{
Expand All @@ -352,7 +352,7 @@ class SetupListModel : public ListScreen::Model
else if (i == 2)
{
app::Mdns::AdvertiseCommissionableNode();
OpenDefaultPairingWindow(ResetFabrics::kYes, kNoCommissioningTimeout, PairingWindowAdvertisement::kMdns);
OpenBasicCommissioningWindow(ResetFabrics::kYes, kNoCommissioningTimeout, PairingWindowAdvertisement::kMdns);
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/k32w/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ void AppTask::BleHandler(AppEvent * aEvent)
{
ConnectivityMgr().SetBLEAdvertisingEnabled(true);

if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
K32W_LOG("Started BLE Advertising!");
}
else
{
K32W_LOG("OpenDefaultPairingWindow() failed");
K32W_LOG("OpenBasicCommissioningWindow() failed");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent)
if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON)
return;

if (AddTestPairing() != CHIP_NO_ERROR)
if (AddTestCommissioning() != CHIP_NO_ERROR)
{
LOG_ERR("Failed to add test pairing");
}
Expand Down Expand Up @@ -379,13 +379,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent)
return;
}

if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
LOG_INF("Enabled BLE Advertisement");
}
else
{
LOG_ERR("OpenDefaultPairingWindow() failed");
LOG_ERR("OpenBasicCommissioningWindow() failed");
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ CHIP_ERROR AppTask::Init()
PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE));

// Enable BLE advertisements
OpenDefaultPairingWindow(chip::ResetFabrics::kNo);
OpenBasicCommissioningWindow(chip::ResetFabrics::kNo);
ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing.");

return err;
Expand Down
3 changes: 1 addition & 2 deletions examples/lighting-app/telink/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ CHIP_ERROR AppTask::Init()
ConfigurationMgr().LogDeviceConfig();
PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE));

// Setup test pairing
ret = AddTestPairing();
ret = AddTestCommissioning();
if (ret != CHIP_NO_ERROR)
{
LOG_ERR("Failed to add test pairing");
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
// Enable BLE advertisements
if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
{
if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
PLAT_LOG("Enabled BLE Advertisement");
}
else
{
PLAT_LOG("OpenDefaultPairingWindow() failed");
PLAT_LOG("OpenBasicCommissioningWindow() failed");
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/k32w/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,13 @@ void AppTask::BleHandler(AppEvent * aEvent)
{
ConnectivityMgr().SetBLEAdvertisingEnabled(true);

if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
K32W_LOG("Started BLE Advertising!");
}
else
{
K32W_LOG("OpenDefaultPairingWindow() failed");
K32W_LOG("OpenBasicCommissioningWindow() failed");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent)
if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON)
return;

if (AddTestPairing() != CHIP_NO_ERROR)
if (AddTestCommissioning() != CHIP_NO_ERROR)
{
LOG_ERR("Failed to add test pairing");
}
Expand Down Expand Up @@ -379,13 +379,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent)
return;
}

if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
LOG_INF("Enabled BLE Advertisement");
}
else
{
LOG_ERR("OpenDefaultPairingWindow() failed");
LOG_ERR("OpenBasicCommissioningWindow() failed");
}
}

Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ void AppTask::FunctionHandler(AppEvent * aEvent)
if (!ConnectivityMgr().IsThreadProvisioned())
{
// Enable BLE advertisements and pairing window
if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
ChipLogProgress(NotSpecified, "BLE advertising started. Waiting for Pairing.");
}
Expand Down
4 changes: 2 additions & 2 deletions examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
// Enable BLE advertisements
if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
{
if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
PLAT_LOG("Enabled BLE Advertisement");
}
else
{
PLAT_LOG("OpenDefaultPairingWindow() failed");
PLAT_LOG("OpenBasicCommissioningWindow() failed");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/pump-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent)
if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON)
return;

if (AddTestPairing() != CHIP_NO_ERROR)
if (AddTestCommissioning() != CHIP_NO_ERROR)
{
LOG_ERR("Failed to add test pairing");
}
Expand Down Expand Up @@ -364,13 +364,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent)
return;
}

if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
LOG_INF("Enabled BLE Advertisement");
}
else
{
LOG_ERR("OpenDefaultPairingWindow() failed");
LOG_ERR("OpenBasicCommissioningWindow() failed");
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
// Enable BLE advertisements
if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
{
if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
PLAT_LOG("Enabled BLE Advertisement");
}
else
{
PLAT_LOG("OpenDefaultPairingWindow() failed");
PLAT_LOG("OpenBasicCommissioningWindow() failed");
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/pump-controller-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void AppTask::StartThreadHandler(AppEvent * aEvent)
if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON)
return;

if (AddTestPairing() != CHIP_NO_ERROR)
if (AddTestCommissioning() != CHIP_NO_ERROR)
{
LOG_ERR("Failed to add test pairing");
}
Expand Down Expand Up @@ -364,13 +364,13 @@ void AppTask::StartBLEAdvertisementHandler(AppEvent * aEvent)
return;
}

if (OpenDefaultPairingWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
if (OpenBasicCommissioningWindow(chip::ResetFabrics::kNo) == CHIP_NO_ERROR)
{
LOG_INF("Enabled BLE Advertisement");
}
else
{
LOG_ERR("OpenDefaultPairingWindow() failed");
LOG_ERR("OpenBasicCommissioningWindow() failed");
}
}

Expand Down
5 changes: 0 additions & 5 deletions examples/shell/shell_common/cmd_ping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,17 +285,12 @@ void StartPinging(streamer_t * stream, char * destination)
{
CHIP_ERROR err = CHIP_NO_ERROR;

Transport::FabricInfo * fabricInfo = nullptr;

if (!IPAddress::FromString(destination, gDestAddr))
{
streamer_printf(stream, "Invalid Echo Server IP address: %s\n", destination);
ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT);
}

fabricInfo = gFabrics.AssignFabricIndex(gFabricIndex, kTestControllerNodeId);
VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY);

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
err = gTCPManager.Init(Transport::TcpListenParameters(&DeviceLayer::InetLayer)
.SetAddressType(gDestAddr.Type())
Expand Down
4 changes: 0 additions & 4 deletions examples/shell/shell_common/cmd_send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,13 @@ void ProcessCommand(streamer_t * stream, char * destination)

Transport::FabricTable fabrics;
Transport::PeerAddress peerAddress;
Transport::FabricInfo * fabricInfo = nullptr;

if (!chip::Inet::IPAddress::FromString(destination, gDestAddr))
{
streamer_printf(stream, "Invalid CHIP Server IP address: %s\n", destination);
ExitNow(err = CHIP_ERROR_INVALID_ARGUMENT);
}

fabricInfo = fabrics.AssignFabricIndex(gFabricIndex, kTestControllerNodeId);
VerifyOrExit(fabricInfo != nullptr, err = CHIP_ERROR_NO_MEMORY);

#if INET_CONFIG_ENABLE_TCP_ENDPOINT
err = gTCPManager.Init(Transport::TcpListenParameters(&DeviceLayer::InetLayer)
.SetAddressType(gDestAddr.Type())
Expand Down
Loading

0 comments on commit 6a36256

Please sign in to comment.