3#ifndef __BUS_LOAD_MONITOR_HPP__
4#define __BUS_LOAD_MONITOR_HPP__
8#include <yarp/os/Bottle.h>
9#include <yarp/os/BufferedPort.h>
10#include <yarp/os/PeriodicThread.h>
12#include "ICanMessageNotifier.hpp"
31 std::atomic<unsigned int> bits;
45 void setPort(yarp::os::BufferedPort<yarp::os::Bottle> * port)
46 { this->port = port; }
48 void setBitrate(
unsigned int bitrate)
49 { this->bitrate = bitrate; }
51 ICanMessageNotifier * getReadMonitor()
52 {
return &readMonitor; }
54 ICanMessageNotifier * getWriteMonitor()
55 {
return &writeMonitor; }
62 yarp::os::BufferedPort<yarp::os::Bottle> * port {
nullptr};
63 unsigned int bitrate {1};
65 OneWayMonitor readMonitor;
66 OneWayMonitor writeMonitor;
void run() override
The thread will invoke this periodically.
Definition BusLoadMonitor.cpp:37
BusLoadMonitor(double period)
Constructor.
Definition BusLoadMonitor.hpp:42
Implementation-agnostic consumer for RX CAN transfers.
Definition ICanMessageNotifier.hpp:22
Registers load statistics per single CAN bus.
Definition BusLoadMonitor.hpp:22
unsigned int reset()
Return stored value and clear counter.
Definition BusLoadMonitor.cpp:30
bool notifyMessage(const can_message &msg) override
Tell observers a new CAN message has arrived.
Definition BusLoadMonitor.cpp:22
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6
Proxy CAN message structure.
Definition CanMessage.hpp:20