nl:: 编织: 配置文件:: DataManagement_Current
此命名空间包含 Weave 中当前用于生产环境的 Weave 数据管理 (WDM) 配置文件的所有接口。
总结
类型定义符 |
|
---|---|
CommandFlags
|
typedef |
DataVersion
|
typedefuint64_t
|
EventProcessor
|
typedefvoid *
|
EventWriterFunct)(nl::Weave::TLV::TLVWriter &ioWriter, uint8_t inDataTag, void *appData)
|
typedef 一个用于为事件日志记录子系统提供 eventData 元素的函数。 |
FetchExternalEventsFunct)(EventLoadOutContext *aContext)
|
typedef 用于获取事件数据的平台回调的函数原型。 |
GenericTraitSinkCatalog
|
typedef |
GenericTraitSourceCatalog
|
typedef |
ImportanceType
|
typedef 日志条目的重要性。 |
IteratorCallback)(void *aTraitInstance, TraitDataHandle aHandle, void *aContext)
|
typedefvoid(*
特征句柄迭代器。 |
LoggingBufferHandler)(void *inAppState, PacketBuffer *inBuffer)
|
typedef |
NotifyExternalEventsDeliveredFunct)(ExternalEvents *inEv, event_id_t inLastDeliveredEventID, uint64_t inRecipientNodeID)
|
typedefvoid(*
将外部事件传递给远程订阅者时调用的回调函数原型。 |
NotifyExternalEventsEvictedFunct)(ExternalEvents *inEv)
|
typedefvoid(*
从缓冲区中逐出外部事件时调用的回调函数原型。 |
PropertyDictionaryKey
|
typedefuint16_t
|
PropertyPathHandle
|
typedefuint32_t
PropertyPathHandle 是 WDM 路径相对于特征实例根的唯一 32 位数值哈希。 |
PropertySchemaHandle
|
typedefuint16_t
|
SchemaVersion
|
typedefuint16_t
|
SingleResourceSinkTraitCatalog
|
typedef |
SingleResourceSourceTraitCatalog
|
typedef |
TimestampType
|
typedef EventOptions 中包含的时间戳的有效性和类型。 |
TraitDataHandle
|
typedefuint16_t
|
duration_t
|
nl::Weave::Profiles::DataManagement_Current::duration_tuint32_t
用于描述时长的类型(以毫秒为单位)。 |
event_id_t
|
nl::Weave::Profiles::DataManagement_Current::event_id_tuint32_t
事件 ID 的类型。 |
timestamp_t
|
nl::Weave::Profiles::DataManagement_Current::timestamp_tuint32_t
用于描述时间戳的类型(以毫秒为单位)。 |
utc_timestamp_t
|
nl::Weave::Profiles::DataManagement_Current::utc_timestamp_tuint64_t
用于描述 UTC 时间戳的类型(以毫秒为单位)。 |
变量 |
|
---|---|
sInstance
|
|
sLogFileName = "topazlog"[]
|
char
|
函数 |
|
---|---|
BdxErrorHandler(nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, WEAVE_ERROR aErrorCode)
|
void
|
BdxGetBlockHandler(nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, uint64_t *aLength, uint8_t **aDataBlock, bool *aIsLastBlock)
|
void
|
BdxRejectHandler(nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, nl::Weave::Profiles::StatusReporting::StatusReport *aReport)
|
void
|
BdxSendAcceptHandler(nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, nl::Weave::Profiles::BulkDataTransfer::SendAccept *aSendAcceptMsg)
|
|
BdxXferDoneHandler(nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer)
|
void
|
BdxXferErrorHandler(nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, nl::Weave::Profiles::StatusReporting::StatusReport *aXferError)
|
void
|
CreatePropertyPathHandle(PropertySchemaHandle aPropertyPathSchemaId, PropertyDictionaryKey aPropertyPathDictionaryKey)
|
|
EventWriterTLVCopy(TLVWriter & ioWriter, uint8_t inDataTag, void *appData)
|
辅助函数,用于将已序列化的 eventdata 元素转换为事件缓冲区。
|
GetPropertyDictionaryKey(PropertyPathHandle aHandle)
|
PropertyDictionaryKey
|
GetPropertySchemaHandle(PropertyPathHandle aHandle)
|
PropertySchemaHandle
|
IsNullPropertyPathHandle(PropertyPathHandle aHandle)
|
bool
|
IsRootPropertyPathHandle(PropertyPathHandle aHandle)
|
bool
|
IsVersionNewer(const DataVersion & aVersion, const DataVersion & aReference)
|
bool
这是算法比较的优化实现。
|
IsVersionNewerOrEqual(const DataVersion & aVersion, const DataVersion & aReference)
|
bool
|
Locate(TraitDataHandle aTraitDataHandle, const TraitCatalogBase< TraitDataSink > *aDataSinkCatalog)
|
实用函数,用于在 TraitDataSink 目录中查找 TraitUpdatableDataSink。
|
LogEvent(const EventSchema & inSchema, nl::Weave::TLV::TLVReader & inData)
|
通过预序列化表单记录事件。
|
LogEvent(const EventSchema & inSchema, nl::Weave::TLV::TLVReader & inData, const EventOptions *inOptions)
|
通过其他选项记录预序列化表单的事件。
|
LogEvent(const EventSchema & inSchema, EventWriterFunct inEventWriter, void *inAppData)
|
通过回调记录事件。
|
LogEvent(const EventSchema & inSchema, EventWriterFunct inEventWriter, void *inAppData, const EventOptions *inOptions)
|
通过回调记录事件,并提供选项。
|
LogFreeform(ImportanceType inImportance, const char *inFormat, ...)
|
LogFreeform 会向默认事件流发出一个自由格式的字符串。
|
LookForElementWithTag(const nl::Weave::TLV::TLVReader & aSrcReader, const uint64_t aTagInApiForm, nl::Weave::TLV::TLVReader *apDstReader)
|
|
PlainTextWriter(TLVWriter & ioWriter, uint8_t inDataTag, void *appData)
|
一个用于发出自由格式的文本作为调试事件的辅助函数。
|
PlainTextWriter(::nl::Weave::TLV::TLVWriter & ioWriter, uint8_t inDataTag, void *appData)
|
一个用于发出自由格式的文本作为调试事件的辅助函数。
|
operator!=(const ResourceIdentifier & lhs, const ResourceIdentifier & rhs)
|
bool
|
operator==(const ResourceIdentifier & lhs, const ResourceIdentifier & rhs)
|
bool
|
联合体 |
|
---|---|
nl:: |
提供应用集系统或 UTC 时间戳的并集。 |
枚举
@100
@100
kNestDebug_StringLogEntryEvent 的代码。
属性 | |
---|---|
kTag_Message
|
包含实际调试消息的字符串。 |
kTag_Region
|
一个 32 位无符号符号,表示日志区域,即日志消息所属的模块。 |
@101
@101
kNestDebug_TokenizedLogEntryEvent 的代码。
属性 | |
---|---|
kTag_Args
|
与令牌消息一起发送的参数数组。 |
kTag_Token
|
与令牌对应的 32 位未签名值。 |
@102
@102
用于保留事件的标记。
@104
@104
WDM 配置文件消息类型。
这些值会在数据管理规范中调出。
@105
@105
特定于 WDM 的状态代码。
@147
@147
@95
@95
日志记录设置标记。
属性 | |
---|---|
kTag_CurrentImportance
|
当前日志记录重要性,其值为 ImportanceType 类型。 |
kTag_ImportanceExpiration
|
当前提升的日志记录设置还原为默认值的时间(以世界协调时间 (UTC) 为单位)。 |
kTag_LoggingDestination
|
指示日志上传目标位置的网址。 |
kTag_MaximumLogUploadInterval
|
自动触发日志上传尝试之间的最大时长(以秒为单位)。 |
kTag_MinimumLogUploadInterval
|
自动触发日志上传尝试之间的最短持续时间(以秒为单位)。 |
kTag_TraitLoggingImportance
|
(可选)数组,用于将所选配置文件映射到较高的日志记录级别。 数组中的每个元素都采用一种形式(配置文件、路径、日志记录导入),以选择性地从系统的子集提升日志记录。仅当日志记录优先级高于 currentImportance 优先级时,该配置文件才具有较高的配置文件日志记录优先级,并且该优先级的到期时间与 currentImportance 的到期时间相同。 |
@96
@96
日志记录功能的标记。
属性 | |
---|---|
kTag_LogBufferingCapacity
|
描述日志缓冲容量的 32 位无符号整数(以 kB 为单位)。 |
kTag_LoggingVolume
|
描述预期日志记录量的 32 位无符号整数(以 kB/天为单位)。 |
kTag_SupportedLogTransports
|
受支持的日志传输机制数组。 |
kTag_SupportsNonVolatileStorage
|
指示设备是否支持非易失性日志存储的布尔值。 |
kTag_SupportsPerTraitVerbosity
|
指示设备是否支持每种特征的详细程度的布尔值。 |
kTag_SupportsStreaming
|
指示设备是否支持流式传输日志的布尔值。 |
@97
@97
事件元数据的标记。
如需了解标记值的完整语义,请参阅“事件设计规范”。
属性 | |
---|---|
kTag_EventData
|
(可选)事件数据本身。如果为空,则默认为空结构。 |
kTag_EventDeltaSystemTime
|
WDM 内部代码,与编码中的前一个事件的时间差。 |
kTag_EventDeltaUTCTime
|
WDM 内部代码,与编码中的前一个事件的时间差。 |
kTag_EventID
|
事件的序列号,表示为 64 位无符号数。 必须是依序播放,序列中的跳转表示事件间隙。 |
kTag_EventImportance
|
事件的重要性。 |
kTag_EventResourceID
|
(可选) 该值是与事件相关的资源的 ID。如果省略,则值与 kTag_EventSource 的值相同 |
kTag_EventSource
|
生成事件的设备的 ID。 |
kTag_EventSystemTimestamp
|
(可选)事件的系统时间戳(以毫秒为单位)。 |
kTag_EventTraitInstanceID
|
(可选)生成事件的特征的实例。 |
kTag_EventTraitProfileID
|
必需。等于特征的配置文件 ID 的 32 位无符号整数。 |
kTag_EventType
|
必需。等于此类事件的 wdl.event.id 的 16 位无符号整数。 |
kTag_EventUTCTimestamp
|
(可选)事件的 UTC 时间戳(以毫秒为单位)。 |
kTag_ExternalEventStructure
|
外部事件的内部代码。切勿通过网络传输,切勿在 Weave 库之外使用。 |
kTag_RelatedEventID
|
(可选) 与此事件相关的事件的 ID。如果省略,则值等于 kTag_EventID 的值。 |
kTag_RelatedEventImportance
|
(可选) 相关事件的重要性。如果省略,则值等于 kTag_EventImportance 的值。 |
@98
@98
调试特征的配置文件定义。
@99
@99
Nest Debug 特征的事件类型。
属性 | |
---|---|
kNestDebug_StringLogEntryEvent
|
自由格式字符串调试消息的事件。 |
kNestDebug_TokenizedHeaderEntryEvent
|
用于传递标记化标头信息的事件。 |
kNestDebug_TokenizedLogEntryEvent
|
标记化调试消息的事件。 |
CommandFlag
CommandFlags
属性 | |
---|---|
kCommandFlag_ActionTimeValid
|
设置操作时间何时有效。 |
kCommandFlag_ExpiryTimeValid
|
设置过期时间何时有效。 |
kCommandFlag_InitiationTimeValid
|
设置初始化时间何时有效。 |
kCommandFlag_IsOneWay
|
命令是单向的。 |
kCommandFlag_MustBeVersionValid
|
在版本字段有效时设置。 |
导入类型
ImportanceType
日志条目的重要性。
重要性用于在事件实际发送到日志之前对其进行过滤。相关事件记录在日志中后,我们不会再做出其他规定,将其从日志中清除。重要性级别用于确定事件存储的优先级。如果某个重要性事件被添加到完整缓冲区中,系统会按重要性(和年龄)丢弃该事件以适应该事件。因此,重要性级别只有相对价值。如果系统只使用一个重要性级别,则仅会按年龄顺序丢弃事件,例如环形缓冲区。
属性 | |
---|---|
Debug
|
调试重要性表示系统开发者感兴趣的日志条目,主要用于开发阶段。 调试重要性日志不会考虑受约束设备的带宽或功率预算;因此,它们只能在有限的生产时间范围内用于生产系统。 |
Info
|
信息重要性表示为运行系统提供额外数据洞见和诊断信息的各种日志条目。 信息日志记录级别可能会在生产系统中长时间使用,或者在现场试验中用作默认日志级别。在受限设备上,使用信息级别记录的条目必须在带宽和内存预算中计算,而不是在电源预算中。 |
Production
|
生产重要性表示持续监控和维护 Nest 生态系统的日志条目。 在受限设备上,生产重要性记录的条目必须计入功耗和内存预算,因为预计系统会始终从设备记录和卸载这些条目。 |
ProductionCritical
|
“生产重要性”表示事件会直接影响面向客户的功能。 应用可能会丢失生产关键事件,以指示系统故障。在受限设备上,系统会将生产关键性记录到的条目计入功耗和内存预算中,因为预计系统会始终从设备记录和分流这些条目。 |
LoggingManagementStates
LoggingManagementStates
属性 | |
---|---|
kLoggingManagementState_Holdoff
|
日志分流已完成;我们不会在日志暂停之前重启日志。 |
kLoggingManagementState_Idle
|
没有日志分流正在进行,日志分流可以开始,没有任何约束。 |
kLoggingManagementState_InProgress
|
正在执行日志分流。 |
kLoggingManagementState_Shutdown
|
无法执行任何日志记录操作。 |
类型定义符
CommandFlag
enum nl::Weave::Profiles::DataManagement_Current::CommandFlags CommandFlags
数据版本
uint64_t DataVersion
EventProcessor
void * EventProcessor
EventWriterFunct
WEAVE_ERROR(* EventWriterFunct)(nl::Weave::TLV::TLVWriter &ioWriter, uint8_t inDataTag, void *appData)
一个用于为事件日志记录子系统提供 eventData 元素的函数。
此类函数应为事件日志记录子系统提供 eventData 元素。在事件子系统生成所有必需的事件元数据后,系统就会调用此类函数。使用 nl::Weave::TLV::TLVWriter 对象调用该函数,该对象将发出一个标记有 kTag_EventData 的 TLV 元素;该元素的值必须是包含事件数据的结构。事件数据本身必须使用上下文代码进行构建。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
PlainTextWriter
EventWriterTLVCopy
FetchExternalEventsFunct
WEAVE_ERROR(* FetchExternalEventsFunct)(EventLoadOutContext *aContext)
用于获取事件数据的平台回调的函数原型。
与 FetchEventsFrom 类似,此提取函数会返回从 EventLoadOutContext.mStartingEventID 到 ExternalEvents.mLastEventID 的所有事件。
上下文指针的类型为 FetchExternalEventsContext。其中包括 EventLoadOutContext,以及一些用于 TLV 格式的辅助变量。此外,它还包含一个指向注册回调时创建的 ExternalEvents 结构体的指针。用于指定回调的事件 ID 范围。
从该函数返回时,EventLoadOutContext.mCurrentEventID 应反映第一个未成功写入 TLV 缓冲区的事件 ID。平台必须使用 EventLogging 协议指定的正确格式将事件标头和数据写入 TLV 写入器。平台还必须保持事件和时间戳的唯一性。
所有 TLV 错误都应传播到更高层级。例如,缓冲区空间不足将触发已发送的消息,随后使用剩余事件 ID 再次调用回调函数。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
返回值 |
|
GenericTraitSinkCatalog
GenericTraitCatalogImpl< TraitDataSink > GenericTraitSinkCatalog
GenericTraitSourceCatalog
GenericTraitCatalogImpl< TraitDataSource > GenericTraitSourceCatalog
导入类型
enum nl::Weave::Profiles::DataManagement_Current::ImportanceType ImportanceType
日志条目的重要性。
重要性用于在事件实际发送到日志之前对其进行过滤。相关事件记录在日志中后,我们不会再做出其他规定,将其从日志中清除。重要性级别用于确定事件存储的优先级。如果某个重要性事件被添加到完整缓冲区中,系统会按重要性(和年龄)丢弃该事件以适应该事件。因此,重要性级别只有相对价值。如果系统只使用一个重要性级别,则仅会按年龄顺序丢弃事件,例如环形缓冲区。
IteratorCallback
void(* IteratorCallback)(void *aTraitInstance, TraitDataHandle aHandle, void *aContext)
特征句柄迭代器。
LoggingBufferHandler
WEAVE_ERROR(* LoggingBufferHandler)(void *inAppState, PacketBuffer *inBuffer)
NotifyExternalEventsDeliveredFunct
void(* NotifyExternalEventsDeliveredFunct)(ExternalEvents *inEv, event_id_t inLastDeliveredEventID, uint64_t inRecipientNodeID)
将外部事件传递给远程订阅者时调用的回调函数原型。
当外部事件传送给远程订阅者时,引擎会通知外部事件提供程序。该回调函数包含最后传送的 ID 的事件以及收到事件的订阅者的 ID。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
NotifyExternalEventsEvictedFunct
void(* NotifyExternalEventsEvictedFunct)(ExternalEvents *inEv)
从缓冲区中逐出外部事件时调用的回调函数原型。
从出站消息缓冲区中逐出外部事件对象时,引擎会通知外部事件提供程序。该回调包含要逐出的外部事件。
详情 | |||
---|---|---|---|
参数 |
|
属性字典键
uint16_t PropertyDictionaryKey
属性路径句柄
uint32_t PropertyPathHandle
PropertyPathHandle 是 WDM 路径相对于特征实例根的唯一 32 位数值哈希。
其中包含两个部分:
- 映射到架构静态部分的较低 16 位编号。
- 如果低 16 位引用字典元素中的路径,则存在高 16 位的数字,表示与该元素关联的字典键。如果低 16 位引用非字典元素,则高 16 位应为 0。
一些特征:
- 每个特征都有自己的属性路径句柄空间。
- 每个唯一 WDM 子路径路径都有一个类似且独一无二的 PropertyPathHandle。
- PropertyPathHandles 由特征编译器从 IDL 自动生成(现在手动完成),并在相应特征的头文件中表示为枚举列表。
- 借助这种构造,应用逻辑从不需要直接处理 WDM 路径。而是通过 WDM 处理。
- 路径句柄有两个具有特定含义的保留值:
- 0 表示 'NULL' 句柄
- 1 表示指向特征实例根部的句柄。
PropertySchemaHandle
uint16_t PropertySchemaHandle
SchemaVersion
uint16_t SchemaVersion
SingleResourceSinkTraitCatalog
SingleResourceTraitCatalog< TraitDataSink > SingleResourceSinkTraitCatalog
SingleResourceSourceTraitCatalog
SingleResourceTraitCatalog< TraitDataSource > SingleResourceSourceTraitCatalog
时间戳类型
enum nl::Weave::Profiles::DataManagement_Current::TimestampType TimestampType
EventOptions 中包含的时间戳的有效性和类型。
特征数据句柄
uint16_t TraitDataHandle
持续时间_t
uint32_t duration_t
用于描述时长的类型(以毫秒为单位)。
event_id_t
uint32_t event_id_t
事件 ID 的类型。
timestamp_t
uint32_t timestamp_t
用于描述时间戳的类型(以毫秒为单位)。
utc_timestamp_t
uint64_t utc_timestamp_t
用于描述 UTC 时间戳的类型(以毫秒为单位)。
变量
实例
LoggingManagement sInstance
sLogFileName
char sLogFileName[] = "topazlog"
函数
BdxErrorHandler 类的构造函数
void BdxErrorHandler( nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, WEAVE_ERROR aErrorCode )
BdxGetBlockHandler
void BdxGetBlockHandler( nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, uint64_t *aLength, uint8_t **aDataBlock, bool *aIsLastBlock )
Bdx 拒绝处理程序
void BdxRejectHandler( nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, nl::Weave::Profiles::StatusReporting::StatusReport *aReport )
BdxSendAcceptHandler
WEAVE_ERROR BdxSendAcceptHandler( nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, nl::Weave::Profiles::BulkDataTransfer::SendAccept *aSendAcceptMsg )
BdxXferDoneHandler
void BdxXferDoneHandler( nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer )
BdxXferErrorHandler
void BdxXferErrorHandler( nl::Weave::Profiles::BulkDataTransfer::BDXTransfer *aXfer, nl::Weave::Profiles::StatusReporting::StatusReport *aXferError )
CreatePropertyPathHandle
PropertyPathHandle CreatePropertyPathHandle( PropertySchemaHandle aPropertyPathSchemaId, PropertyDictionaryKey aPropertyPathDictionaryKey )
EventWriterTLVCopy
WEAVE_ERROR EventWriterTLVCopy( TLVWriter & ioWriter, uint8_t inDataTag, void *appData )
辅助函数,用于将已序列化的 eventdata 元素转换为事件缓冲区。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
GetPropertyDictionaryKey
PropertyDictionaryKey GetPropertyDictionaryKey( PropertyPathHandle aHandle )
GetPropertySchemaHandle
PropertySchemaHandle GetPropertySchemaHandle( PropertyPathHandle aHandle )
IsNullPropertyPathHandle
bool IsNullPropertyPathHandle( PropertyPathHandle aHandle )
IsRootPropertyPathHandle
bool IsRootPropertyPathHandle( PropertyPathHandle aHandle )
IsVersionNewer
bool IsVersionNewer( const DataVersion & aVersion, const DataVersion & aReference )
这是算法比较的优化实现。
在客户端,从服务接收的版本始终是最新版本。
IsVersionNewerOrEqual 类
bool IsVersionNewerOrEqual( const DataVersion & aVersion, const DataVersion & aReference )
定位
TraitUpdatableDataSink * Locate( TraitDataHandle aTraitDataHandle, const TraitCatalogBase< TraitDataSink > *aDataSinkCatalog )
实用函数,用于在 TraitDataSink 目录中查找 TraitUpdatableDataSink。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
退货 |
指向 TraitUpdatableDataSink 的指针;如果句柄不存在或指向不可更新的 TraitDataSink,则返回 NULL。
|
日志事件
event_id_t LogEvent( const EventSchema & inSchema, nl::Weave::TLV::TLVReader & inData )
通过预序列化表单记录事件。
相应函数会记录一个表示为 nl::Weave::TLV::TLVReader 的事件。这意味着事件数据表示法已在 nl::Weave::TLV::TLVReader 底层的存储中进行了序列化。nl::Weave::TLV::TLVReader 中至少要包含一个数据元素,该元素必须是一个结构。从读取器中读取的第一个元素会被视为事件数据,并存储在事件日志中。事件数据必须包含在由 inProfileID 和 inEventType 标识的架构中进行解读的上下文标记。第一个元素的标记将被忽略;事件日志记录系统将将其替换为 eventData 标记。
如果 inImportance 超过 LoggingConfiguration 中指定的日志记录阈值,则会记录该事件。如果事件的重要性未达到当前阈值,则会被丢弃,并且该函数将返回 0
作为生成的事件 ID。
此调用变体会隐式指定所有默认事件选项:
- 该事件在调用点添加了当前时间的时间戳,
- 该事件会被标记为与拨打电话的设备相关
- 该活动是独立的,与其他任何活动无关;
- 该事件被标记为非紧急
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
退货 |
event_id_t:如果事件已写入日志,则为事件 ID;否则为 0。
|
日志事件
event_id_t LogEvent( const EventSchema & inSchema, nl::Weave::TLV::TLVReader & inData, const EventOptions *inOptions )
通过其他选项记录预序列化表单的事件。
相应函数会记录一个表示为 nl::Weave::TLV::TLVReader 的事件。这意味着事件数据表示法已在 nl::Weave::TLV::TLVReader 底层的存储中进行了序列化。nl::Weave::TLV::TLVReader 中至少要包含一个数据元素,该元素必须是一个结构。从读取器中读取的第一个元素会被视为事件数据,并存储在事件日志中。事件数据必须包含在由 inProfileID 和 inEventType 标识的架构中进行解读的上下文标记。第一个元素的标记将被忽略;事件日志记录系统将将其替换为 eventData 标记。
如果 inImportance 超过 LoggingConfiguration 中指定的日志记录阈值,则会记录该事件。如果事件的重要性未达到当前阈值,则会被丢弃,并且该函数将返回 0
作为生成的事件 ID。
此调用变体允许调用方设置 EventOptions
的任意组合:
- 时间戳,当 0 默认为调用点的当前时间时;
- “source”部分(事件来源和特征 ID);如果为 NULL,则默认使用当前设备;该事件会被标记为与发出调用的设备相关。
- 用于对事件 ID 进行分组的相关事件 ID;当相关事件 ID 为 0 时,相应事件会被标记为与任何其他事件都无关;
- 紧迫性;默认情况下不紧急。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
退货 |
event_id_t:如果事件已写入日志,则为事件 ID;否则为 0。
|
日志事件
event_id_t LogEvent( const EventSchema & inSchema, EventWriterFunct inEventWriter, void *inAppData )
通过回调记录事件。
此函数会记录一个表示为 EventWriterFunct 的事件以及应用专用的 appData
上下文。函数会写入事件元数据,并使用 nl::Weave::TLV::TLVWriter 引用和 inAppData
上下文调用 inEventWriter
,以便用户代码可以直接将事件数据发送到事件日志。这种形式的事件日志记录可最大限度地减少内存消耗,因为事件数据会直接序列化到目标缓冲区。事件数据必须包含要在由 inProfileID
和 inEventType
标识的架构中进行解读的上下文标记。第一个元素的标记将被忽略;事件日志记录系统将将其替换为 eventData 标记。
如果 inImportance 超过 LoggingConfiguration 中指定的日志记录阈值,则会记录该事件。如果事件的重要性未达到当前阈值,则会被丢弃,并且该函数将返回 0
作为生成的事件 ID。
此调用变体会隐式指定所有默认事件选项:
- 该事件在调用点添加了当前时间的时间戳,
- 该事件会被标记为与拨打电话的设备相关
- 该活动是独立的,与其他任何活动无关;
- 该事件被标记为非紧急
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
退货 |
event_id_t:如果事件已写入日志,则为事件 ID;否则为 0。
|
日志事件
event_id_t LogEvent( const EventSchema & inSchema, EventWriterFunct inEventWriter, void *inAppData, const EventOptions *inOptions )
通过回调记录事件,并提供选项。
此函数会记录一个表示为 EventWriterFunct 的事件以及应用专用的 appData
上下文。函数会写入事件元数据,并使用 nl::Weave::TLV::TLVWriter 引用和 inAppData
上下文调用 inEventWriter
,以便用户代码可以直接将事件数据发送到事件日志。这种形式的事件日志记录可最大限度地减少内存消耗,因为事件数据会直接序列化到目标缓冲区。事件数据必须包含要在由 inProfileID
和 inEventType
标识的架构中进行解读的上下文标记。第一个元素的标记将被忽略;事件日志记录系统将将其替换为 eventData 标记。
如果 inImportance 超过 LoggingConfiguration 中指定的日志记录阈值,则会记录该事件。如果事件的重要性未达到当前阈值,则会被丢弃,并且该函数将返回 0
作为生成的事件 ID。
此调用变体允许调用方设置 EventOptions
的任意组合:
- 时间戳,当 0 默认为调用点的当前时间时;
- “source”部分(事件来源和特征 ID);如果为 NULL,则默认使用当前设备;该事件会被标记为与发出调用的设备相关。
- 用于对事件 ID 进行分组的相关事件 ID;当相关事件 ID 为 0 时,相应事件会被标记为与任何其他事件都无关;
- 紧迫性;默认情况下不紧急。
详情 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||
退货 |
event_id_t:如果事件已写入日志,则为事件 ID;否则为 0。
|
自由形式
event_id_t LogFreeform( ImportanceType inImportance, const char *inFormat, ... )
LogFreeform 会向默认事件流发出一个自由格式的字符串。
该字符串将封装在调试事件结构中,其结构与其他记录的字符串完全相同。事件配置文件 ID 将为 Nest Debug 事件 ID,事件类型将为 kNestDebug_StringLogEntryEvent
。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
退货 |
event_id_t:如果事件已写入日志,则为事件 ID;否则为 0。
|
LookForElementWithTag
WEAVE_ERROR LookForElementWithTag( const nl::Weave::TLV::TLVReader & aSrcReader, const uint64_t aTagInApiForm, nl::Weave::TLV::TLVReader *apDstReader )
明文作者
WEAVE_ERROR PlainTextWriter( TLVWriter & ioWriter, uint8_t inDataTag, void *appData )
一个用于发出自由格式的文本作为调试事件的辅助函数。
调试事件是具有日志区域和自由格式文本的结构。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
明文作者
WEAVE_ERROR PlainTextWriter( ::nl::Weave::TLV::TLVWriter & ioWriter, uint8_t inDataTag, void *appData )
一个用于发出自由格式的文本作为调试事件的辅助函数。
调试事件是具有日志区域和自由格式文本的结构。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|