Robin Mueller
45054cc863
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
37 lines
1.0 KiB
C++
37 lines
1.0 KiB
C++
#include "VirtualChannel.h"
|
|
|
|
VirtualChannel::VirtualChannel(object_id_t objectId, uint8_t vcId, const char* vcName, PtmeIF& ptme,
|
|
const std::atomic_bool& linkStateProvider)
|
|
: SystemObject(objectId),
|
|
ptme(ptme),
|
|
vcId(vcId),
|
|
vcName(vcName),
|
|
linkStateProvider(linkStateProvider) {}
|
|
|
|
ReturnValue_t VirtualChannel::initialize() { return returnvalue::OK; }
|
|
|
|
ReturnValue_t VirtualChannel::sendNextTm(const uint8_t* data, size_t size) {
|
|
return write(data, size);
|
|
}
|
|
|
|
ReturnValue_t VirtualChannel::write(const uint8_t* data, size_t size) {
|
|
if (linkStateProvider.load()) {
|
|
return ptme.writeToVc(vcId, data, size);
|
|
}
|
|
return returnvalue::OK;
|
|
}
|
|
|
|
uint8_t VirtualChannel::getVcid() const { return vcId; }
|
|
|
|
const char* VirtualChannel::getName() const { return vcName.c_str(); }
|
|
|
|
bool VirtualChannel::isBusy() const {
|
|
// Data is discarded, so channel is not busy.
|
|
if (linkStateProvider.load()) {
|
|
return false;
|
|
}
|
|
return ptme.isBusy(vcId);
|
|
}
|
|
|
|
void VirtualChannel::cancelTransfer() { ptme.cancelTransfer(vcId); }
|