Skip to content

Commit

Permalink
Resolve CommissionerMain dependency issues (project-chip#36632)
Browse files Browse the repository at this point in the history
* Resolve CommissionerMain dependency issues

Note that CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE=1
requires chip_build_controller=true at the GN level, otherwise `lib` does
not pull in `controller`.

* Touch something in /tests/ to force NRF native_posix_64 tests to run

* Add nogncheck to conditional controller imports
  • Loading branch information
ksperling-apple authored Nov 26, 2024
1 parent e75d6da commit ffbc362
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 29 deletions.
20 changes: 9 additions & 11 deletions examples/platform/linux/CommissionerMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
* limitations under the License.
*/

#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>

#include <string>
#include "CommissionerMain.h"

#if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE

Expand All @@ -31,6 +28,7 @@
#include <crypto/CHIPCryptoPAL.h>
#include <crypto/RawKeySessionKeystore.h>
#include <lib/core/CHIPError.h>
#include <lib/core/CHIPPersistentStorageDelegate.h>
#include <lib/core/NodeId.h>
#include <lib/support/logging/CHIPLogging.h>

Expand All @@ -48,23 +46,23 @@
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>

#include <platform/CHIPDeviceLayer.h>
#include <platform/CommissionableDataProvider.h>
#include <platform/DeviceInstanceInfoProvider.h>
#include <platform/DiagnosticDataProvider.h>
#include <platform/KeyValueStoreManager.h>
#include <platform/PlatformManager.h>
#include <platform/TestOnlyCommissionableDataProvider.h>

#include <controller/CHIPDeviceControllerFactory.h>
#include <controller/ExampleOperationalCredentialsIssuer.h>
#include <lib/core/CHIPPersistentStorageDelegate.h>
#include <platform/KeyValueStoreManager.h>
#include <controller/CHIPDeviceControllerFactory.h> // nogncheck
#include <controller/ExampleOperationalCredentialsIssuer.h> // nogncheck

#if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED
#include "TraceHandlers.h"
#endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED

#include <signal.h>

#include "CommissionerMain.h"
#include <string>

using namespace chip;
using namespace chip::Credentials;
Expand Down Expand Up @@ -459,7 +457,7 @@ CommissionerDiscoveryController * GetCommissionerDiscoveryController()
return &gCommissionerDiscoveryController;
}

SessionKeystore * GetSessionKeystore()
Crypto::SessionKeystore * GetSessionKeystore()
{
return &gSessionKeystore;
}
Expand Down
23 changes: 9 additions & 14 deletions examples/platform/linux/CommissionerMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,25 @@

#pragma once

#include <controller/CHIPDeviceController.h>
#include <controller/CommissionerDiscoveryController.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <lib/core/CHIPError.h>
#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>
#include <transport/TransportMgr.h>
#include <platform/CHIPDeviceConfig.h>

#if CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE

using chip::PersistentStorageDelegate;
using chip::Controller::DeviceCommissioner;
using chip::Crypto::SessionKeystore;
using chip::Transport::PeerAddress;
#include <controller/CHIPDeviceController.h> // nogncheck
#include <controller/CommissionerDiscoveryController.h>
#include <credentials/DeviceAttestationCredsProvider.h>
#include <lib/core/CHIPError.h>
#include <lib/core/CHIPPersistentStorageDelegate.h>

CHIP_ERROR CommissionerPairOnNetwork(uint32_t pincode, uint16_t disc, PeerAddress address);
CHIP_ERROR CommissionerPairUDC(uint32_t pincode, size_t index);

CHIP_ERROR InitCommissioner(uint16_t commissionerPort, uint16_t udcListenPort, chip::FabricId fabricId = chip::kUndefinedFabricId);
void ShutdownCommissioner();

DeviceCommissioner * GetDeviceCommissioner();
chip::Controller::DeviceCommissioner * GetDeviceCommissioner();
CommissionerDiscoveryController * GetCommissionerDiscoveryController();
SessionKeystore * GetSessionKeystore();
PersistentStorageDelegate * GetPersistentStorageDelegate();
chip::Crypto::SessionKeystore * GetSessionKeystore();
chip::PersistentStorageDelegate * GetPersistentStorageDelegate();

#endif // CHIP_DEVICE_CONFIG_ENABLE_BOTH_COMMISSIONER_AND_COMMISSIONEE
7 changes: 3 additions & 4 deletions src/app/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,9 @@ chip_test_suite("tests") {
test_sources += [ "TestClusterStateCache.cpp" ]
}

# On NRF, Open IoT SDK and fake platforms we do not have a realtime clock available, so
# TestEventLogging.cpp would be testing the same thing as
# TestEventLoggingNoUTCTime, but it's not set up to deal with the timestamps
# being that low.
# On NRF, Open IoT SDK and fake platforms we do not have a realtime clock available,
# so TestEventLogging.cpp would be testing the same thing as TestEventLoggingNoUTCTime,
# but it's not set up to deal with the timestamps being that low.
if (chip_device_platform != "nrfconnect" &&
chip_device_platform != "openiotsdk" && chip_device_platform != "fake") {
test_sources += [ "TestEventLogging.cpp" ]
Expand Down

0 comments on commit ffbc362

Please sign in to comment.