Skip to content

Commit

Permalink
Fix Android build
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-apple committed Jul 30, 2021
1 parent 7193a5b commit 50580e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/controller/java/AndroidDeviceControllerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,16 @@ CHIP_ERROR AndroidDeviceControllerWrapper::GenerateNOCChain(const ByteSpan & csr
ReturnErrorCodeIf(!rcac.Alloc(kMaxCHIPDERCertLength), CHIP_ERROR_NO_MEMORY);
uint16_t rootCertBufLen = kMaxCHIPDERCertLength;

CHIP_ERROR err = CHIP_NO_ERROR;
PERSISTENT_KEY_OP(mNextFabricId, kOperationalCredentialsRootCertificateStorage, key,
err = SyncGetKeyValue(key, rcac.Get(), rootCertBufLen));
if (err != CHIP_NO_ERROR)
{
// Storage doesn't have an existing root certificate. Let's create one and add it to the storage.
chip::Credentials::X509CertRequestParams request = { 0, mIssuerId, mNow, mNow + mValidity, true, mNextFabricId, false, 0 };
uint32_t outCertLen = 0;
ReturnErrorOnFailure(NewRootX509Cert(request, mIssuer, rcac.Get(), kMaxCHIPDERCertLength, outCertLen));
chip::Credentials::X509CertRequestParams rcac_request = { 0, mIssuerId, mNow, mNow + mValidity,
true, mNextFabricId, false, 0 };

uint32_t outCertLen = 0;
ReturnErrorOnFailure(NewRootX509Cert(rcac_request, mIssuer, rcac.Get(), kMaxCHIPDERCertLength, outCertLen));

VerifyOrReturnError(CanCastTo<uint16_t>(outCertLen), CHIP_ERROR_INVALID_ARGUMENT);
rootCertBufLen = static_cast<uint16_t>(outCertLen);
Expand Down
10 changes: 5 additions & 5 deletions src/controller/java/AndroidDeviceControllerWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel
const chip::ByteSpan & DAC, const chip::ByteSpan & PAI, const chip::ByteSpan & PAA,
chip::Callback::Callback<chip::Controller::OnNOCChainGeneration> * onCompletion) override;

void SetNodeIdForNextNOCRequest(NodeId nodeId) override
void SetNodeIdForNextNOCRequest(chip::NodeId nodeId) override
{
mNextRequestedNodeId = nodeId;
mNodeIdRequested = true;
}

void SetFabricIdForNextNOCRequest(FabricId fabricId) override { mNextFabricId = fabricId; }
void SetFabricIdForNextNOCRequest(chip::FabricId fabricId) override { mNextFabricId = fabricId; }

// DeviceStatusDelegate implementation
void OnMessage(chip::System::PacketBufferHandle && msg) override;
Expand Down Expand Up @@ -106,9 +106,9 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel

chip::NodeId mNextAvailableNodeId = 1;

NodeId mNextRequestedNodeId = 1;
FabricId mNextFabricId = 0;
bool mNodeIdRequested = false;
chip::NodeId mNextRequestedNodeId = 1;
chip::FabricId mNextFabricId = 0;
bool mNodeIdRequested = false;

AndroidDeviceControllerWrapper(ChipDeviceControllerPtr controller, pthread_mutex_t * stackLock) :
mController(std::move(controller)), mStackLock(stackLock)
Expand Down

0 comments on commit 50580e7

Please sign in to comment.