IncomingTransfer implements ITransferBuffer, which is necessary for message codec

This commit is contained in:
Pavel Kirienko
2014-03-09 00:47:01 +04:00
parent 31e47daf84
commit baed1d17c5
2 changed files with 12 additions and 8 deletions
@@ -19,7 +19,7 @@ namespace uavcan
/** /**
* Container for received transfer. * Container for received transfer.
*/ */
class IncomingTransfer class IncomingTransfer : public ITransferBuffer
{ {
uint64_t ts_monotonic_; uint64_t ts_monotonic_;
uint64_t ts_utc_; uint64_t ts_utc_;
@@ -27,6 +27,9 @@ class IncomingTransfer
TransferID transfer_id_; TransferID transfer_id_;
NodeID src_node_id_; NodeID src_node_id_;
/// That's a no-op, asserts in debug builds
int write(unsigned int offset, const uint8_t* data, unsigned int len);
protected: protected:
IncomingTransfer(uint64_t ts_monotonic, uint64_t ts_utc, TransferType transfer_type, IncomingTransfer(uint64_t ts_monotonic, uint64_t ts_utc, TransferType transfer_type,
TransferID transfer_id, NodeID source_node_id) TransferID transfer_id, NodeID source_node_id)
@@ -38,13 +41,6 @@ protected:
{ } { }
public: public:
virtual ~IncomingTransfer() { }
/**
* Read pure payload, no service fields are included (e.g. Target Node ID, Transfer CRC)
*/
virtual int read(unsigned int offset, uint8_t* data, unsigned int len) const = 0;
/** /**
* Dispose the payload buffer. Further calls to read() will not be possible. * Dispose the payload buffer. Further calls to read() will not be possible.
*/ */
@@ -9,6 +9,14 @@
namespace uavcan namespace uavcan
{ {
/*
* IncomingTransfer
*/
int IncomingTransfer::write(unsigned int, const uint8_t*, unsigned int)
{
assert(0); // Incoming transfer container is read-only
return -1;
}
/* /*
* SingleFrameIncomingTransfer * SingleFrameIncomingTransfer