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

Function encodePower

GSM/GSML1FEC.cpp:171–186  ·  view source on GitHub ↗

Given a power level in dBm, encode the control code. */

Source from the content-addressed store, hash-verified

169
170/** Given a power level in dBm, encode the control code. */
171unsigned encodePower(int power)
172{
173 static const int *table = pickTable();
174 assert(table);
175 unsigned minErr = abs(power - table[0]);
176 unsigned code = 0;
177 for (int i=1; i<32; i++) {
178 unsigned thisErr = abs(power - table[i]);
179 if (thisErr==0) return i;
180 if (thisErr<minErr) {
181 minErr = thisErr;
182 code = i;
183 }
184 }
185 return code;
186}
187
188
189//@}

Callers 1

sendFrameMethod · 0.85

Calls 1

pickTableFunction · 0.85

Tested by

no test coverage detected