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

自上次成功与原子时间同步以来的时间(以分钟为单位)。

kTimeFromLastSyncWithServer_Invalid 表示这种情况很久以前就没有意义了(如果有的话)

公共属性

mIsTimeCoordinator

bool mIsTimeCoordinator

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

mNumContributorInLastLocalSync

uint8_t mNumContributorInLastLocalSync

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

mTimeOfRequest

timesync_t mTimeOfRequest

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

mTimeOfResponse

timesync_t mTimeOfResponse

准备响应时的系统时间(自 1970/1/1 0:00:00 以来的微秒数)

mTimeSinceLastSyncWithServer_min

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

 TimeSyncResponse(
  void
)

默认构造函数应与解码一起使用,因为所有成员都将通过解码来初始化

公共静态函数

Decode

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

从 PacketBuffer 解码时间同步响应。

具体说明
参数
[out] aObject
指向已解码对象的指针
[in] aMsg
指向 PacketBuffer 的指针
返回值
成功时返回 WEAVE_NO_ERROR