IpbusMock  1.0.0
Library which integrates IPbus use in Phoenix
Loading...
Searching...
No Matches
ipbrw.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
5#include "uhal/uhal.hpp"
6#include <uhal/log/LogLevels.hpp>
7
8class IpBusImpl {
9 public:
10 IpBusImpl(const std::string &connectionFilePath,
11 const std::string &connectionId);
12 ~IpBusImpl();
13
14 bool read(const std::string &nodeId, uint32_t &res);
15 bool write(const std::string &nodeId, const uint32_t values);
16 bool readBlock(const std::string &nodeId, std::vector<uint32_t> &results,
17 const uint32_t &aSize);
18 bool writeBlock(const std::string &nodeId,
19 const std::vector<uint32_t> values);
20 uint32_t getSize(const std::string &nodeId) const;
21
22 static IpBusImpl *pipbus_createSocket(const std::string &connectionFilePath,
23 const std::string &connectionId);
24 static void setLogLevelTo(const std::string level);
25
26 void close();
27
28 private:
29 uhal::HwInterface *hardwareInterface;
30};
bool writeBlock(const std::string &nodeId, const std::vector< uint32_t > values)
Writes a block of data to a block of registers or a block-write port.
Definition ipbrw.cpp:102
~IpBusImpl()
Destructor of IpBusImpl.
Definition ipbrw.cpp:22
uint32_t getSize(const std::string &nodeId) const
Computes the node size.
Definition ipbrw.cpp:33
bool readBlock(const std::string &nodeId, std::vector< uint32_t > &results, const uint32_t &aSize)
Reads a block of data from a block of registers or a block-read port.
Definition ipbrw.cpp:79
IpBusImpl(const std::string &connectionFilePath, const std::string &connectionId)
Constructor of IpBusImpl.
Definition ipbrw.cpp:12
bool read(const std::string &nodeId, uint32_t &res)
Reads a register using the uHAL library.
Definition ipbrw.cpp:44
static IpBusImpl * pipbus_createSocket(const std::string &connectionFilePath, const std::string &connectionId)
Creates an IpBusImpl instance.
Definition ipbrw.cpp:117
uhal::HwInterface * hardwareInterface
Definition ipbrw.h:29
bool write(const std::string &nodeId, const uint32_t values)
Writes a register using the uHAL library.
Definition ipbrw.cpp:64
void close()
Close the IpBusImpl connection.
Definition ipbrw.cpp:151
static void setLogLevelTo(const std::string level)
Sets the uHAL log level to the given level.
Definition ipbrw.cpp:128