Skip to content

Commit

Permalink
Add handling for SetAliroReaderConfig and ClearAliroReaderConfig comm…
Browse files Browse the repository at this point in the history
…ands

Add a delegate for the door lock to provide the attribute data for the aliro attributes
  • Loading branch information
nivi-apple committed Jan 26, 2024
1 parent 1582d8c commit e7bb3b3
Show file tree
Hide file tree
Showing 4 changed files with 584 additions and 1 deletion.
121 changes: 121 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-delegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
*
* Copyright (c) 2024 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <app-common/zap-generated/cluster-objects.h>

namespace chip {
namespace app {
namespace Clusters {
namespace DoorLock {

static constexpr size_t kAliroReaderVerificationKeyMaxSize = 65;

static constexpr size_t kAliroAttributeMaxSize_16 = 16;

static constexpr size_t kProtocolVersionMaxSize = 2;

/** @brief
* Defines methods for implementing application-specific logic for the door lock cluster.
* It defines the interfaces that a door lock should implement to support Aliro provisioning attributes.
*/

class Delegate
{
public:
Delegate() = default;

virtual ~Delegate() = default;

/**
* @brief Get the Aliro verification key component of the Reader's key pair.
*
* @param[out] verificationKey The MutableByteSpan to copy the verification key into. On success,
* the callee must update the length to the length of the copied data.
*/
virtual CHIP_ERROR GetAliroReaderVerificationKey(MutableByteSpan & aliroVerificationKey) = 0;

/**
* @brief Get the Reader's group identifier
*
* @param[out] groupIdentifier The MutableByteSpan to copy the group identifier into. On success,
* the callee must update the length to the length of the copied data.
*/
virtual CHIP_ERROR GetAliroReaderGroupIdentifier(MutableByteSpan & aliroGroupIdentifier) = 0;

/**
* @brief Get the Reader's subgroup identifier
*
* @param[out] groupIdentifier The MutableByteSpan to copy the group subidentifier into. On success,
* the callee must update the length to the length of the copied data.
*/
virtual CHIP_ERROR GetAliroReaderGroupSubIdentifier(MutableByteSpan & aliroGroupSubIdentifier) = 0;

/**
* @brief Get the Aliro expedited transaction supported protocol version at the given index.
*
* @param[in] index The index of the protocol version in the list.
* @param[out] protocolVersion The MutableByteSpan to copy the expedited transaction supported protocol version at the given
* index into. On success, the callee must update the length to the length of the copied data.
*/
virtual CHIP_ERROR GetAliroExpeditedTransactionSupportedProtocolVersionAtIndex(size_t index,
MutableByteSpan & protocolVersion) = 0;

/**
* @brief Get the Reader's group resolving key.
*
* @param[out] aliroGroupResolvingKey The MutableByteSpan to copy the aliro group resolving key into. On success,
* the callee must update the length to the length of the copied data.
*/
virtual CHIP_ERROR GetAliroGroupResolvingKey(MutableByteSpan & aliroGroupResolvingKey) = 0;

/**
* @brief Get the Aliro supported BLE UWB protocol version at the given index.
*
* @param[in] index The index of the protocol version in the list.
* @param[out] protocolVersion The MutableByteSpan to copy the supported BLE UWB protocol version at the given index into.
* On success, the callee must update the length to the length of the copied data.
*/
virtual CHIP_ERROR GetAliroSupportedBLEUWBProtocolVersionAtIndex(size_t index, MutableByteSpan & protocolVersion) = 0;

/**
* @brief Get the Aliro BLE Advertising Version.
*
* @param[out] aliroBLEAdvertisingVersion The BLE Advertising Version.
*/
virtual CHIP_ERROR GetAliroBLEAdvertisingVersion(uint8_t & aliroBLEAdvertisingVersion) = 0;

/**
* @brief Get the maximum number of Aliro credential issuer keys supported.
*
* @param[out] numberOfAliroCredentialIssuerKeysSupported The number of credential issuer keys.
*/
virtual CHIP_ERROR GetNumberOfAliroCredentialIssuerKeysSupported(uint16_t & numberOfAliroCredentialIssuerKeysSupported) = 0;

/**
* @brief Get the maximum number of Aliro endpoint keys supported.
*
* @param[out] numberOfAliroEndpointKeysSupported The number of endpoint keys.
*/
virtual CHIP_ERROR GetNumberOfAliroEndpointKeysSupported(uint16_t & numberOfAliroEndpointKeysSupported) = 0;
};

} // namespace DoorLock
} // namespace Clusters
} // namespace app
} // namespace chip
33 changes: 33 additions & 0 deletions src/app/clusters/door-lock-server/door-lock-server-callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,36 @@ emberAfPluginDoorLockGetFaceCredentialLengthConstraints(chip::EndpointId endpoin
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetNumberOfAliroCredentialIssuerKeyCredentialsSupported(chip::EndpointId endpointId,
uint16_t & maxNumberOfCredentials)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetNumberOfAliroEvictableEndpointKeyCredentialsSupported(chip::EndpointId endpointId,
uint16_t & maxNumberOfCredentials)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockGetNumberOfAliroNonEvictableEndpointKeyCredentialsSupported(chip::EndpointId endpointId,
uint16_t & maxNumberOfCredentials)
{
return false;
}

bool __attribute__((weak))
emberAfPluginDoorLockSetAliroReaderConfig(EndpointId endpointId, const ByteSpan & signingKey, ByteSpan & verificationKey,
ByteSpan & groupIdentifier, Optional<ByteSpan> groupResolvingKey)
{
return false;
}

bool __attribute__((weak)) emberAfPluginDoorLockClearAliroReaderConfig(chip::EndpointId endpointId)
{
return false;
}
Loading

0 comments on commit e7bb3b3

Please sign in to comment.