nl::Weave::Profiles::DataManagement_Legacy::DMPublisher

#include <src/lib/profiles/data-management/Legacy/DMPublisher.h>

The abstract base class for application-specific WDM publishers.

Summary

DMPublisher is the standard WDM publisher base class. It is a mix of the DM ProtocolEngine class, which handles the comms crank-turning, and the wholly abstract PublisherDataManager class. Support for subscription and notification are optional and may be suppressed simply by configuring a subscription table with no entries.

Inheritance

Inherits from:
  nl::Weave::Profiles::DataManagement_Legacy::ProtocolEngine
  nl::Weave::Profiles::DataManagement_Legacy::PublisherDataManager

Constructors and Destructors

DMPublisher(void)
The default constructor for DMPublisher objects.
~DMPublisher(void)
The destructor for DMPublisher objects.

Public functions

CancelTransactionRequest(uint16_t aTxnId, WEAVE_ERROR aError)
Clear(void)
virtual void
Clear the internal state of DMPublisher object.
Finalize(void)
virtual void
Shut down an operating DMPublisher.
IncompleteIndication(Binding *aBinding, StatusReport & aReport)
virtual void
Handle an indication that a binding has failed.
Init(WeaveExchangeManager *aExchangeMgr, uint32_t aResponseTimeout)
virtual WEAVE_ERROR
Initialize a DMPublisher object.
Init(WeaveExchangeManager *aExchangeMgr)
virtual WEAVE_ERROR
OnMsgReceived(ExchangeContext *aResponseCtx, uint32_t aProfileId, uint8_t aMsgType, PacketBuffer *aMsg)
void
UpdateResponse(ExchangeContext *aResponseCtx, StatusReport & aStatus)
Respond to an update request.
ViewResponse(ExchangeContext *aResponseCtx, StatusReport & aStatus, ReferencedTLVData *aDataList)
Respond to a view request.

Public functions

CancelTransactionRequest

WEAVE_ERROR CancelTransactionRequest(
  uint16_t aTxnId,
  WEAVE_ERROR aError
)

Clear

virtual void Clear(
  void
)

Clear the internal state of DMPublisher object.

Clears the notify transaction pool and the subscription table.

DMPublisher

 DMPublisher(
  void
)

The default constructor for DMPublisher objects.

Clears all internal state.

Finalize

virtual void Finalize(
  void
)

Shut down an operating DMPublisher.

Clears all the operating state and shuts down the listener if one is running.

IncompleteIndication

virtual void IncompleteIndication(
  Binding *aBinding,
  StatusReport & aReport
)

Handle an indication that a binding has failed.

When a binding becomes incomplete, i.e. when the connection is closed for a TCP binding, the protocol engine must fail any transactions that depend on it, which includes calling their status handlers. Also, the incomplete indication is passed up to any superclass object implementing the alternate form of this method that takes a peer ID.

Details
Parameters
[in] aBinding
A pointer to the failed binding.
[in] aReport
A reference to a StatusReport object detailing the reason for failure.

Init

virtual WEAVE_ERROR Init(
  WeaveExchangeManager *aExchangeMgr,
  uint32_t aResponseTimeout
)

Initialize a DMPublisher object.

This method has the side effect of installing a listener in the exchange manager for the full range of client requests possibly including those for subscription.

Details
Parameters
[in] aExchangeMgr
A pointer to the WeaveExchangeManager object to use for all exchanges in which the publisher wishes to participate.
[in] aResponseTimeout
A response timeout in milliseconds, i.e. the maximum time to wait for a response.
Returns
WEAVE_NO_ERROR On success. Otherwise, return a WEAVE_ERROR reflecting a failure to properly set up the publisher.

Init

virtual WEAVE_ERROR Init(
  WeaveExchangeManager *aExchangeMgr
)

OnMsgReceived

void OnMsgReceived(
  ExchangeContext *aResponseCtx,
  uint32_t aProfileId,
  uint8_t aMsgType,
  PacketBuffer *aMsg
)

UpdateResponse

WEAVE_ERROR UpdateResponse(
  ExchangeContext *aResponseCtx,
  StatusReport & aStatus
)

Respond to an update request.

Send the response to an update request after processing, using the exchange context that was given in the indication.

Details
Parameters
[in] aResponseCtx
A pointer to the exchange context under which the request was received.
[in] aStatus
A reference to a StatusReport object containing information about the status of the request.
Returns
WEAVE_NO_ERROR On success. Otherwise return a WEAVE_ERROR reflecting a failure to send the response message.

ViewResponse

WEAVE_ERROR ViewResponse(
  ExchangeContext *aResponseCtx,
  StatusReport & aStatus,
  ReferencedTLVData *aDataList
)

Respond to a view request.

Send the response to a view request after processing, using the exchange context that was given in the indication.

Details
Parameters
[in] aResponseCtx
A pointer to the exchange context under which the request was received.
[in] aStatus
A reference to a StatusReport object containing information about the status of the request. In the case where this is success, the requestor will be expecting a data list containing the data of interest.
[in] aDataList
A pointer to an optional ReferencedTLVData object containing a TLV-encoded data list containing the data of interest and the paths indicating the disposition of that data. Note that this parameter shall be NULL in the case where the status given in the previous parameter is not success.
Return Values
WEAVE_NO_ERROR
On success. Otherwise, return a WEAVE_ERROR reflecting a failure to send the response message.
WEAVE_ERROR_INVALID_ARGUMENT
If the given parameters are inconsistent
WEAVE_ERROR_NO_MEMORY
If an Inet buffer could not be allocated.

~DMPublisher

virtual  ~DMPublisher(
  void
)

The destructor for DMPublisher objects.

Clears all internal state and removes the listener from the exchange manager if one is in place.