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

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

基于 Nordic nRF5 SDK,提供用于访问平台上持久保留的设备配置的函数和定义。

摘要

该实现使用北欧闪存数据存储 (FDS) 库作为底层存储层。

注意:此类旨在混合到 GenericConfigurationManagerImpl<> 模板的具体子类中。以这种方式使用时,该类会为模板类引用的委派成员(例如 ReadConfigValue() 方法)自然提供实现。

继承

已知直接子类:
  nl::Weave::DeviceLayer::ConfigurationManagerImpl
  nl::Weave::DeviceLayer::Internal::GroupKeyStoreImpl

公共类型

Key using
uint32_t

受保护的类型

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

公共静态属性

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
可用于 FDS 文件 ID 的最大值(每个 Nordic SDK)
kFDSFileIdMin = 0x0000
constexpr uint16_t
可用于 FDS 文件 ID 的最小值(每个 Nordic SDK)
kFDSRecordKeyMax = 0xBFFF
constexpr uint16_t
可用于 FDS 记录键的最大值(每个 Nordic SDK)
kFDSRecordKeyMin = 0x0001
constexpr uint16_t
可用于 FDS 记录键的最小值(每个 Nordic SDK)
kFileId_WeaveConfig = 0x235B
constexpr uint16_t
包含在运行时设置的动态配置值的 FDS 文件。
kFileId_WeaveCounter = 0x235C
constexpr uint16_t
包含在运行时设置的动态计数器值的 FDS 文件。
kFileId_WeaveFactory = 0x235A
constexpr uint16_t
FDS 文件,其中包含制造时设置的永久性配置值。
kPersistedCounterRecordKeyBase = kFDSRecordKeyMin
constexpr uint16_t
包含 Weave 持久化计数器值的记录的基本记录键。
kPersistedCounterRecordKeyMax = kFDSRecordKeyMax
constexpr uint16_t
包含 Weave 持久化计数器值的记录的最大记录键。

受保护的静态属性

kFDSWordSize = 4
constexpr uint16_t
sActiveAsyncOp
FDSAsyncOp *volatile
sAsyncOpCompletionSem
SemaphoreHandle_t

公共静态函数

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)

受保护的静态函数

DoAsyncFDSOp(FDSAsyncOp & asyncOp)
FDSWords(size_t s)
constexpr uint16_t
容纳给定大小对象所需的 FDS 单词数。
ForEachRecord(uint16_t fileId, uint16_t recordKey, ForEachRecordFunct funct)
GetFileId(uint32_t key)
constexpr uint16_t
从键值对中提取 FDS 文件 ID。
GetRecordKey(uint32_t key)
constexpr uint16_t
从键值对中提取 FDS 记录键。
OpenRecord(NRF5Config::Key key, fds_record_desc_t & recDesc, fds_flash_record_t & rec)

公共类型

uint32_t Key

受保护的类型

ForEachRecordFunct

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

公共静态属性

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

可用于 FDS 文件 ID 的最大值(每个 Nordic SDK)

kFDSFileIdMin

constexpr uint16_t kFDSFileIdMin = 0x0000

可用于 FDS 文件 ID 的最小值(每个 Nordic SDK)

kFDSRecordKeyMax

constexpr uint16_t kFDSRecordKeyMax = 0xBFFF

可用于 FDS 记录键的最大值(每个 Nordic SDK)

kFDSRecordKeyMin

constexpr uint16_t kFDSRecordKeyMin = 0x0001

可用于 FDS 记录键的最小值(每个 Nordic SDK)

kFileId_WeaveConfig

constexpr uint16_t kFileId_WeaveConfig = 0x235B

包含在运行时设置的动态配置值的 FDS 文件。

在恢复出厂设置时被清除。

kFileId_WeaveCounter

constexpr uint16_t kFileId_WeaveCounter = 0x235C

包含在运行时设置的动态计数器值的 FDS 文件。

在恢复出厂设置期间保留。

kFileId_WeaveFactory

constexpr uint16_t kFileId_WeaveFactory = 0x235A

FDS 文件,其中包含制造时设置的永久性配置值。

在恢复出厂设置期间保留。

kPersistedCounterRecordKeyBase

constexpr uint16_t kPersistedCounterRecordKeyBase = kFDSRecordKeyMin

包含 Weave 持久化计数器值的记录的基本记录键。

将 Weave 计数器 ID 添加到此值中,以形成 FDS 记录键。

kPersistedCounterRecordKeyMax

constexpr uint16_t kPersistedCounterRecordKeyMax = kFDSRecordKeyMax

包含 Weave 持久化计数器值的记录的最大记录键。

受保护的静态属性

kFDSWordSize

constexpr uint16_t kFDSWordSize = 4

sActiveAsyncOp

FDSAsyncOp *volatile sActiveAsyncOp

sAsyncOpCompletionSem

SemaphoreHandle_t sAsyncOpCompletionSem

公共静态函数

ClearConfigValue

WEAVE_ERROR ClearConfigValue(
  Key key
)

ConfigValueExists

bool ConfigValueExists(
  Key key
)

FactoryResetConfig

WEAVE_ERROR FactoryResetConfig(
  void
)

Init

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
)

受保护的静态函数

DoAsyncFDSOp

WEAVE_ERROR DoAsyncFDSOp(
  FDSAsyncOp & asyncOp
)

FDSWords

constexpr uint16_t FDSWords(
  size_t s
)

容纳给定大小对象所需的 FDS 单词数。

ForEachRecord

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

GetFileId

constexpr uint16_t GetFileId(
  uint32_t key
)

从键值对中提取 FDS 文件 ID。

GetRecordKey

constexpr uint16_t GetRecordKey(
  uint32_t key
)

从键值对中提取 FDS 记录键。

OpenRecord

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