nl::Weave::DeviceLayer::Internal::NRF5Config

#include <src/adaptations/device-layer/include/Weave/DeviceLayer/nRF5/nRF5Config.h>

Cung cấp các hàm và định nghĩa để truy cập vào cấu hình thiết bị được duy trì trên các nền tảng dựa trên SDK nRF5 của Bắc Âu.

Tóm tắt

Phương thức triển khai này sử dụng thư viện Bộ nhớ dữ liệu flash của Bắc Âu (FDS) làm lớp lưu trữ cơ bản.

LƯU Ý: Lớp này được thiết kế để kết hợp với lớp con cụ thể của mẫu GenericConfigurationManagerImpl<>. Khi được sử dụng theo cách này, lớp này sẽ cung cấp các phương thức triển khai một cách tự nhiên cho các thành phần được uỷ quyền mà lớp mẫu tham chiếu (ví dụ: phương thức ReadConfigValue()).

Tính kế thừa

Lớp con đã biết trực tiếp:
  nl::Weave::DeviceLayer::ConfigurationManagerImpl
  nl::Weave::DeviceLayer::Internal::GroupKeyStoreImpl

Loại công khai

Key đang sử dụng
uint32_t

Kiểu được bảo vệ

ForEachRecordFunct đang sử dụng
std::function< WEAVE_ERROR(const fds_flash_record_t &rec, bool &deleteRec)>

Thuộc tính tĩnh công khai

kConfigKey_FabricId = NRF5ConfigKey(kFileId_WeaveConfig, 0x0007)
constexpr Key
kConfigKey_FabricSecret = NRF5ConfigKey(kFileId_WeaveConfig, 0x000B)
constexpr Key
kConfigKey_FailSafeArmed = NRF5ConfigKey(kFileId_WeaveConfig, 0x000D)
constexpr Key
kConfigKey_GroupKey = NRF5ConfigKey(kFileId_WeaveConfig, 0x000E)
constexpr Key
kConfigKey_LastUsedEpochKeyId = NRF5ConfigKey(kFileId_WeaveConfig, 0x000C)
constexpr Key
kConfigKey_ManufacturingDate = NRF5ConfigKey(kFileId_WeaveFactory, 0x0005)
constexpr Key
kConfigKey_MfrDeviceCert = NRF5ConfigKey(kFileId_WeaveFactory, 0x0003)
constexpr Key
kConfigKey_MfrDeviceICACerts = NRF5ConfigKey(kFileId_WeaveFactory, 0x0010)
constexpr Key
kConfigKey_MfrDeviceId = NRF5ConfigKey(kFileId_WeaveFactory, 0x0002)
constexpr Key
kConfigKey_MfrDevicePrivateKey = NRF5ConfigKey(kFileId_WeaveFactory, 0x0004)
constexpr Key
kConfigKey_OperationalDeviceCert = NRF5ConfigKey(kFileId_WeaveConfig, 0x0012)
constexpr Key
kConfigKey_OperationalDeviceICACerts = NRF5ConfigKey(kFileId_WeaveConfig, 0x0013)
constexpr Key
kConfigKey_OperationalDeviceId = NRF5ConfigKey(kFileId_WeaveConfig, 0x0011)
constexpr Key
kConfigKey_OperationalDevicePrivateKey = NRF5ConfigKey(kFileId_WeaveConfig, 0x0014)
constexpr Key
kConfigKey_PairedAccountId = NRF5ConfigKey(kFileId_WeaveConfig, 0x0009)
constexpr Key
kConfigKey_PairingCode = NRF5ConfigKey(kFileId_WeaveFactory, 0x0006)
constexpr Key
kConfigKey_ProductRevision = NRF5ConfigKey(kFileId_WeaveFactory, 0x000F)
constexpr Key
kConfigKey_SerialNum = NRF5ConfigKey(kFileId_WeaveFactory, 0x0001)
constexpr Key
kConfigKey_ServiceConfig = NRF5ConfigKey(kFileId_WeaveConfig, 0x0008)
constexpr Key
kConfigKey_ServiceId = NRF5ConfigKey(kFileId_WeaveConfig, 0x000A)
constexpr Key
kFDSFileIdMax = 0xBFFF
constexpr uint16_t
Giá trị tối đa có thể sử dụng cho mã tệp FDS (theo SDK Bắc Âu)
kFDSFileIdMin = 0x0000
constexpr uint16_t
Giá trị tối thiểu có thể được sử dụng cho mã tệp FDS (mỗi SDK Bắc Âu)
kFDSRecordKeyMax = 0xBFFF
constexpr uint16_t
Giá trị tối đa có thể dùng cho một khoá bản ghi FDS (theo SDK Bắc Âu)
kFDSRecordKeyMin = 0x0001
constexpr uint16_t
Giá trị tối thiểu có thể dùng cho một khoá bản ghi FDS (theo SDK Bắc Âu)
kFileId_WeaveConfig = 0x235B
constexpr uint16_t
Tệp FDS chứa các giá trị cấu hình động được đặt trong thời gian chạy.
kFileId_WeaveCounter = 0x235C
constexpr uint16_t
Tệp FDS chứa giá trị bộ đếm động được đặt trong thời gian chạy.
kFileId_WeaveFactory = 0x235A
constexpr uint16_t
Tệp FDS chứa các giá trị cấu hình cố định được thiết lập tại thời điểm sản xuất.
kPersistedCounterRecordKeyBase = kFDSRecordKeyMin
constexpr uint16_t
Khoá bản ghi cơ sở cho các bản ghi chứa các giá trị bộ đếm được duy trì của Weave.
kPersistedCounterRecordKeyMax = kFDSRecordKeyMax
constexpr uint16_t
Khoá bản ghi tối đa cho các bản ghi chứa giá trị bộ đếm được duy trì của Weave.

Thuộc tính tĩnh được bảo vệ

kFDSWordSize = 4
constexpr uint16_t
sActiveAsyncOp
FDSAsyncOp *volatile
sAsyncOpCompletionSem
SemaphoreHandle_t

Hàm tĩnh công khai

ClearConfigValue(Key key)
ConfigValueExists(Key key)
bool
FactoryResetConfig(void)
Init(void)
ReadConfigValue(Key key, bool & val)
ReadConfigValue(Key key, uint32_t & val)
ReadConfigValue(Key key, uint64_t & val)
ReadConfigValueBin(Key key, uint8_t *buf, size_t bufSize, size_t & outLen)
ReadConfigValueStr(Key key, char *buf, size_t bufSize, size_t & outLen)
RunConfigUnitTest(void)
void
WriteConfigValue(Key key, bool val)
WriteConfigValue(Key key, uint32_t val)
WriteConfigValue(Key key, uint64_t val)
WriteConfigValueBin(Key key, const uint8_t *data, size_t dataLen)
WriteConfigValueStr(Key key, const char *str)
WriteConfigValueStr(Key key, const char *str, size_t strLen)

Hàm tĩnh được bảo vệ

DoAsyncFDSOp(FDSAsyncOp & asyncOp)
FDSWords(size_t s)
constexpr uint16_t
Số từ FDS cần thiết để chứa một đối tượng có kích thước nhất định.
ForEachRecord(uint16_t fileId, uint16_t recordKey, ForEachRecordFunct funct)
GetFileId(uint32_t key)
constexpr uint16_t
Trích xuất mã tệp FDS từ Giá trị khoá.
GetRecordKey(uint32_t key)
constexpr uint16_t
Trích xuất khoá bản ghi FDS từ Giá trị khoá.
OpenRecord(NRF5Config::Key key, fds_record_desc_t & recDesc, fds_flash_record_t & rec)

Loại công khai

Khoá

uint32_t Key

Kiểu được bảo vệ

ForEachRecordFunct

std::function< WEAVE_ERROR(const fds_flash_record_t &rec, bool &deleteRec)> ForEachRecordFunct

Thuộc tính tĩnh công khai

kConfigKey_FabricId

constexpr Key kConfigKey_FabricId = NRF5ConfigKey(kFileId_WeaveConfig,  0x0007)

kConfigKey_FabricSecret

constexpr Key kConfigKey_FabricSecret = NRF5ConfigKey(kFileId_WeaveConfig,  0x000B)

kConfigKey_FailSafeArmed

constexpr Key kConfigKey_FailSafeArmed = NRF5ConfigKey(kFileId_WeaveConfig,  0x000D)

kConfigKey_GroupKey

constexpr Key kConfigKey_GroupKey = NRF5ConfigKey(kFileId_WeaveConfig,  0x000E)

kConfigKey_LastUsedEpochKeyId

constexpr Key kConfigKey_LastUsedEpochKeyId = NRF5ConfigKey(kFileId_WeaveConfig,  0x000C)

kConfigKey_ManufacturingDate

constexpr Key kConfigKey_ManufacturingDate = NRF5ConfigKey(kFileId_WeaveFactory, 0x0005)

kConfigKey_MfrDeviceCert

constexpr Key kConfigKey_MfrDeviceCert = NRF5ConfigKey(kFileId_WeaveFactory, 0x0003)

kConfigKey_MfrDeviceICACerts

constexpr Key kConfigKey_MfrDeviceICACerts = NRF5ConfigKey(kFileId_WeaveFactory, 0x0010)

kConfigKey_MfrDeviceId

constexpr Key kConfigKey_MfrDeviceId = NRF5ConfigKey(kFileId_WeaveFactory, 0x0002)

kConfigKey_MfrDevicePrivateKey

constexpr Key kConfigKey_MfrDevicePrivateKey = NRF5ConfigKey(kFileId_WeaveFactory, 0x0004)

kConfigKey_OperationalDeviceCert

constexpr Key kConfigKey_OperationalDeviceCert = NRF5ConfigKey(kFileId_WeaveConfig,  0x0012)

kConfigKey_OperationalDeviceICACerts

constexpr Key kConfigKey_OperationalDeviceICACerts = NRF5ConfigKey(kFileId_WeaveConfig,  0x0013)

kConfigKey_OperationalDeviceId

constexpr Key kConfigKey_OperationalDeviceId = NRF5ConfigKey(kFileId_WeaveConfig,  0x0011)

kConfigKey_OperationalDevicePrivateKey

constexpr Key kConfigKey_OperationalDevicePrivateKey = NRF5ConfigKey(kFileId_WeaveConfig,  0x0014)

kConfigKey_PairedAccountId

constexpr Key kConfigKey_PairedAccountId = NRF5ConfigKey(kFileId_WeaveConfig,  0x0009)

kConfigKey_PairingCode

constexpr Key kConfigKey_PairingCode = NRF5ConfigKey(kFileId_WeaveFactory, 0x0006)

kConfigKey_ProductRevision

constexpr Key kConfigKey_ProductRevision = NRF5ConfigKey(kFileId_WeaveFactory, 0x000F)

kConfigKey_SerialNum

constexpr Key kConfigKey_SerialNum = NRF5ConfigKey(kFileId_WeaveFactory, 0x0001)

kConfigKey_ServiceConfig

constexpr Key kConfigKey_ServiceConfig = NRF5ConfigKey(kFileId_WeaveConfig,  0x0008)

kConfigKey_ServiceId

constexpr Key kConfigKey_ServiceId = NRF5ConfigKey(kFileId_WeaveConfig,  0x000A)

kFDSFileIdMax

constexpr uint16_t kFDSFileIdMax = 0xBFFF

Giá trị tối đa có thể sử dụng cho mã tệp FDS (theo SDK Bắc Âu)

kFDSFileIdMin

constexpr uint16_t kFDSFileIdMin = 0x0000

Giá trị tối thiểu có thể được sử dụng cho mã tệp FDS (mỗi SDK Bắc Âu)

kFDSRecordKeyMax

constexpr uint16_t kFDSRecordKeyMax = 0xBFFF

Giá trị tối đa có thể dùng cho một khoá bản ghi FDS (theo SDK Bắc Âu)

kFDSRecordKeyMin

constexpr uint16_t kFDSRecordKeyMin = 0x0001

Giá trị tối thiểu có thể dùng cho một khoá bản ghi FDS (theo SDK Bắc Âu)

kFileId_WeaveConfig

constexpr uint16_t kFileId_WeaveConfig = 0x235B

Tệp FDS chứa các giá trị cấu hình động được đặt trong thời gian chạy.

Xoá trong quá trình đặt lại về trạng thái ban đầu.

kFileId_WeaveCounter

constexpr uint16_t kFileId_WeaveCounter = 0x235C

Tệp FDS chứa giá trị bộ đếm động được đặt trong thời gian chạy.

Tệp này được giữ lại trong quá trình đặt lại về trạng thái ban đầu.

kFileId_WeaveFactory

constexpr uint16_t kFileId_WeaveFactory = 0x235A

Tệp FDS chứa các giá trị cấu hình cố định được thiết lập tại thời điểm sản xuất.

Tệp này được giữ lại trong quá trình đặt lại về trạng thái ban đầu.

kPersistedCounterRecordKeyBase

constexpr uint16_t kPersistedCounterRecordKeyBase = kFDSRecordKeyMin

Khoá bản ghi cơ sở cho các bản ghi chứa các giá trị bộ đếm được duy trì của Weave.

Mã bộ đếm Weave được thêm vào giá trị này để tạo khoá bản ghi FDS.

kPersistedCounterRecordKeyMax

constexpr uint16_t kPersistedCounterRecordKeyMax = kFDSRecordKeyMax

Khoá bản ghi tối đa cho các bản ghi chứa giá trị bộ đếm được duy trì của Weave.

Thuộc tính tĩnh được bảo vệ

kFDSWordSize

constexpr uint16_t kFDSWordSize = 4

sActiveAsyncOp

FDSAsyncOp *volatile sActiveAsyncOp

sAsyncOpCompletionSem

SemaphoreHandle_t sAsyncOpCompletionSem

Hàm tĩnh công khai

ClearConfigValue

WEAVE_ERROR ClearConfigValue(
  Key key
)

ConfigValueExists

bool ConfigValueExists(
  Key key
)

FactoryResetConfig

WEAVE_ERROR FactoryResetConfig(
  void
)

Bắt đầu

WEAVE_ERROR Init(
  void
)

ReadConfigValue

WEAVE_ERROR ReadConfigValue(
  Key key,
  bool & val
)

ReadConfigValue

WEAVE_ERROR ReadConfigValue(
  Key key,
  uint32_t & val
)

ReadConfigValue

WEAVE_ERROR ReadConfigValue(
  Key key,
  uint64_t & val
)

ReadConfigValueBin

WEAVE_ERROR ReadConfigValueBin(
  Key key,
  uint8_t *buf,
  size_t bufSize,
  size_t & outLen
)

ReadConfigValueStr

WEAVE_ERROR ReadConfigValueStr(
  Key key,
  char *buf,
  size_t bufSize,
  size_t & outLen
)

RunConfigUnitTest

void RunConfigUnitTest(
  void
)

WriteConfigValue

WEAVE_ERROR WriteConfigValue(
  Key key,
  bool val
)

WriteConfigValue

WEAVE_ERROR WriteConfigValue(
  Key key,
  uint32_t val
)

WriteConfigValue

WEAVE_ERROR WriteConfigValue(
  Key key,
  uint64_t val
)

WriteConfigValueBin

WEAVE_ERROR WriteConfigValueBin(
  Key key,
  const uint8_t *data,
  size_t dataLen
)

WriteConfigValueStr

WEAVE_ERROR WriteConfigValueStr(
  Key key,
  const char *str
)

WriteConfigValueStr

WEAVE_ERROR WriteConfigValueStr(
  Key key,
  const char *str,
  size_t strLen
)

Hàm tĩnh được bảo vệ

DoAsyncFDSOp

WEAVE_ERROR DoAsyncFDSOp(
  FDSAsyncOp & asyncOp
)

FDSWords

constexpr uint16_t FDSWords(
  size_t s
)

Số từ FDS cần thiết để chứa một đối tượng có kích thước nhất định.

ForEachRecord

WEAVE_ERROR ForEachRecord(
  uint16_t fileId,
  uint16_t recordKey,
  ForEachRecordFunct funct
)

GetFileId

constexpr uint16_t GetFileId(
  uint32_t key
)

Trích xuất mã tệp FDS từ Giá trị khoá.

GetRecordKey

constexpr uint16_t GetRecordKey(
  uint32_t key
)

Trích xuất khoá bản ghi FDS từ Giá trị khoá.

OpenRecord

WEAVE_ERROR OpenRecord(
  NRF5Config::Key key,
  fds_record_desc_t & recDesc,
  fds_flash_record_t & rec
)