MCPcopy Create free account
hub / github.com/RangeNetworks/openbts / writeStartTime

Function writeStartTime

GSM/GSML3GPRSElements.cpp:163–200  ·  view source on GitHub ↗

TBF Starting Time GSM 04.08 10.5.2.38

Source from the content-addressed store, hash-verified

161
162// TBF Starting Time GSM 04.08 10.5.2.38
163static void writeStartTime(MsgCommon &dest, unsigned startframe)
164{
165 std::ostream*os = dest.getStream(); // non-NULL for text() function.
166
167 // The names T1, T2, T3 are defined in table 10.5.79
168 unsigned T1 = (startframe/1326)%32;
169 unsigned T3 = startframe%51;
170 unsigned T2 = startframe%26;
171
172 // Recompute original startframe:
173 // Note that T3-T2 may be negative:
174 int recomputed = 51 * (((int)T3-(int)T2) % 26) + T3 + 51 * 26 * T1;
175 unsigned startframemod = (startframe % 42432);
176
177 // If we are writing text(), output both the original startframe and
178 // the computed T1,T2,T3.
179 if (os) {
180 // The recomputed time may be a much smaller number than startframe.
181 *os << " TBFStartFrame=" <<startframe << "=(" << "T=" <<recomputed;
182 }
183
184 // Note: The fields are written here Most-Significant-Bit first in each byte,
185 // then the bytes are reversed in the encoder before being sent to the radio.
186 // 7 6 5 4 3 2 1 0
187 // [ T1[4:0] ][ T3[5:3] ] Octet 1
188 // [ T3[2:0] ][ T2[4:0] ] Octet 2
189 dest.writeField(T1,5,"T1p");
190 dest.writeField(T3,6,"T3"); // Yes T3 comes before T2.
191 dest.writeField(T2,5,"T2");
192
193 // This just doesnt work, despite the documentation.
194 if (os && recomputed != (int)startframemod) {
195 *os << " TBF Start Time miscalculation: "
196 <<LOGVAR(startframemod) <<"!=" <<LOGVAR(recomputed);
197 }
198
199 if (os) { *os << ")"; }
200}
201
202
203// (pat) The uplink assignment is always initiated by the MS using a RACH,

Calls 2

getStreamMethod · 0.45
writeFieldMethod · 0.45

Tested by

no test coverage detected