satellite-sinr-probe.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Bucknell University
4  * Copyright (c) 2014 Magister Solutions
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors of original work (application-packet-probe.h) which this work
20  * derives from:
21  * - L. Felipe Perrone (perrone@bucknell.edu)
22  * - Tiago G. Rodrigues (tgr002@bucknell.edu)
23  * - Mitch Watrous (watrous@u.washington.edu)
24  *
25  * Modified for Sinr trace source by:
26  * - Budiarto Herman (budiarto.herman@magister.fi)
27  */
28 
29 #ifndef SATELLITE_SINR_PROBE_H
30 #define SATELLITE_SINR_PROBE_H
31 
32 #include <ns3/address.h>
33 #include <ns3/nstime.h>
34 #include <ns3/probe.h>
35 #include <ns3/traced-callback.h>
36 
37 #include <string>
38 
39 namespace ns3
40 {
41 
52 class SatSinrProbe : public Probe
53 {
54  public:
59  static TypeId GetTypeId();
60 
64  SatSinrProbe();
65 
69  virtual ~SatSinrProbe();
70 
77  void SetValue(double sinrDb, const Address& address);
78 
86  static void SetValueByPath(std::string path, double sinrDb, const Address& address);
87 
95  virtual bool ConnectByObject(std::string traceSource, Ptr<Object> obj);
96 
105  virtual void ConnectByPath(std::string path);
106 
112  typedef void (*SinrCallback)(double sinr, const Address& from);
113 
114  private:
123  void TraceSink(double sinrDb, const Address& address);
124 
126  TracedCallback<double, const Address&> m_output;
128  TracedCallback<double, double> m_outputSinr;
129 
131  double m_sinr;
132 
134  Address m_address;
135 };
136 
137 } // namespace ns3
138 
139 #endif // SATELLITE_SINR_PROBE_H
Probe to translate from a TraceSource to two more easily parsed TraceSources.
Address m_address
The socket address for the traced packet.
void TraceSink(double sinrDb, const Address &address)
Method to connect to an underlying ns3::TraceSource with arguments of type double and const Address&.
TracedCallback< double, double > m_outputSinr
Output trace, previous SINR and current SINR.
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
virtual ~SatSinrProbe()
Destructor for SatSinrProbe.
SatSinrProbe()
Default constructor.
static void SetValueByPath(std::string path, double sinrDb, const Address &address)
Set a probe value by its name in the Config system.
TracedCallback< double, const Address & > m_output
Output trace, the SINR and source address.
void(* SinrCallback)(double sinr, const Address &from)
Callback signature for SINR and an address.
void SetValue(double sinrDb, const Address &address)
Set a probe value.
static TypeId GetTypeId()
Get the type ID.
double m_sinr
The traced SINR.
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.