35 #include "radiotorouter.pb.h" 37 class EMANE::Controls::R2RINeighborMetricControlMessage::Implementation
43 neighborMetrics_{neighborMetrics}{}
47 return neighborMetrics_;
54 EMANE::Controls::R2RINeighborMetricControlMessage::
55 R2RINeighborMetricControlMessage(
const R2RINeighborMetricControlMessage & msg):
57 pImpl_{
new Implementation{*msg.pImpl_}}
61 EMANE::Controls::R2RINeighborMetricControlMessage::
63 ControlMessage(IDENTIFIER),
64 pImpl_{
new Implementation{neighborMetrics}}{}
73 return pImpl_->getNeighborMetrics();
86 EMANEMessage::RadioToRouterNeighborMetrics msg;
90 R2RINeighborMetrics::const_iterator iter = metrics.begin();
92 for(;iter != metrics.end(); ++iter)
94 EMANEMessage::RadioToRouterNeighborMetrics::NeighborMetric * pNeighborMetric =
97 pNeighborMetric->set_neighborid(iter->getId());
98 pNeighborMetric->set_numrxframes(iter->getNumRxFrames());
99 pNeighborMetric->set_numtxframes(iter->getNumTxFrames());
100 pNeighborMetric->set_nummissedframes(iter->getNumMissedFrames());
101 pNeighborMetric->set_bandwidthconsumption
102 (std::chrono::duration_cast<DoubleSeconds>(iter->getBandwidthConsumption()).count());
104 pNeighborMetric->set_sinraverage(iter->getSINRAvgdBm());
105 pNeighborMetric->set_sinrstddev(iter->getSINRStddev());
106 pNeighborMetric->set_noiseflooravg(iter->getNoiseFloorAvgdBm());
107 pNeighborMetric->set_noisefloorstddev(iter->getNoiseFloorStddev());
108 pNeighborMetric->set_rxavgdataratebps(iter->getRxAvgDataRatebps());
109 pNeighborMetric->set_txavgdataratebps(iter->getTxAvgDataRatebps());
112 if(!msg.SerializeToString(&serialization))
117 return serialization;
123 EMANEMessage::RadioToRouterNeighborMetrics msg;
125 if(!msg.ParseFromString(serialization))
132 for(
const auto & neighbor : msg.metrics())
134 metrics.push_back(
R2RINeighborMetric{
static_cast<std::uint16_t
>(neighbor.neighborid()),
135 neighbor.numrxframes(),
136 neighbor.numtxframes(),
137 neighbor.nummissedframes(),
139 neighbor.sinraverage(),
140 neighbor.sinrstddev(),
141 neighbor.noiseflooravg(),
142 neighbor.noisefloorstddev(),
143 neighbor.rxavgdataratebps(),
144 neighbor.txavgdataratebps()});
std::string Serialization
const R2RINeighborMetrics & getNeighborMetrics() const
SerializationException is thrown when an exception occurs during serialization or deserialization of ...
std::string serialize() const override
~R2RINeighborMetricControlMessage()
std::list< R2RINeighborMetric > R2RINeighborMetrics
std::chrono::microseconds Microseconds
std::chrono::duration< double > DoubleSeconds
R2RI Neighbor Metric Control Message is sent to an NEM's transport layer to convey information about ...
R2RI neighbor metrics are used in conjunction with the R2RINeighborMetricControlMessage to inform an ...
static R2RINeighborMetricControlMessage * create(const Serialization &serialization)
R2RINeighborMetricControlMessage * clone() const override
ControlMessage(ControlMessageId id)