Loading...
Searching...
No Matches
satellite-uplink-info-tag.cc
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: Bastien TAURAN <bastien.tauran@viveris.fr>
19 */
20
22
23#include <ostream>
24
25namespace ns3
26{
27
28NS_OBJECT_ENSURE_REGISTERED(SatUplinkInfoTag);
29
31 : m_satelliteReceptionTime(Seconds(0)),
32 m_sinr(0.0),
34 m_sinrComputed(false),
35 m_satId(0),
36 m_beamId(0),
37 m_isControl(false)
38{
39 // Nothing to do here
40}
41
42SatUplinkInfoTag::SatUplinkInfoTag(Time satelliteReceptionTime,
43 double sinr,
44 double additionalInterference,
45 uint32_t satId,
46 uint32_t beamId,
47 bool isControl)
48 : m_satelliteReceptionTime(satelliteReceptionTime),
49 m_sinr(sinr),
50 m_additionalInterference(additionalInterference),
51 m_sinrComputed(true),
52 m_satId(satId),
53 m_beamId(beamId),
54 m_isControl(isControl)
55{
56 // Nothing to do here
57}
58
59TypeId
61{
62 static TypeId tid =
63 TypeId("ns3::SatUplinkInfoTag").SetParent<Tag>().AddConstructor<SatUplinkInfoTag>();
64 return tid;
65}
66
67TypeId
69{
70 return GetTypeId();
71}
72
73uint32_t
75{
76 return sizeof(Time) + 2 * sizeof(double) + 2 * sizeof(bool) + 2 * sizeof(uint32_t);
77}
78
79void
81{
82 int64_t satelliteReceptionTime = m_satelliteReceptionTime.GetNanoSeconds();
83 i.Write((const uint8_t*)&satelliteReceptionTime, sizeof(int64_t));
84
85 i.WriteDouble(m_sinr);
86 i.WriteDouble(m_additionalInterference);
87 i.WriteU8(m_sinrComputed);
88 i.WriteU32(m_satId);
89 i.WriteU32(m_beamId);
90 i.WriteU8(m_isControl);
91}
92
93void
95{
96 int64_t satelliteReceptionTime;
97 i.Read((uint8_t*)&satelliteReceptionTime, 8);
98 m_satelliteReceptionTime = NanoSeconds(satelliteReceptionTime);
99
100 m_sinr = i.ReadDouble();
101 m_additionalInterference = i.ReadDouble();
102 m_sinrComputed = i.ReadU8();
103 m_satId = i.ReadU32();
104 m_beamId = i.ReadU32();
105 m_isControl = i.ReadU8();
106}
107
108void
109SatUplinkInfoTag::Print(std::ostream& os) const
110{
111 os << m_satelliteReceptionTime << " " << m_sinr << " " << m_satId << " " << m_beamId << " "
112 << m_isControl;
113}
114
115Time
120
121void
123{
124 m_satelliteReceptionTime = satelliteReceptionTime;
125}
126
127double
129{
130 return m_sinr;
131}
132
133void
134SatUplinkInfoTag::SetSinr(double sinr, double additionalInterference)
135{
136 m_sinr = sinr;
137 m_additionalInterference = additionalInterference;
138}
139
140double
145
146bool
148{
149 return m_sinrComputed;
150}
151
152uint32_t
154{
155 return m_satId;
156}
157
158void
160{
161 m_satId = satId;
162}
163
164uint32_t
166{
167 return m_beamId;
168}
169
170void
172{
173 m_beamId = beamId;
174}
175
176bool
178{
179 return m_isControl;
180}
181
182void
184{
185 m_isControl = isControl;
186}
187
188} // namespace ns3
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.