lucicop | 3c11f10 | 2022-09-30 23:57:15 +0300 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) 2022 Project CHIP Authors |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #pragma once |
| 19 | |
| 20 | #include <credentials/DeviceAttestationCredsProvider.h> |
| 21 | #include <platform/CommissionableDataProvider.h> |
| 22 | #include <platform/DeviceInstanceInfoProvider.h> |
| 23 | |
| 24 | #include "qvCHIP.h" |
| 25 | |
| 26 | namespace chip { |
| 27 | namespace DeviceLayer { |
| 28 | |
| 29 | class FactoryDataProvider : public chip::Credentials::DeviceAttestationCredentialsProvider, |
| 30 | public CommissionableDataProvider, |
| 31 | public DeviceInstanceInfoProvider |
| 32 | { |
| 33 | public: |
| 34 | CHIP_ERROR Init(); |
| 35 | |
| 36 | // ===== Members functions that implement the DeviceAttestationCredentialsProvider |
| 37 | CHIP_ERROR GetCertificationDeclaration(MutableByteSpan & outBuffer) override; |
| 38 | CHIP_ERROR GetFirmwareInformation(MutableByteSpan & out_firmware_info_buffer) override; |
| 39 | CHIP_ERROR GetDeviceAttestationCert(MutableByteSpan & outBuffer) override; |
| 40 | CHIP_ERROR GetProductAttestationIntermediateCert(MutableByteSpan & outBuffer) override; |
| 41 | CHIP_ERROR SignWithDeviceAttestationKey(const ByteSpan & messageToSign, MutableByteSpan & outSignBuffer) override; |
| 42 | |
| 43 | // ===== Members functions that implement the CommissionableDataProvider |
| 44 | CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator) override; |
| 45 | CHIP_ERROR SetSetupDiscriminator(uint16_t setupDiscriminator) override; |
| 46 | CHIP_ERROR GetSpake2pIterationCount(uint32_t & iterationCount) override; |
| 47 | CHIP_ERROR GetSpake2pSalt(MutableByteSpan & saltBuf) override; |
| 48 | CHIP_ERROR GetSpake2pVerifier(MutableByteSpan & verifierBuf, size_t & verifierLen) override; |
| 49 | CHIP_ERROR GetSetupPasscode(uint32_t & setupPasscode) override; |
| 50 | CHIP_ERROR SetSetupPasscode(uint32_t setupPasscode) override; |
| 51 | |
| 52 | // ===== Members functions that implement the DeviceInstanceInfoProvider |
| 53 | CHIP_ERROR GetVendorName(char * buf, size_t bufSize) override; |
| 54 | CHIP_ERROR GetVendorId(uint16_t & vendorId) override; |
| 55 | CHIP_ERROR GetProductName(char * buf, size_t bufSize) override; |
| 56 | CHIP_ERROR GetProductId(uint16_t & productId) override; |
Damian Królik | 48860e2 | 2022-11-04 15:07:07 +0100 | [diff] [blame] | 57 | CHIP_ERROR GetPartNumber(char * buf, size_t bufSize) override; |
| 58 | CHIP_ERROR GetProductURL(char * buf, size_t bufSize) override; |
| 59 | CHIP_ERROR GetProductLabel(char * buf, size_t bufSize) override; |
lucicop | 3c11f10 | 2022-09-30 23:57:15 +0300 | [diff] [blame] | 60 | CHIP_ERROR GetSerialNumber(char * buf, size_t bufSize) override; |
| 61 | CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & day) override; |
| 62 | CHIP_ERROR GetHardwareVersion(uint16_t & hardwareVersion) override; |
| 63 | CHIP_ERROR GetHardwareVersionString(char * buf, size_t bufSize) override; |
| 64 | CHIP_ERROR GetRotatingDeviceIdUniqueId(MutableByteSpan & uniqueIdSpan) override; |
| 65 | |
| 66 | // ===== Members functions that are platform-specific |
| 67 | CHIP_ERROR GetEnableKey(MutableByteSpan & enableKey); |
| 68 | |
| 69 | protected: |
| 70 | static CHIP_ERROR MapQorvoError(qvStatus_t aStatus); |
| 71 | }; |
| 72 | |
| 73 | } // namespace DeviceLayer |
| 74 | } // namespace chip |