nl::Weave::Profiles::BDX_Development::BDXTransfer

#include <src/lib/profiles/bulk-data-transfer/Development/BDXTransferState.h>

This structure contains data members representing an active BDX transfer.

Summary

These objects are used by the BdxProtocol to maintain protocol state. They are managed by the BdxServer, which handles creating and initializing new transfers, including managing Connections and ExchangeContexts.

Public attributes

mAmInitiator
bool
mAmSender
bool
mAppState
void *
mBlockCounter
uint32_t
The next block number we expect to receive a BlockQuery or BlockACK for when sending (once the transfer has officially started).
mBytesSent
uint64_t
mExchangeContext
mFileDesignator
file/block related data members TODO: remove this? or should we just establish a contract of what this string might look like and how it will be used? Specifically, is it backed by an PacketBuffer? If so, it probably shouldn't stick around for the whole xfer as that takes up a pbuf
mFirstQuery
bool
mHandlers
mIsAccepted
bool
mIsCompletedSuccessfully
bool
mIsInitiated
bool
mIsWideRange
bool
mLength
uint64_t
mMaxBlockSize
uint16_t
mNext)(BDXTransfer &)
mStartOffset
uint64_t
mTransferMode
uint8_t
mVersion
uint8_t

Public functions

DispatchErrorHandler(WEAVE_ERROR anErrorCode)
void
If the error handler has been set, call it.
DispatchGetBlockHandler(uint64_t *aLength, uint8_t **aDataBlock, bool *aLastBlock)
void
If the get block handler has been set, call it.
DispatchPutBlockHandler(uint64_t aLength, uint8_t *aDataBlock, bool aLastBlock)
void
If the put block handler has been set, call it.
DispatchReceiveAccept(ReceiveAccept *aReceiveAcceptMsg)
Dispatchers simply check whether a handler has been set and then call it if so.
DispatchRejectHandler(StatusReport *aReport)
void
If the reject handler has been set, call it.
DispatchSendAccept(SendAccept *aSendAcceptMsg)
If the send accept handler has been set, call it.
DispatchXferDoneHandler(void)
void
If the transfer done handler has been set, call it.
DispatchXferErrorHandler(StatusReport *aXferError)
void
If the transfer error handler has been set, call it.
GetDefaultFlags(bool aExpectResponse)
uint16_t
This function returns the default flags to be sent with a message.
IsAsync(void)
bool
 Returns true if this transfer is asynchronous, false otherwise.
IsDriver(void)
bool
 Returns true if this entity (node) is the driver for this transfer, false otherwise.
Reset(void)
void
 Sets all pointers to NULL, resets counters, etc.
SetHandlers(BDXHandlers aHandlers)
void
This function sets the handlers on this BDXTransfer object.
Shutdown(void)
void
 Shuts down the current transfer, including closing any open ExchangeContext.

Public attributes

mAmInitiator

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mAmInitiator

mAmSender

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mAmSender

mAppState

void * nl::Weave::Profiles::BDX_Development::BDXTransfer::mAppState

mBlockCounter

uint32_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mBlockCounter

The next block number we expect to receive a BlockQuery or BlockACK for when sending (once the transfer has officially started).

When receiving, it is the next BlockSend we expect to receive or the latest BlockQuery we sent (after the transfer has officially started and the first query sent that is).

mBytesSent

uint64_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mBytesSent

mExchangeContext

ExchangeContext * nl::Weave::Profiles::BDX_Development::BDXTransfer::mExchangeContext

mFileDesignator

ReferencedString nl::Weave::Profiles::BDX_Development::BDXTransfer::mFileDesignator

file/block related data members TODO: remove this? or should we just establish a contract of what this string might look like and how it will be used? Specifically, is it backed by an PacketBuffer? If so, it probably shouldn't stick around for the whole xfer as that takes up a pbuf

mFirstQuery

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mFirstQuery

mHandlers

BDXHandlers nl::Weave::Profiles::BDX_Development::BDXTransfer::mHandlers

mIsAccepted

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mIsAccepted

mIsCompletedSuccessfully

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mIsCompletedSuccessfully

mIsInitiated

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mIsInitiated

mIsWideRange

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::mIsWideRange

mLength

uint64_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mLength

mMaxBlockSize

uint16_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mMaxBlockSize

mNext

WEAVE_ERROR(* nl::Weave::Profiles::BDX_Development::BDXTransfer::mNext)(BDXTransfer &)

mStartOffset

uint64_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mStartOffset

mTransferMode

uint8_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mTransferMode

mVersion

uint8_t nl::Weave::Profiles::BDX_Development::BDXTransfer::mVersion

Public functions

DispatchErrorHandler

void nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchErrorHandler(
  WEAVE_ERROR anErrorCode
)

If the error handler has been set, call it.

If not set, also shut down the transfer as a default behavior.

Details
Parameters
[in] anErrorCode
Error code to be processed

DispatchGetBlockHandler

void nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchGetBlockHandler(
  uint64_t *aLength,
  uint8_t **aDataBlock,
  bool *aLastBlock
)

If the get block handler has been set, call it.

Details
Parameters
[in] aLength
Length of block
[in] aDataBlock
Pointer to the data block
[in] aLastBlock
True if this is the last block in the transfer

DispatchPutBlockHandler

void nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchPutBlockHandler(
  uint64_t aLength,
  uint8_t *aDataBlock,
  bool aLastBlock
)

If the put block handler has been set, call it.

Details
Parameters
[in] aLength
Length of block
[in] aDataBlock
Pointer to the data block
[in] aLastBlock
True if this is the last block in the transfer

DispatchReceiveAccept

WEAVE_ERROR nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchReceiveAccept(
  ReceiveAccept *aReceiveAcceptMsg
)

Dispatchers simply check whether a handler has been set and then call it if so.

If the receive accept handler has been set, call it.

Therefore, these should be used as the public interface for calling callbacks, which should never be touched directly by outside applications. It is possible that a future revision of BDXTransfer will use a delegate object rather than storing individual pointers to each of the callbacks.

Details
Parameters
[in] aReceiveAcceptMsg
ReceiveAccept message to be processed
Returns
an error value

DispatchRejectHandler

void nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchRejectHandler(
  StatusReport *aReport
)

If the reject handler has been set, call it.

If not set, also shut down the transfer as a default behavior.

Details
Parameters
[in] aReport
StatusReport message to be processed

DispatchSendAccept

WEAVE_ERROR nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchSendAccept(
  SendAccept *aSendAcceptMsg
)

If the send accept handler has been set, call it.

Details
Parameters
[in] aSendAcceptMsg
SendAccept message to be processed
Returns
an error value

DispatchXferDoneHandler

void nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchXferDoneHandler(
  void
)

If the transfer done handler has been set, call it.

If not set, also shut down the transfer as a default behavior.

DispatchXferErrorHandler

void nl::Weave::Profiles::BDX_Development::BDXTransfer::DispatchXferErrorHandler(
  StatusReport *aXferError
)

If the transfer error handler has been set, call it.

If not set, also shut down the transfer as a default behavior.

Details
Parameters
[in] aXferError
Status report of an error to be processed

GetDefaultFlags

uint16_t nl::Weave::Profiles::BDX_Development::BDXTransfer::GetDefaultFlags(
  bool aExpectResponse
)

This function returns the default flags to be sent with a message.

Details
Parameters
[in] aExpectResponse
If we expect a response to this message
Returns
The flags to be sent

IsAsync

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::IsAsync(
  void
)

 Returns true if this transfer is asynchronous, false otherwise.

Details
Returns
true iff the transfer is asynchronous.

IsDriver

bool nl::Weave::Profiles::BDX_Development::BDXTransfer::IsDriver(
  void
)

 Returns true if this entity (node) is the driver for this transfer, false otherwise.

Details
Returns
true iff this entity is the driver for this transfer

Reset

void nl::Weave::Profiles::BDX_Development::BDXTransfer::Reset(
  void
)

 Sets all pointers to NULL, resets counters, etc.

Called when shut down.

SetHandlers

void nl::Weave::Profiles::BDX_Development::BDXTransfer::SetHandlers(
  BDXHandlers aHandlers
)

This function sets the handlers on this BDXTransfer object.

You should always use this method rather than trying to set them manually as the underlying implementation of how the handler function pointers are stored is not a part of the public API.

Details
Parameters
[in] aHandlers
Structure of callback handlers to be called

Shutdown

void nl::Weave::Profiles::BDX_Development::BDXTransfer::Shutdown(
  void
)

 Shuts down the current transfer, including closing any open ExchangeContext.

Use this opportunity to free any resources associated with this transfer and your application logic.