Skip to content

Commit

Permalink
Ifdef out the all zeroes network commissioning cluster on all except …
Browse files Browse the repository at this point in the history
…apple (#14683)
  • Loading branch information
andy31415 authored Feb 2, 2022
1 parent a2f9cad commit 8bb93af
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,22 @@ using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters::NetworkCommissioning;

// TODO: this is a TEMPORARY solution for enabling tests. The all-zero version
// is not spec compliang and will generally not even commission on thread/wifi
// because of a missing feature map
//
// Instead of this, the app::Clusters::NetworkCommissioning::Instance class
// from the "network-commissioning" cluster (note no "-old" suffix) should
// be used.
#ifdef __APPLE__
#define FAKE_NETWORK_COMMISSIONING_ATTRIBUTES
#else
#undef FAKE_NETWORK_COMMISSIONING_ATTRIBUTES
#endif

namespace {

#ifdef FAKE_NETWORK_COMMISSIONING_ATTRIBUTES
class NetworkCommissioningAttributeAccess : public AttributeAccessInterface
{
public:
Expand Down Expand Up @@ -65,6 +80,7 @@ class NetworkCommissioningAttributeAccess : public AttributeAccessInterface
}
}
};
#endif // FAKE_NETWORK_COMMISSIONING_ATTRIBUTES
} // namespace

bool emberAfNetworkCommissioningClusterAddOrUpdateThreadNetworkCallback(
Expand Down Expand Up @@ -128,8 +144,11 @@ bool emberAfNetworkCommissioningClusterReorderNetworkCallback(app::CommandHandle
return false;
}

NetworkCommissioningAttributeAccess gAttrAccess;
void MatterNetworkCommissioningPluginServerInitCallback()
{

#ifdef FAKE_NETWORK_COMMISSIONING_ATTRIBUTES
static NetworkCommissioningAttributeAccess gAttrAccess;
registerAttributeAccessOverride(&gAttrAccess);
#endif // FAKE_NETWORK_COMMISSIONING_ATTRIBUTES
}

0 comments on commit 8bb93af

Please sign in to comment.