Skip to content

Commit

Permalink
Inserted TESTCALL logging everywhere I could find
Browse files Browse the repository at this point in the history
  • Loading branch information
Djimmer committed May 21, 2015
1 parent 74e3022 commit 8142474
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
30 changes: 15 additions & 15 deletions Control/L3CallControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,37 +1296,36 @@ MachineStatus InCallMachine::machineRunState(int state, const GSM::L3Message *l3

void CCBase::TestCall(TranEntry* tran)
{
LOG(INFO) << " transaction: "<< *tran;
LOG(TESTCALL) << "Entering L3CallControl::CCBase::TestCall with transaction: " << LOGVAR(tran);
// Mark the call as active.
setGSMState(CCState::Active);
LOG(TESTCALL) << "Creating UDP Socket on port: " << gConfig.getNum("TestCall.Port");
// Create and open the control port.
UDPSocket controlSocket(gConfig.getNum("TestCall.Port"));

LOG(TESTCALL) << "Active UDP Socket on port: " << gConfig.getNum("TestCall.Port");
// FIXME -- Somehow, the RTP ports need to be attached to the transaction.
// This loop will run or block until some outside entity writes a
// channel release on the socket.
LOG(WARNING) << "entering test loop";
int test = 0;
while (test = 3) {
LOG(TESTCALL) << "Entering UDP test loop ";

while (true) {
// Get the outgoing message from the test call port.
char iBuf[MAX_UDP_LENGTH];
int msgLen = (size_t)controlSocket.read(iBuf);

LOG(WARNING) << "got " << msgLen << " bytes on UDP";
LOG(TESTCALL) << "Received " << msgLen << " bytes on UDP";

// Send it to the handset.

//TODO
GSM::L3Frame query(iBuf, msgLen);

LOG(WARNING) << "sending " << query;
LOG(TESTCALL) << " Sending L3Frame: " << LOGVAR(query);
channel()->l3sendf(query);

// Wait for a response.
// FIXME -- This should be a proper T3xxx value of some kind.
GSM::L3Frame *resp = channel()->l2recv(30000);
//GSM::L3Frame* resp = LCH->recv(30000);

if (!resp) {
LOG(WARNING) << "read timeout";
LOG(TESTCALL) << "Timeout ; No response";
break;
}

Expand All @@ -1335,21 +1334,22 @@ void CCBase::TestCall(TranEntry* tran)
// LOG(WARNING) << "unexpected primitive " << resp->primitive();
// break;
// }
LOG(WARNING) << "received " << *resp;
LOG(TESTCALL) << "Received response from handset: " << LOGVAR(resp);

// Send response on the port.
unsigned char oBuf[resp->size()];
resp->pack(oBuf);
controlSocket.writeBack((char*)oBuf);
// Delete and close the loop.
delete resp;
test = test + 1;
}

LOG(TESTCALL) << "Stopping L3CallControl::CCBase::Testcall function";
controlSocket.close();
LOG(WARNING) << "ending";
channel()->l3sendm(L3ChannelRelease());
setGSMState(CCState::ReleaseRequest);
tran -> handleMachineStatus(MachineStatus::MachineCodeQuitTran);
LOG(TESTCALL) << "Stopped L3CallControl::CCBase::Testcall function";
}


Expand Down
19 changes: 18 additions & 1 deletion Control/L3MMLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void MMContext::startSMSTran(TranEntry *tran)
// Setting the lock in one function and releasing it in another sucks and should be fixed.
bool MMUser::mmuServiceMTQueues() // arg redundant with mmuContext->channel.
{
LOG(TESTCALL) << "MMUser::mmuServiceMTQueues started";
devassert(gMMLock.lockcnt()); // Caller locked it.
//ScopedLock lock(mmuLock,__FILE__,__LINE__);
// TODO: check for blocks on our IMSI or TMSI?
Expand Down Expand Up @@ -118,6 +119,22 @@ bool MMUser::mmuServiceMTQueues() // arg redundant with mmuContext->channel.
return true;
}
}
//TODO: Is this If correct?
if (mmuContext->mmGetTran(MMContext::TE_CS1).isNULL()) {
if (mmuTESTCALL.size()) {
TranEntry *tran = mmuMTCq.pop_frontr();
LOG(TESTCALL) << "MMUser::mmuServiceMTQueues inside mmuTESTCALL if, with: "<< LOGVAR(tran);

// Tie the transaction to this channel.
mmuContext->mmConnectTran(MMContext::TE_CS1,tran);
// Unlock and run Testcall function
gMMLock.unlock();
TestCall(tran)
return true;
}
}


return false;
}

Expand Down Expand Up @@ -702,8 +719,8 @@ void MMUser::mmuAddMT(TranEntry *tran)
mmuMTSMSq.push_back(tran);
break;
case L3CMServiceType::TestCall:
mmuTESTCALL.push_back(tran);
LOG(TESTCALL) << "Entering the L3CMServiceType::Testcall branch of the case+switch";
mmuTESTCALL.push_back(tran);
break;
default:
assert(0);
Expand Down

0 comments on commit 8142474

Please sign in to comment.