bluetoothengine/btmac/src/BTMonoCmdHandler/btmcprotocol.cpp
branchRCL_3
changeset 72 4b59561a31c0
parent 54 0ba996a9b75d
equal deleted inserted replaced
64:1934667b0e2b 72:4b59561a31c0
   397     TRACE_FUNC
   397     TRACE_FUNC
   398     if (iHandleCmdPending)
   398     if (iHandleCmdPending)
   399         {
   399         {
   400         return;
   400         return;
   401         }
   401         }
   402     RBuf8 cmddes;
   402     TBuf8<KDefaultCmdBufLength> cmddes;
   403     cmddes.CreateL(KDefaultCmdBufLength);
   403     if (iInDataBuf.NextCommand(cmddes))
   404     CleanupClosePushL(cmddes);
   404         {
   405     if (iInDataBuf.NextCommand(cmddes) || cmddes.Length() == 0)
       
   406         {
       
   407         CleanupStack::PopAndDestroy(&cmddes);
       
   408         return;
   405         return;
   409         }
   406         }
   410     
   407     if (cmddes.Length() == 0)
       
   408         {
       
   409         return;
       
   410         }
   411     TRACE_INFO_SEG(
   411     TRACE_INFO_SEG(
   412         {
   412         {
   413         RBuf8 buf;
   413         TBuf8<KDefaultCmdBufLength> buf;
   414         buf.CreateL(KDefaultCmdBufLength);
       
   415         buf = cmddes;
   414         buf = cmddes;
   416         buf.Trim();
   415         buf.Trim();
   417         Trace(_L8("[HFP] [I] %S"), &buf);
   416         Trace(_L8("[HFP] [I] %S"), &buf);
   418         buf.Close();
       
   419         })
   417         })
   420 
   418 
   421     CATCommand* cmd = NULL;
   419     CATCommand* cmd = NULL;
   422     TRAPD(err, cmd = CATCommand::NewL(cmddes));
   420     TRAPD(err, cmd = CATCommand::NewL(cmddes));
   423     if (err)
   421     if (err)
   424         {
   422         {
   425       	if(iAtExt)
   423       	if(iAtExt)
   426         	{
   424         	{
   427       		iAtExt->HandleCommand(cmddes, _L8("\n\rERROR\n\r"));
   425       		iAtExt->HandleCommand(cmddes, _L8("\n\rERROR\n\r"));
   428       		CleanupStack::PopAndDestroy(&cmddes);
       
   429         	return;
   426         	return;
   430         	}
   427         	}
   431         CATResult* nok = CATResult::NewLC(EATERROR);
   428         CATResult* nok = CATResult::NewLC(EATERROR);
   432         SendResponseL(*nok);
   429         SendResponseL(*nok);
   433         CleanupStack::PopAndDestroy(nok);
   430         CleanupStack::PopAndDestroy(nok);
   434         CleanupStack::PopAndDestroy(&cmddes);
       
   435         return;
   431         return;
   436         }
   432         }
   437     CleanupStack::PopAndDestroy(&cmddes);
       
   438     CleanupStack::PushL(cmd);
   433     CleanupStack::PushL(cmd);
   439     iHandleCmdPending = ETrue;
   434     iHandleCmdPending = ETrue;
   440 	TATId id = cmd->Id();
   435 	TATId id = cmd->Id();
   441     if (id == EATA || 
   436     if (id == EATA || 
   442         id == EATD2 || 
   437         id == EATD2 || 
  1083 
  1078 
  1084 void CBtmcProtocol::DoSendProtocolDataL()
  1079 void CBtmcProtocol::DoSendProtocolDataL()
  1085     {
  1080     {
  1086     TRACE_INFO((_L("credit %d"), iCredit))
  1081     TRACE_INFO((_L("credit %d"), iCredit))
  1087     TInt count = iOutgoPacketQueue->MdcaCount();
  1082     TInt count = iOutgoPacketQueue->MdcaCount();
  1088     RBuf8 buf;
       
  1089     buf.CreateL(KDefaultCmdBufLength);
       
  1090     CleanupClosePushL(buf);
       
  1091     for (TInt i = 0; iCredit >0 && i < count; i++)
  1083     for (TInt i = 0; iCredit >0 && i < count; i++)
  1092         {
  1084         {
  1093         iCredit--;
  1085         iCredit--;
       
  1086         TBuf8<KDefaultCmdBufLength> buf;
  1094         buf.Copy(iOutgoPacketQueue->MdcaPoint(0));
  1087         buf.Copy(iOutgoPacketQueue->MdcaPoint(0));
  1095         iObserver.SendProtocolDataL(buf);
  1088         iObserver.SendProtocolDataL(buf);
  1096         iOutgoPacketQueue->Delete(0);
  1089         iOutgoPacketQueue->Delete(0);
  1097         }
  1090         }
  1098     CleanupStack::PopAndDestroy(&buf);
       
  1099     }
  1091     }
  1100 
  1092 
  1101 void CBtmcProtocol::StartTimerL(TInt aService, TInt aTimeout)
  1093 void CBtmcProtocol::StartTimerL(TInt aService, TInt aTimeout)
  1102     {
  1094     {
  1103     if (!iTimerActive)
  1095     if (!iTimerActive)