satellite-mobility-observer.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sami Rantanen <sami.rantanen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_MOBILITY_OBSERVER_H
22 #define SATELLITE_MOBILITY_OBSERVER_H
23 
24 #include "geo-coordinate.h"
27 
28 #include <ns3/object.h>
29 
30 #include <string>
31 
32 namespace ns3
33 {
34 
45 class SatMobilityObserver : public Object
46 {
47  public:
52  static TypeId GetTypeId(void);
53  TypeId GetInstanceTypeId(void) const;
54 
59 
67  SatMobilityObserver(Ptr<SatMobilityModel> ownMobility,
68  Ptr<SatMobilityModel> geoSatMobility,
69  bool isRegenerative = false);
70 
74  virtual ~SatMobilityObserver();
75 
79  virtual void DoDispose(void);
80 
88  void ObserveTimingAdvance(Ptr<PropagationDelayModel> ownDelayModel,
89  Ptr<PropagationDelayModel> anotherDelayModel,
90  Ptr<SatMobilityModel> anotherMobility);
91 
97  double GetElevationAngle(void);
98 
104  double GetVelocity(void);
105 
111  Time GetTimingAdvance(void);
112 
119  typedef void (*PropertyChangedCallback)(Ptr<const SatMobilityObserver> mobilityObserver);
120 
121  private:
125  void NotifyPropertyChange(void) const;
126 
130  void UpdateElevationAngle();
131 
135  void UpdateTimingAdvance();
136 
140  void SatelliteStatusChanged();
141 
148  void PositionChanged(std::string context, Ptr<const SatMobilityModel> position);
149 
153  TracedCallback<Ptr<const SatMobilityObserver>> m_propertyChangeTrace;
154 
155  Ptr<SatMobilityModel> m_ownMobility;
156  Ptr<SatMobilityModel> m_anotherMobility;
157  Ptr<SatMobilityModel> m_geoSatMobility;
158  Ptr<PropagationDelayModel> m_ownProgDelayModel;
159  Ptr<PropagationDelayModel> m_anotherProgDelayModel;
160 
161  bool m_initialized; // flag for GetElevationAngle
162  bool m_updateElevationAngle; // flag for GetElevationAngle
163  bool m_updateTimingAdvance; // flag for GetTimingAdvance
171  double m_velocity;
173 };
174 
175 } // namespace ns3
176 
177 #endif /* SATELLITE_MOBILITY_OBSERVER_H */
Observes given mobilities and keeps track of certain wanted properties.
void(* PropertyChangedCallback)(Ptr< const SatMobilityObserver > mobilityObserver)
Callback signature for PropertyChanged trace source.
Ptr< SatMobilityModel > m_geoSatMobility
virtual ~SatMobilityObserver()
Destructor of the mobility observer.
virtual void DoDispose(void)
Dispose of this class instance.
void UpdateElevationAngle()
Update elevation angle.
SatMobilityObserver()
Default constructor of the mobility observer (should not be called)
void ObserveTimingAdvance(Ptr< PropagationDelayModel > ownDelayModel, Ptr< PropagationDelayModel > anotherDelayModel, Ptr< SatMobilityModel > anotherMobility)
Enable observing of the timing advance.
Time GetTimingAdvance(void)
Get timing advance.
void PositionChanged(std::string context, Ptr< const SatMobilityModel > position)
Listener (callback) for mobility position changes.
void SatelliteStatusChanged()
Do actions needed when satellite position is changed.
void UpdateTimingAdvance()
Update timing advance.
double GetVelocity(void)
Get velocity of own movement (speed).
static TypeId GetTypeId(void)
Get the type ID.
Ptr< SatMobilityModel > m_anotherMobility
void NotifyPropertyChange(void) const
Notify listeners about some property is changed.
double GetElevationAngle(void)
Get elevation angle.
TracedCallback< Ptr< const SatMobilityObserver > > m_propertyChangeTrace
Used to alert subscribers that a change in some observed property has occurred.
Ptr< PropagationDelayModel > m_anotherProgDelayModel
Ptr< PropagationDelayModel > m_ownProgDelayModel
Ptr< SatMobilityModel > m_ownMobility
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.