nl:: Weave:: Profiles:: 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
|
可选数组,有选择性地将所选配置文件映射到更高的日志记录级别。 数组中的每个元素都采用一种形式 (profile,path,loggingimportance),以便选择性地从系统的某个子集中提升日志记录水平。只有当记录优先级超过 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
|
生成事件的设备的 NodeID。 |
kTag_EventSystemTimestamp
|
可选。事件的系统时间戳(以毫秒为单位)。 |
kTag_EventTraitInstanceID
|
(可选)生成事件的特征的实例。 |
kTag_EventTraitProfileID
|
必填。32 位无符号整数,等于特征的 ProfileID。 |
kTag_EventType
|
必填。16 位无符号整数,等于此类事件的 wdl.event.id。 |
kTag_EventUTCTimestamp
|
可选。事件的世界协调时间 (UTC) 时间戳(以毫秒为单位)。 |
kTag_ExternalEventStructure
|
用于外部事件的内部代码。切勿通过网络传输,且不得在 Weave 库之外使用。 |
kTag_RelatedEventID
|
可选。 与此事件相关的事件的 ID。如果省略,该值等于 kTag_EventID 的值。 |
kTag_RelatedEventImportance
|
可选。 相关事件的重要性。如果省略,值就等于 kTag_EventImportance 的值。 |
@98
@98
调试 trait 的配置文件定义。
99 版
@99
Nest 调试特征的事件类型。
属性 | |
---|---|
kNestDebug_StringLogEntryEvent
|
自由格式字符串调试消息的事件。 |
kNestDebug_TokenizedHeaderEntryEvent
|
用于传递令牌化标头信息的事件。 |
kNestDebug_TokenizedLogEntryEvent
|
令牌化调试消息的事件。 |
CommandFlags
CommandFlags
属性 | |
---|---|
kCommandFlag_ActionTimeValid
|
在操作时间有效时设置。 |
kCommandFlag_ExpiryTimeValid
|
在过期时间有效时设置。 |
kCommandFlag_InitiationTimeValid
|
在初始化时间有效时设置。 |
kCommandFlag_IsOneWay
|
当命令为单向指令时进行设置。 |
kCommandFlag_MustBeVersionValid
|
在版本字段有效时设置。 |
ImportanceType
ImportanceType
日志条目的重要性。
利用重要性,您可以在事件实际发送到日志之前对其进行过滤。事件记录到日志后,我们不会再做出任何规定来将其从日志中清除。重要性级别用于确定事件存储的优先级。如果将高重要性事件添加到完整缓冲区中,系统会根据重要性顺序(和存在时间)丢弃这些事件。因此,重要性级别只有相对值。如果系统仅使用一个重要性级别,则仅按存在时间顺序(例如环形缓冲区)丢弃事件。
属性 | |
---|---|
Debug
|
调试重要性表示系统开发者感兴趣的日志条目,主要用于开发阶段。 调试重要性日志不计入受限设备的带宽或功率预算;因此,它们只能在有限的时间段内用于生产系统。 |
Info
|
信息重要性表示为运行中的系统提供额外数据分析和诊断的日志条目。 信息日志记录级别可以在生产系统中长期使用,也可以用作现场试验中的默认日志级别。在受限设备上,使用信息级别记录的条目必须计入带宽和内存预算,而不是功率预算中。 |
Production
|
“生产重要性”是指在持续监控和维护 Nest 生态系统中使用的日志条目。 在受限设备上,以“生产”重要性记录的条目必须计入功耗和内存预算,因为系统应始终记录这些条目并从设备分流。 |
ProductionCritical
|
生产“关键”重要性表示哪些事件的损失会直接影响面向客户的功能。 应用可以使用关键生产事件丢失来指示系统故障。在受限设备上,必须将“生产关键”重要性记录的条目计入功耗和内存预算,因为它们应该始终从设备上记录和分流。 |
LoggingManagementStates
LoggingManagementStates
属性 | |
---|---|
kLoggingManagementState_Holdoff
|
日志分流已完成;在暂缓期结束之前,我们不会重新开始记录日志。 |
kLoggingManagementState_Idle
|
没有正在进行的日志分流,日志分流可以在没有任何限制的情况下开始。 |
kLoggingManagementState_InProgress
|
正在分流日志。 |
kLoggingManagementState_Shutdown
|
无法执行任何日志记录操作。 |
类型定义符
CommandFlags
enum nl::Weave::Profiles::DataManagement_Current::CommandFlags CommandFlags
DataVersion
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)
用于提取事件数据的平台回调的函数原型。
与 FetchEventsOnce 类似,此提取函数会通过 ExternalEvents.mLastEventID 返回来自 EventLoadOutContext.mStartingEventID 的所有事件。
上下文指针的类型为 FetchExternalEventsContext。这包括 EventLoadOutContext 以及一些用于 TLV 格式的辅助变量。它还包含指向注册回调函数时创建的 ExternalEvents 结构体的指针。此参数用于指定回调的事件 ID 范围。
从函数返回时,EventLoadOutContext.mCurrentEventID 应反映尚未成功写入 TLV 缓冲区的第一个事件 ID。平台必须以 EventLogging 协议指定的正确格式将事件标头和数据写入 TLV 写入器。平台还必须保持事件和时间戳的唯一性。
所有 TLV 错误都应传播到更高级别。例如,如果缓冲区空间不足,将会触发已发送的消息,随后会使用剩余的事件 ID 再次调用回调函数。
具体说明 | |||||||||
---|---|---|---|---|---|---|---|---|---|
返回值 |
|
GenericTraitSinkCatalog
GenericTraitCatalogImpl< TraitDataSink > GenericTraitSinkCatalog
GenericTraitSourceCatalog
GenericTraitCatalogImpl< TraitDataSource > GenericTraitSourceCatalog
ImportanceType
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)
从缓冲区中逐出外部事件时调用的回调的函数原型。
当外部事件对象从出站消息缓冲区中逐出时,引擎会向外部事件提供程序提供通知。该回调包含要逐出的外部事件。
具体说明 | |||
---|---|---|---|
参数 |
|
PropertyDictionaryKey
uint16_t PropertyDictionaryKey
PropertyPathHandle
uint32_t PropertyPathHandle
PropertyPathHandle 是 WDM 路径相对于特征实例根的唯一 32 位数字哈希。
它包含两个部分:
- 映射到架构静态部分的较低 16 位数字。
- 如果低 16 位表示字典元素内的路径,则会显示高 16 位的数字,表示与该元素关联的字典键。如果低位 16 位引用非字典元素,则高位 16 位应为 0。
一些特征:
- 每个特征都有自己的属性路径句柄空间。
- 每个唯一的 WDM 子路径路径都将具有一个同样唯一的 PropertyPathHandle。
- PropertyPathHandle 由来自 IDL 的 trait 编译器自动生成(目前手动完成),并在相应 trait 的头文件中表示为枚举列表。
- 使用这种结构时,应用逻辑不必直接处理 WDM 路径。而是完全通过这些标识名与 WDM 进行交互。
- 路径句柄有两个具有特定含义的预留值:
- 0 表示“NULL”句柄
- 1 表示指向特征实例根的句柄。
PropertySchemaHandle
uint16_t PropertySchemaHandle
SchemaVersion
uint16_t SchemaVersion
SingleResourceSinkTraitCatalog
SingleResourceTraitCatalog< TraitDataSink > SingleResourceSinkTraitCatalog
SingleResourceSourceTraitCatalog
SingleResourceTraitCatalog< TraitDataSource > SingleResourceSourceTraitCatalog
TimestampType
enum nl::Weave::Profiles::DataManagement_Current::TimestampType TimestampType
EventOptions 中包含的时间戳的有效性和类型。
TraitDataHandle
uint16_t TraitDataHandle
duration_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) 时间戳的类型(以毫秒为单位)。
变量
sInstance
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 )
BdxRejectHandler
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。
|
LogEvent
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。
|
LogEvent
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,则默认为调用点的当前时间;
- 事件来源的“root”部分(事件来源和特征 ID);如果为 NULL,则默认为当前设备。该事件会被标记为与正在调用的设备相关。
- 用于对事件 ID 进行分组的相关事件 ID;如果相关事件 ID 为 0,则该事件将被标记为与任何其他事件无关
- 紧急;默认为非紧急。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
event_id_t:如果事件写入日志,则为事件 ID,否则为 0。
|
LogEvent
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。
|
LogEvent
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,则默认为调用点的当前时间;
- 事件来源的“root”部分(事件来源和特征 ID);如果为 NULL,则默认为当前设备。该事件会被标记为与正在调用的设备相关。
- 用于对事件 ID 进行分组的相关事件 ID;如果相关事件 ID 为 0,则该事件将被标记为与任何其他事件无关
- 紧急;默认为非紧急。
具体说明 | |||||||||
---|---|---|---|---|---|---|---|---|---|
参数 |
|
||||||||
返回值 |
event_id_t:如果事件写入日志,则为事件 ID,否则为 0。
|
LogFreeform
event_id_t LogFreeform( ImportanceType inImportance, const char *inFormat, ... )
LogFreeform 会向默认事件流发出自由格式的字符串。
该字符串将封装在调试事件结构中,其结构与所记录的其他字符串结构相同。事件配置文件 ID 将是 Nest 调试事件对应的 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 )
PlainTextWriter
WEAVE_ERROR PlainTextWriter( TLVWriter & ioWriter, uint8_t inDataTag, void *appData )
一个辅助函数,用于将自由格式文本作为调试事件发送。
调试事件是一个包含日志区域和自由格式文本的结构。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|
PlainTextWriter
WEAVE_ERROR PlainTextWriter( ::nl::Weave::TLV::TLVWriter & ioWriter, uint8_t inDataTag, void *appData )
一个辅助函数,用于将自由格式文本作为调试事件发送。
调试事件是一个包含日志区域和自由格式文本的结构。
具体说明 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
||||||
返回值 |
|