Google is committed to advancing racial equity for Black communities. See how.

nl::Weave::Profiles::DataManagement_Current::UpdateEncoder

#include <src/lib/profiles/data-management/Current/UpdateEncoder.h>

This object encodes WDM UpdateRequest and PartialUpdateRequest payloads.

Summary

Note that both requests have the same format; they are differentiated only by the message type, which is outside the scope of this object.

The encoding is done synchronously by the EncodeRequest method. The only other public method is InsertInProgressUpdateItem, which is called by the SchemaEngine when it needs to push a dictionary back to the queue.

Constructors and Destructors

UpdateEncoder()
~UpdateEncoder()

Public functions

EncodeRequest(Context & aContext)
Encode a WDM Update request payload.
InsertInProgressUpdateItem(const TraitPath & aItem)
Add a private path in the list of paths in progress, inserting it after the one being encoded at the moment.

Structs

nl::Weave::Profiles::DataManagement_Current::UpdateEncoder::Context

This structure holds the I/O arguments to the EncodeRequest method.

Public functions

EncodeRequest

WEAVE_ERROR EncodeRequest(
  Context & aContext
)

Encode a WDM Update request payload.

See UpdateEncoder::Context. The PacketBuffer's data length is updated only in case of success, but the buffer contents are not preserved.

Details
Return Values
WEAVE_NO_ERROR
At least one DataElement was encoded in the payload's DataList.
WEAVE_ERROR_BUFFER_TOO_SMALL
The first DataElement could not fit in the payload.
WEAVE_ERROR_INVALID_ARGUMENT
aContext was initialized with invalid values.
other
Other errors from lower level objects (TLVWriter, SchemaEngine, etc).

InsertInProgressUpdateItem

WEAVE_ERROR InsertInProgressUpdateItem(
  const TraitPath & aItem
)

Add a private path in the list of paths in progress, inserting it after the one being encoded at the moment.

This method is meant to be called by the SchemaEngine as it traverses the schema tree and it needs to push dictionaries back to the list.

Details
Parameters
[in] aItem
The TraitPath to insert in the list being encoded.
Return Values
WEAVE_NO_ERROR
The item was inserted successfully.
WEAVE_NO_MEMORY
There was no space in the TraitPathStore to insert the item.

UpdateEncoder

 UpdateEncoder()

~UpdateEncoder

 ~UpdateEncoder()