nl::Weave::Profiles::MessageIterator

#include <src/lib/profiles/common/WeaveMessage.h>

为了合理使用消息缓冲区,我们定义了此迭代器,它可用于跟踪边界等。

摘要

继承

继承自: nl::Weave::Profiles::RetainedPacketBuffer

构造函数和析构函数

MessageIterator(System::PacketBuffer *)
构造函数方法。

公共属性

thePoint
uint8_t *

公共函数

append(void)
void
将点设置为在缓冲区当前的所有数据之后。
finishWriting(void)
void
写入后调整缓冲区。
hasData(uint16_t)
bool
hasRoom(uint16_t)
bool
operator!=(const MessageIterator &)
bool
operator*(void)
uint8_t &
operator+(uint16_t)
operator++(void)
如果还有空间,则将消息迭代器增加 1。
operator-(uint16_t)
operator==(const MessageIterator &)
bool
read16(uint16_t *)
read32(uint32_t *)
read64(uint64_t *)
readByte(uint8_t *)
readBytes(uint16_t, uint8_t *)
readString(uint16_t, char *)
write16(uint16_t)
write32(uint32_t)
write64(uint64_t)
writeByte(uint8_t)
writeBytes(uint16_t, uint8_t *)
writeString(uint16_t, char *)

公共属性

thePoint

uint8_t * thePoint

公共函数

MessageIterator

 MessageIterator(
  System::PacketBuffer *
)

构造函数方法。

具体说明
参数
aBuffer
要迭代的消息缓冲区。

append

void append(
  void
)

将点设置为在缓冲区当前的所有数据之后。

finishWriting

void finishWriting(
  void
)

写入后调整缓冲区。

hasData

bool hasData(
  uint16_t
)

具体说明
参数
inc
可从缓冲区读取的整数量。
返回值
true
缓冲区的当前数据长度大于或等于给定增量。
false
否则。

hasRoom

bool hasRoom(
  uint16_t
)

具体说明
参数
inc
可写入缓冲区的整数量。
返回值
true
缓冲区的当前数据长度与其允许的最大数据长度(其可用数据长度)之间的差值小于或等于指定的增量。
false
否则。

运算符!=

bool operator!=(
  const MessageIterator &
)

具体说明
参数
aMessageIterator
要与之比较的另一个消息迭代器。

运算符*

uint8_t & operator*(
  void
)

具体说明
返回值
我们在缓冲区中看到的内容。

运算符+

MessageIterator & operator+(
  uint16_t
)

具体说明
参数
inc
要应用于消息迭代器的增量。
返回值
如果有空间,则迭代器按指定值递增;如果没有空间,则迭代器直接紧靠末端。

运算符++

MessageIterator & operator++(
  void
)

如果还有空间,则将消息迭代器增加 1。

operator-

MessageIterator & operator-(
  uint16_t
)

具体说明
参数
dec
要应用于消息迭代器的递减。
返回值
如果有空间,则迭代器按给定值递减;如果没有空间,则迭代器直接与开头部分对齐。

运算符==

bool operator==(
  const MessageIterator &
)

具体说明
参数
aMessageIterator
要与之比较的另一个消息迭代器。

read16

WEAVE_ERROR read16(
  uint16_t *
)

具体说明
参数
aDestination
用于从缓冲区读取短暂读取的位置。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

read32

WEAVE_ERROR read32(
  uint32_t *
)

具体说明
参数
aDestination
用于放置从缓冲区读取的 32 位值的位置。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

read64

WEAVE_ERROR read64(
  uint64_t *
)

具体说明
参数
aDestination
用于放置从缓冲区读取的 64 位值的位置。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

readByte

WEAVE_ERROR readByte(
  uint8_t *
)

具体说明
参数
aDestination
用于从缓冲区读取字节的位置。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

readBytes

WEAVE_ERROR readBytes(
  uint16_t,
  uint8_t *
)

具体说明
参数
aLength
要读取的字节字符串的长度。
aByteString
放置字节的位置。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

readString

WEAVE_ERROR readString(
  uint16_t,
  char *
)

具体说明
参数
aLength
要读取的字符串的长度。
aString
字符串的放置位置。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

write16

WEAVE_ERROR write16(
  uint16_t
)

具体说明
参数
aValue
要写出的短值。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

write32

WEAVE_ERROR write32(
  uint32_t
)

具体说明
参数
aValue
要写出的 32 位值。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

write64

WEAVE_ERROR write64(
  uint64_t
)

具体说明
参数
aValue
要写出的 64 位值。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

writeByte

WEAVE_ERROR writeByte(
  uint8_t
)

具体说明
参数
aValue
要写出的字节值。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

writeBytes

WEAVE_ERROR writeBytes(
  uint16_t,
  uint8_t *
)

具体说明
参数
aLength
要写入的字节字符串的长度。
aString
字节字符串本身。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。

writeString

WEAVE_ERROR writeString(
  uint16_t,
  char *
)

具体说明
参数
aLength
要写入的字符串的长度。
aString
字符串本身。
返回值
WEAVE_NO_ERROR
没问题。
WEAVE_ERROR_BUFFER_TOO_SMALL
我们是否在超出缓冲区末端时运行。