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

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

提供函式和定義,以根據 Nordic nRF5 SDK 的平台存取永久裝置設定。

摘要

這個實作使用 Nordic Flash Data Storage (FDS) 程式庫做為基礎儲存層。

注意:此類別旨在混合於 GenericConfigurationManagerImpl<> 範本的具體子類別中。使用這個方法時,類別自然會為範本類別參照的委派成員提供實作 (例如 ReadConfigValue() 方法)。

繼承

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

公開類型

Key 使用
uint32_t

受保護的類型

ForEachRecordFunct 使用
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
每個 Nordic SDK 可用於 FDS 檔案 ID 的最大值
kFDSFileIdMin = 0x0000
constexpr uint16_t
每個 Nordic SDK 可用於 FDS 檔案 ID 的最小值
kFDSRecordKeyMax = 0xBFFF
constexpr uint16_t
FDS 記錄金鑰可使用的最大值 (每個北歐 SDK)
kFDSRecordKeyMin = 0x0001
constexpr uint16_t
每個 Nordic SDK 可用於 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

每個 Nordic SDK 可用於 FDS 檔案 ID 的最大值

kFDSFileIdMin

constexpr uint16_t kFDSFileIdMin = 0x0000

每個 Nordic SDK 可用於 FDS 檔案 ID 的最小值

kFDSRecordKeyMax

constexpr uint16_t kFDSRecordKeyMax = 0xBFFF

FDS 記錄金鑰可使用的最大值 (每個北歐 SDK)

kFDSRecordKeyMin

constexpr uint16_t kFDSRecordKeyMin = 0x0001

每個 Nordic SDK 可用於 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
)