nl::Weave::Profiles::DataManagement_Current::Command

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

Summary

Note:This class is designed to hide a certain detail in command handling. Decision has been made to hide the details of ExchangeContext and authenticator validation, while leaving the handling of PacketBuffers to the application layer. The utility of this wrapper around command handling is indeed limited, mainly due to the complexity/flexibility involved in security validation and data serialization/de-serialization.

The details for command validation is still TBD

To adjust the retransmission timing for the In-Progress, Status Report, and also Response message, the application layer would have to somehow deal with the ExchangeContext object. The best practise is still TBD, but the application layer has these three choices:

1) Acquire the Exchange Context through GetExchangeContext and directly evaluate/adjust it. 2) Pre-allocate and configure a Binding during boot up, before any command arrives, and configure it properly 3) Create a temporary Binding using this function BindingPool::NewResponderBindingFromExchangeContext

In both (2) and (3), the application layer can enforce security/timing setting through Binding::ConfigureExistingExchangeContext. The Binding is never used to generate new exchange contexts for custom commands, so it doesn't have to be stored within this handle.

The request packet buffer is also not stored within this handle, for there is no obvious use of it. This is especially true if the application layer can handle this command and send out response directly.

Application layer would receive the packet buffer from the same callback it receives this command handle. If it decides to handle this command in an async manner, it would have to store both the command handle and the packet buffer.

Public types

CommandFlags{
  kCommandFlag_MustBeVersionValid = 0x0001,
  kCommandFlag_InitiationTimeValid = 0x0002,
  kCommandFlag_ActionTimeValid = 0x0004,
  kCommandFlag_ExpiryTimeValid = 0x0008,
  kCommandFlag_IsOneWay = 0x0010
}
enum
The Command flag bits.
CommandFlags typedef
The Command flag bits.

Public attributes

actionTimeMicroSecond
int64_t
commandType
uint64_t
expiryTimeMicroSecond
int64_t
initiationTimeMicroSecond
int64_t
mustBeVersion
uint64_t

Public functions

Close(void)
void
GetExchangeContext(void) const
Retrieve the exchange context object used by this incoming command.
IsActionTimeValid(void) const
bool
IsExpiryTimeValid(void) const
bool
IsInitiationTimeValid(void) const
bool
IsMustBeVersionValid(void) const
bool
IsOneWay(void) const
bool
SendError(uint32_t aProfileId, uint16_t aStatusCode, WEAVE_ERROR aWeaveError)
SendInProgress(void)
SendResponse(uint32_t traitInstanceVersion, nl::Weave::System::PacketBuffer *apPayload)
ValidateAuthenticator(nl::Weave::System::PacketBuffer *aRequestBuffer)

Public types

CommandFlags

 CommandFlags

The Command flag bits.

Properties
kCommandFlag_ActionTimeValid

Set when the action time is valid.

kCommandFlag_ExpiryTimeValid

Set when the expiry time is valid.

kCommandFlag_InitiationTimeValid

Set when the init time is valid.

kCommandFlag_IsOneWay

Set when the command is one-way.

kCommandFlag_MustBeVersionValid

Set when the version field is valid.

CommandFlags

enum nl::Weave::Profiles::DataManagement_Current::Command::CommandFlags CommandFlags

The Command flag bits.

Public attributes

actionTimeMicroSecond

int64_t actionTimeMicroSecond

commandType

uint64_t commandType

expiryTimeMicroSecond

int64_t expiryTimeMicroSecond

initiationTimeMicroSecond

int64_t initiationTimeMicroSecond

mustBeVersion

uint64_t mustBeVersion

Public functions

Close

void Close(
  void
)

GetExchangeContext

nl::Weave::ExchangeContext * GetExchangeContext(
  void
) const 

Retrieve the exchange context object used by this incoming command.

Details
Returns
A pointer to the exchange context object used by this incoming command

IsActionTimeValid

bool IsActionTimeValid(
  void
) const 

IsExpiryTimeValid

bool IsExpiryTimeValid(
  void
) const 

IsInitiationTimeValid

bool IsInitiationTimeValid(
  void
) const 

IsMustBeVersionValid

bool IsMustBeVersionValid(
  void
) const 

IsOneWay

bool IsOneWay(
  void
) const 

SendError

WEAVE_ERROR SendError(
  uint32_t aProfileId,
  uint16_t aStatusCode,
  WEAVE_ERROR aWeaveError
)

SendInProgress

WEAVE_ERROR SendInProgress(
  void
)

SendResponse

WEAVE_ERROR SendResponse(
  uint32_t traitInstanceVersion,
  nl::Weave::System::PacketBuffer *apPayload
)

ValidateAuthenticator

WEAVE_ERROR ValidateAuthenticator(
  nl::Weave::System::PacketBuffer *aRequestBuffer
)