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

Function gprsStart

GPRS/GPRSCLI.cpp:205–245  ·  view source on GitHub ↗

Start the service and allocate a channel. This is redundant - can call rach.

Source from the content-addressed store, hash-verified

203// Start the service and allocate a channel.
204// This is redundant - can call rach.
205static CLIStatus gprsStart(int argc, char **argv, int argi, ostream&os)
206{
207 // Start the thread, if not running.
208 char *modearg = RN_CMD_ARG;
209 if (modearg) {
210 gL2MAC.macSingleStepMode = strmatch(modearg,"s");
211 if (!gL2MAC.macSingleStepMode) { os << "Unrecognized arg: "<<modearg<<"\n"; return BAD_VALUE; }
212 } else {
213 gL2MAC.macSingleStepMode = 0;
214 }
215
216 // Reinit the config in case single step mode is changing.
217 gL2MAC.macConfigInit();
218
219 if (gL2MAC.macRunning) {
220 os << "gprs service thread already running.\n";
221 } else if (gL2MAC.macStart()) {
222 os << "started gprs service "
223 <<(gL2MAC.macSingleStepMode ? "single step mode" : "thread") << "\n";
224 } else {
225 os << "failed to start gprs service.\n";
226 }
227
228 // The macAddChannel below is failing. Try waiting a while.
229 // Update: it fails between the time OpenBTS first starts up and the transceiver times out,
230 // about a 5 second window after start up. This may only happen after a crash.
231 // Update again: I think on startup the channels come up with the recyclable timers
232 // running and we cannot allocate a channel until they expire.
233 sleep(1);
234
235 // Allocate a channel, if none already allocated.
236 if (! gL2MAC.macActiveChannels()) { gL2MAC.macAddChannel(); }
237 if (! gL2MAC.macActiveChannels()) {
238 os << "failed to allocate channel for gprs.\n";
239 } else {
240 PDCHL1FEC *pdch = gL2MAC.macPickChannel();
241 assert(pdch);
242 os << "allocated channel for gprs: " << pdch << "\n";
243 }
244 return SUCCESS;
245}
246
247static CLIStatus gprsStop(int argc, char **argv, int argi, ostream&os)
248{

Callers

nothing calls this directly

Calls 5

macConfigInitMethod · 0.80
macStartMethod · 0.80
macActiveChannelsMethod · 0.80
macAddChannelMethod · 0.80
macPickChannelMethod · 0.80

Tested by

no test coverage detected