RegisterReadRequest.cpp
Go to the documentation of this file.
1 #include "RegisterReadRequest.h"
2 
3 #include <sstream>
4 
8 
10 {
11 
12  RegisterReadRequest::RegisterReadRequest(std::vector<RegisterDataList>* requestedRegisters) :
13  requestedRegisters(requestedRegisters)
14  {
17  this->amountFramesToRead = static_cast<std::uint16_t>(frames->list.size());
18  }
19 
21  std::uint16_t amountFramesToRead)
22  {
23  if (preallocatedFrames)
24  {
25  frames = preallocatedFrames;
26  if (amountFramesToRead > 0)
27  {
28  this->amountFramesToRead = amountFramesToRead;
29  }
30  else
31  {
32  this->amountFramesToRead = static_cast<std::uint16_t>(frames->list.size());
33  }
34  }
35  }
36 
37 
38  std::pair<EtherCATFrameList*, std::uint16_t>
40  {
41  if (frames)
42  {
43  return {frames, amountFramesToRead};
44  }
45  else
46  {
47  throw std::logic_error("RegisterReadRequest: No EtherCATFrameList available");
48  }
49  }
50 
51  void
53  {
55  {
57  frames, requestedRegisters);
58  }
59  }
60 } // namespace armarx::control::ethercat
armarx::control::ethercat::RegisterReadRequest::requestedRegisters
std::vector< RegisterDataList > * requestedRegisters
Definition: RegisterReadRequest.h:28
EtherCATFrame.h
armarx::control::ethercat::RegisterReadRequest::updateRequestedRegisters
void updateRequestedRegisters()
Definition: RegisterReadRequest.cpp:52
armarx::control::ethercat::SlaveRegisterReadingScheduler::updateRegisterDataFromEtherCATFrameList
static void updateRegisterDataFromEtherCATFrameList(const EtherCATFrameList *frameList, std::vector< RegisterDataList > *requestedRegisters)
Definition: SlaveRegisterReadingScheduler.cpp:38
armarx::control::ethercat::EtherCATFrameList::list
std::vector< std::pair< EtherCATFrame, EtherCATFrameMetaData > > list
Definition: EtherCATFrame.h:127
armarx::control::ethercat::RegisterReadRequest::RegisterReadRequest
RegisterReadRequest()=default
RegisterReadRequest.h
armarx::control::ethercat::EtherCATFrameList
The EtherCATFrameList struct holds a list of EtherCAT frames that can be scheduled in round-robin-sty...
Definition: EtherCATFrame.h:124
armarx::control::ethercat
Definition: Bus.cpp:24
armarx::control::ethercat::SlaveRegisterReadingScheduler::createEtherCATFrameListFromRegisterDataList
static EtherCATFrameList * createEtherCATFrameListFromRegisterDataList(const std::vector< RegisterDataList > *requestedRegisters)
Definition: SlaveRegisterReadingScheduler.cpp:20
armarx::control::ethercat::RegisterReadRequest::getFrames
std::pair< EtherCATFrameList *, std::uint16_t > getFrames()
Definition: RegisterReadRequest.cpp:39
SlaveRegisterReadingScheduler.h
Logging.h