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 namespace ns3
31 {
32 
43 class SatMobilityObserver : public Object
44 {
45  public:
50  static TypeId GetTypeId(void);
51  TypeId GetInstanceTypeId(void) const;
52 
57 
65  SatMobilityObserver(Ptr<SatMobilityModel> ownMobility,
66  Ptr<SatMobilityModel> geoSatMobility,
67  bool isRegenerative = false);
68 
72  virtual ~SatMobilityObserver();
73 
77  virtual void DoDispose(void);
78 
86  void ObserveTimingAdvance(Ptr<PropagationDelayModel> ownDelayModel,
87  Ptr<PropagationDelayModel> anotherDelayModel,
88  Ptr<SatMobilityModel> anotherMobility);
89 
95  double GetElevationAngle(void);
96 
102  double GetVelocity(void);
103 
109  Time GetTimingAdvance(void);
110 
117  typedef void (*PropertyChangedCallback)(Ptr<const SatMobilityObserver> mobilityObserver);
118 
119  private:
123  void NotifyPropertyChange(void) const;
124 
128  void UpdateElevationAngle();
129 
133  void UpdateTimingAdvance();
134 
138  void SatelliteStatusChanged();
139 
146  void PositionChanged(std::string context, Ptr<const SatMobilityModel> position);
147 
151  TracedCallback<Ptr<const SatMobilityObserver>> m_propertyChangeTrace;
152 
153  Ptr<SatMobilityModel> m_ownMobility;
154  Ptr<SatMobilityModel> m_anotherMobility;
155  Ptr<SatMobilityModel> m_geoSatMobility;
156  Ptr<PropagationDelayModel> m_ownProgDelayModel;
157  Ptr<PropagationDelayModel> m_anotherProgDelayModel;
158 
159  bool m_initialized; // flag for GetElevationAngle
160  bool m_updateElevationAngle; // flag for GetElevationAngle
161  bool m_updateTimingAdvance; // flag for GetTimingAdvance
169  double m_velocity;
171 };
172 
173 } // namespace ns3
174 
175 #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.