Skip to content

Commit

Permalink
[Fabric-Sync] Fix compile warnings (project-chip#35927)
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca authored Oct 5, 2024
1 parent 5c9d4f9 commit ef0132b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/fabric-admin/device_manager/DeviceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void DeviceManager::RemoveSyncedDevice(NodeId nodeId)
ChipLogValueX64(device->GetNodeId()), device->GetEndpointId());
}

void DeviceManager::OpenDeviceCommissioningWindow(NodeId nodeId, uint32_t commissioningTimeoutSec, uint32_t iterations,
void DeviceManager::OpenDeviceCommissioningWindow(NodeId nodeId, uint32_t iterations, uint16_t commissioningTimeoutSec,
uint16_t discriminator, const ByteSpan & salt, const ByteSpan & verifier)
{
ChipLogProgress(NotSpecified, "Opening commissioning window for Node ID: " ChipLogFormatX64, ChipLogValueX64(nodeId));
Expand Down Expand Up @@ -422,7 +422,7 @@ void DeviceManager::HandleReverseOpenCommissioningWindow(TLV::TLVReader & data)
ChipLogProgress(NotSpecified, " PAKEPasscodeVerifier size: %lu", value.PAKEPasscodeVerifier.size());
ChipLogProgress(NotSpecified, " salt size: %lu", value.salt.size());

OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.commissioningTimeout, value.iterations, value.discriminator,
OpenDeviceCommissioningWindow(mLocalBridgeNodeId, value.iterations, value.commissioningTimeout, value.discriminator,
ByteSpan(value.salt.data(), value.salt.size()),
ByteSpan(value.PAKEPasscodeVerifier.data(), value.PAKEPasscodeVerifier.size()));
}
Expand Down
6 changes: 3 additions & 3 deletions examples/fabric-admin/device_manager/DeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ class DeviceManager : public PairingDelegate
* This function initiates the process to open the commissioning window for a device identified by the given node ID.
*
* @param nodeId The ID of the node that should open the commissioning window.
* @param commissioningTimeoutSec The time in seconds before the commissioning window closes. This value determines
* how long the commissioning window remains open for incoming connections.
* @param iterations The number of PBKDF (Password-Based Key Derivation Function) iterations to use
* for deriving the PAKE (Password Authenticated Key Exchange) verifier.
* @param commissioningTimeoutSec The time in seconds before the commissioning window closes. This value determines
* how long the commissioning window remains open for incoming connections.
* @param discriminator The device-specific discriminator, determined during commissioning, which helps
* to uniquely identify the device among others.
* @param salt The salt used in the cryptographic operations for commissioning.
* @param verifier The PAKE verifier used to authenticate the commissioning process.
*
*/
void OpenDeviceCommissioningWindow(chip::NodeId nodeId, uint32_t commissioningTimeoutSec, uint32_t iterations,
void OpenDeviceCommissioningWindow(chip::NodeId nodeId, uint32_t iterations, uint16_t commissioningTimeoutSec,
uint16_t discriminator, const chip::ByteSpan & salt, const chip::ByteSpan & verifier);

/**
Expand Down
4 changes: 2 additions & 2 deletions examples/fabric-admin/rpc/RpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ class FabricAdmin final : public rpc::FabricAdmin, public IcdManager::Delegate
// TODO(#35875): OpenDeviceCommissioningWindow uses the same controller every time and doesn't currently accept
// FabricIndex. For now we are dropping fabric index from the scoped node id.
NodeId nodeId = request.id.node_id;
uint32_t commissioningTimeoutSec = request.commissioning_timeout;
uint32_t iterations = request.iterations;
uint16_t discriminator = request.discriminator;
uint16_t commissioningTimeoutSec = static_cast<uint16_t>(request.commissioning_timeout);

// Log the request details for debugging
ChipLogProgress(NotSpecified,
"Received OpenCommissioningWindow request: NodeId 0x%lx, Timeout: %u, Iterations: %u, Discriminator: %u",
static_cast<unsigned long>(nodeId), commissioningTimeoutSec, iterations, discriminator);

// Open the device commissioning window using raw binary data for salt and verifier
DeviceMgr().OpenDeviceCommissioningWindow(nodeId, commissioningTimeoutSec, iterations, discriminator,
DeviceMgr().OpenDeviceCommissioningWindow(nodeId, iterations, commissioningTimeoutSec, discriminator,
ByteSpan(request.salt.bytes, request.salt.size),
ByteSpan(request.verifier.bytes, request.verifier.size));

Expand Down
4 changes: 2 additions & 2 deletions examples/fabric-bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ bool HandleCustomOption(const char * aProgram, ArgParser::OptionSet * aOptions,
switch (aIdentifier)
{
case kOptionFabricAdminServerPortNumber:
gFabricAdminServerPort = atoi(aValue);
gFabricAdminServerPort = static_cast<uint16_t>(atoi(aValue));
break;
case kOptionLocalServerPortNumber:
gLocalServerPort = atoi(aValue);
gLocalServerPort = static_cast<uint16_t>(atoi(aValue));
break;
default:
ArgParser::PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName);
Expand Down

0 comments on commit ef0132b

Please sign in to comment.