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