nl::Weave::Profiles::Time::TimeSyncResponse

摘要

构造函数和构造函数

TimeSyncResponse(void)
默认构造函数应与解码结合使用,因为所有成员都将通过解码进行初始化

公共类型

@322 枚举
上次成功在本地结构上同步时间的最大操作数
@323 枚举
自上次成功时间与原子时间的某个代理同步以来的分钟数。

公共属性

mIsTimeCoordinator
bool
如果此响应由协调者构建,则为 true;false 表示此响应由服务器构建。
mNumContributorInLastLocalSync
uint8_t
上次成功同步时使用的本地贡献者(协调员或服务器)数量
mTimeOfRequest
timesync_t
请求到达时的系统时间(自 1970/1/1 0:00:00 开始的微秒数)
mTimeOfResponse
timesync_t
系统时间(自响应时间起,自 1970/1/1 0:00:00 开始的微秒数)
mTimeSinceLastSyncWithServer_min
uint16_t
自上次成功与某些原子时间代理同步后的时间(以分钟为单位)

公共函数

Encode(PacketBuffer *const aMsg)
将时间同步响应编码到 PacketBuffer 中。
Init(const TimeSyncRole aRole, const timesync_t aTimeOfRequest, const timesync_t aTimeOfResponse, const uint8_t aNumContributorInLastLocalSync, const uint16_t aTimeSinceLastSyncWithServer_min)
void
初始化此对象以进行编码。

公共静态函数

Decode(TimeSyncResponse *const aObject, PacketBuffer *const aMsg)
对来自 PacketBuffer 的时间同步响应进行解码。

公共类型

@322

 @322

上次成功在本地结构上同步时间的最大操作数

@323

 @323

自上次成功时间与原子时间的某个代理同步以来的分钟数。

kTimeSinceLastSyncWithServer_Invalid 表示时间过长,导致无法实现

公共属性

mIsTimeCoordinator

bool mIsTimeCoordinator

如果此响应由协调者构建,则为 true;false 表示此响应由服务器构建。

上次同步时间

uint8_t mNumContributorInLastLocalSync

上次成功同步时使用的本地贡献者(协调员或服务器)数量

请求时间

timesync_t mTimeOfRequest

请求到达时的系统时间(自 1970/1/1 0:00:00 开始的微秒数)

响应时间

timesync_t mTimeOfResponse

系统时间(自响应时间起,自 1970/1/1 0:00:00 开始的微秒数)

上次同步时间与服务器时间最低时间

uint16_t mTimeSinceLastSyncWithServer_min

自上次成功与某些原子时间代理同步后的时间(以分钟为单位)

公共函数

编码

WEAVE_ERROR Encode(
  PacketBuffer *const aMsg
)

将时间同步响应编码到 PacketBuffer 中。

详细信息
参数
[out] aMsg
指向 PacketBuffer 的指针
返回值
成功 WEAVE_NO_ERROR

Init

void Init(
  const TimeSyncRole aRole,
  const timesync_t aTimeOfRequest,
  const timesync_t aTimeOfResponse,
  const uint8_t aNumContributorInLastLocalSync,
  const uint16_t aTimeSinceLastSyncWithServer_min
)

初始化此对象以进行编码。

详细信息
参数
[in] aRole
此响应者所扮演的角色:kTimeSyncRole_Server 或 kTimeSyncRole_Coordinator
[in] aTimeOfRequest
收到原始请求的系统时间
[in] aTimeOfResponse
发送此响应的系统时间
[in] aNumContributorInLastLocalSync
上次本地时间同步贡献的节点数
[in] aTimeSinceLastSyncWithServer_min
自上次与服务器同步后经过的分钟数

时间同步响应

 TimeSyncResponse(
  void
)

默认构造函数应与解码结合使用,因为所有成员都将通过解码进行初始化

公共静态函数

解码

WEAVE_ERROR Decode(
  TimeSyncResponse *const aObject,
  PacketBuffer *const aMsg
)

对来自 PacketBuffer 的时间同步响应进行解码。

详细信息
参数
[out] aObject
指向解码对象的指针
[in] aMsg
指向 PacketBuffer 的指针
返回值
成功 WEAVE_NO_ERROR