ChimeraTK-DeviceAccess  03.18.00
RebotProtocol0.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 #pragma once
4 
6 
7 #include <boost/shared_ptr.hpp>
8 
9 #include <vector>
10 
11 namespace ChimeraTK {
12  namespace Rebot {
13  class Connection;
14  }
15 
17  explicit RebotProtocol0(boost::shared_ptr<Rebot::Connection>& tcpCommunicator);
18  virtual ~RebotProtocol0(){};
19 
20  virtual void read(uint32_t addressInBytes, int32_t* data, size_t sizeInBytes) override;
21  virtual void write(uint32_t addressInBytes, int32_t const* data, size_t sizeInBytes) override;
22  virtual void sendHeartbeat() override;
23 
24  struct RegisterInfo {
25  uint32_t addressInWords;
26  uint32_t nWords;
27  // the constructor checks that the address and size are multiples of 4 and
28  // throws if this is not the case
29  RegisterInfo(uint32_t addressInBytes, uint32_t sizeInBytes);
30  };
31 
32  // protected:
33  boost::shared_ptr<Rebot::Connection> _tcpCommunicator;
34  void fetchFromRebotServer(uint32_t wordAddress, uint32_t numberOfWords, int32_t* dataLocation) const;
35  void sendRebotReadRequest(const uint32_t wordAddress, const uint32_t wordsToRead) const;
36  static void transferVectorToDataPtr(const std::vector<uint32_t>& source, int32_t* destination);
37  };
38 
39 } // namespace ChimeraTK
ChimeraTK::RebotProtocol0::_tcpCommunicator
boost::shared_ptr< Rebot::Connection > _tcpCommunicator
Definition: RebotProtocol0.h:33
ChimeraTK::RebotProtocol0
Definition: RebotProtocol0.h:16
ChimeraTK::RebotProtocol0::sendHeartbeat
virtual void sendHeartbeat() override
Definition: RebotProtocol0.cc:102
RebotProtocolImplementor.h
ChimeraTK::RebotProtocol0::~RebotProtocol0
virtual ~RebotProtocol0()
Definition: RebotProtocol0.h:18
ChimeraTK::RebotProtocol0::write
virtual void write(uint32_t addressInBytes, int32_t const *data, size_t sizeInBytes) override
Definition: RebotProtocol0.cc:52
ChimeraTK::RebotProtocol0::transferVectorToDataPtr
static void transferVectorToDataPtr(const std::vector< uint32_t > &source, int32_t *destination)
Definition: RebotProtocol0.cc:93
ChimeraTK::RebotProtocol0::RebotProtocol0
RebotProtocol0(boost::shared_ptr< Rebot::Connection > &tcpCommunicator)
Definition: RebotProtocol0.cc:15
ChimeraTK::RebotProtocol0::RegisterInfo
Definition: RebotProtocol0.h:24
ChimeraTK::RebotProtocol0::RegisterInfo::RegisterInfo
RegisterInfo(uint32_t addressInBytes, uint32_t sizeInBytes)
Definition: RebotProtocol0.cc:17
ChimeraTK::RebotProtocol0::sendRebotReadRequest
void sendRebotReadRequest(const uint32_t wordAddress, const uint32_t wordsToRead) const
Definition: RebotProtocol0.cc:83
ChimeraTK::RebotProtocol0::fetchFromRebotServer
void fetchFromRebotServer(uint32_t wordAddress, uint32_t numberOfWords, int32_t *dataLocation) const
Definition: RebotProtocol0.cc:66
ChimeraTK::RebotProtocolImplementor
This is the base class of the code which implements the ReboT protocol.
Definition: RebotProtocolImplementor.h:14
ChimeraTK::RebotProtocol0::RegisterInfo::nWords
uint32_t nWords
Definition: RebotProtocol0.h:26
ChimeraTK::RebotProtocol0::RegisterInfo::addressInWords
uint32_t addressInWords
Definition: RebotProtocol0.h:25
ChimeraTK
Definition: DummyBackend.h:16
ChimeraTK::RebotProtocol0::read
virtual void read(uint32_t addressInBytes, int32_t *data, size_t sizeInBytes) override
Definition: RebotProtocol0.cc:30