Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


BulkDataNTSenderStream(const char *name, 
                        const SenderStreamConfiguration &)


A method to create a new sender flow (BulkDataNTSenderFlow) on the sender stream. As first parameter it takes (receiver) flow name. Optional is possible to provide also sender flow configuration (SenderFlowConfiguration), a sender flow status callback (BulkDataNTSenderFlowStatusCallback), and a flag if the callback should be deleted with the flow.the callback should be deleted with the flow.

BulkDataNTSenderFlow* createFlow(const char *flowName, 
                                const SenderFlowConfiguration &cfg, 
                                BulkDataNTSenderFlowStatusCallback *cb,
                                 BulkDataNTSenderFlow* createFlow(const char *flowName, const SenderFlowConfiguration &cfg, BulkDataNTSenderFlowStatusCallback *cb,bool releaseCB)

An already created sender flow can be retrieved from the sender stream using flow name with the following method:

...


A sender flow is represented with class BulkDataNTSenderFlow. A new sender flow object can be created by invoking createFlow method on a sender stream object (BulkDataNTSenderStream). The class provides three methods to send data according to the bulk data protocol:
At the beginning of the transmition we send to the receiver(s) so called "parameter" by invoking method:

void startSend(const unsigned char *param, size_t len) 

In case of a problem (timeout, or wrong order) an exception of type: StartSendErrorExImpl is thrown, which contains an error trace with the details (timeout, wrong order,..) of the error.
Data we sent to the receivers(s) by calling method:

void sendData(const unsigned char *buffer, size_t len) 

one or several times. In case of a problem (timeout, wrong order – invoking sendData before startSend) an exception of type: SendDataErrorExImpl is thrown, which contains a detailed error trace.
We finish the transmition by invoking method:

void stopSend() 

We can get the number of so far connected receiver on the particular flow by invoking: unsigned int getNumberOfReceivers()
The name of the flow can be retrieved with:

 std::string getName()


The sender flow object(s) is/are destroyed when the containing sender stream object is destroyed, but it can be also destroyed explicitly by invoking C++ delete.


Anchor
_Toc362618015
_Toc362618015
Sender flow status callback – class BulkDataNTSenderFlowStatusCallback


We can get asynchronously (via callback) informed about different status changes in the sender flow, by providing an optional, so called sender flow status callback object, when we create a sender flow object. In this way we can get informed about an error, and new connection/disconnection of a receiver. A user has to create a new class that derives from BulkDataNTSenderFlowStatusCallback) and implement one, or all of the following methods:
virtual void onError(ACSErr::CompletionImpl &error)

to get notification about an error container in an error completion.

virtual void onReceiverConnect(unsigned short totalRcvs)

to get notification about a newly connected receiver, with the total number of connected receivers.

virtual void onReceiverDisconnect(unsigned short totalRcvs)

to get notification that a receiver has disconnected, with the number of the receivers that remains connected.
The information (the name) about the stream/flow that invokes the callback can be retrieved with methods:
const char* getFlowName()
const char* getStreamName()

...

BulkDataNTReceiverStream(const char *receiverName, const char *streamName, const ReceiverStreamConfiguration &c)
The same way as for sender case we can create a new receiver flow by invoking createFlow method which takes as the first parameter receiver flow name. In addition can be optionally passed: a receiver flow configuration (ReceiverFlowConfiguration), a receiver callback, and a flag if the receiver callback has to be deleted together with the flow.

BulkDataNTReceiverFlow * createFlow(const char *flowName, const ReceiverFlowConfiguration &cfg, BulkDataNTCallback *cb, bool releaseCB)
If the (receiver) callback object is given it is used for the callbacks when data arrive, if the callback is not specified, or it is 0, an object from the template parameter is created. In this way is given a flexibility to create a callback object before with arbitrary constructor.
An already created receiver flow can be retrieved from the receiver stream using flow name with the following method:

BulkDataNTReceiverFlow * getFlow(const char *flowName)

...