bluetoothengine/btmac/src/ATCodec/atccommand.cpp
branchRCL_3
changeset 21 53b7818cd282
parent 2 0b192a3a05a4
equal deleted inserted replaced
20:2f88a7d66f50 21:53b7818cd282
   123     {
   123     {
   124     TInt32 version = aStream.ReadInt32L();
   124     TInt32 version = aStream.ReadInt32L();
   125     
   125     
   126     if (version == KStreamVersion1)
   126     if (version == KStreamVersion1)
   127         {
   127         {
   128         iText.CreateL(KMaxATSize);
   128         iText.CreateL(KDefaultCmdBufLength);
   129         aStream >> iText;
   129         aStream >> iText;
   130         iId = static_cast<TATId>(aStream.ReadInt32L());
   130         iId = static_cast<TATId>(aStream.ReadInt32L());
   131         iType = static_cast<TATType>(aStream.ReadInt32L());
   131         iType = static_cast<TATType>(aStream.ReadInt32L());
   132         TInt count = aStream.ReadInt32L();
   132         TInt count = aStream.ReadInt32L();
   133         for (TInt i = 0; i < count; i++)
   133         for (TInt i = 0; i < count; i++)
   489 // ----------------------------------------------------------------------------
   489 // ----------------------------------------------------------------------------
   490 //
   490 //
   491 TInt CATResult::Parse(TATId aId, TATType aType, const RATParamArray* aParams)
   491 TInt CATResult::Parse(TATId aId, TATType aType, const RATParamArray* aParams)
   492     {
   492     {
   493     TRACE_FUNC
   493     TRACE_FUNC
   494     TInt err = iText.Create(KMaxATSize);
   494     TInt err = iText.Create(KDefaultCmdBufLength);
   495 
   495 
   496     if (err != KErrNone)
   496     if (err != KErrNone)
   497         {
   497         {
   498         return err;
   498         return err;
   499         }
   499         }
   539                     TInt err = iParamList.Append((*aParams)[j]);
   539                     TInt err = iParamList.Append((*aParams)[j]);
   540                     if (err)
   540                     if (err)
   541                         {
   541                         {
   542                         return err;
   542                         return err;
   543                         }
   543                         }
   544                     if (iText.Length() + (*aParams)[j].Des().Length() > KMaxATSize)
   544                     if (iText.Length() + (*aParams)[j].Des().Length() > KDefaultCmdBufLength)
   545                         {
   545                         {
   546                         return KErrArgument;
   546                         return KErrArgument;
   547                         }
   547                         }
   548                     iText.Append((*aParams)[j].Des());
   548                     iText.Append((*aParams)[j].Des());
   549                     if (j != aParams->Count() - 1)
   549                     if (j != aParams->Count() - 1)
   550                         {
   550                         {
   551                         if (iText.Length() + comma.Length() > KMaxATSize)
   551                         if (iText.Length() + comma.Length() > KDefaultCmdBufLength)
   552                             {
   552                             {
   553                             return KErrArgument;
   553                             return KErrArgument;
   554                             }
   554                             }
   555                         iText.Append(KDelimiterComma);
   555                         iText.Append(KDelimiterComma);
   556                         }
   556                         }
   563     }
   563     }
   564 
   564 
   565     
   565     
   566 TInt CATResult::AddCRLF(TDes8& aText)
   566 TInt CATResult::AddCRLF(TDes8& aText)
   567     {
   567     {
   568     if (aText.Length() + KCRLFSize > KMaxATSize)
   568     if (aText.Length() + KCRLFSize > KDefaultCmdBufLength)
   569         {
   569         {
   570         return KErrOverflow;
   570         return KErrOverflow;
   571         }
   571         }
   572     TBuf8<KMaxATSize> buf(aText);
   572     TBuf8<KDefaultCmdBufLength> buf(aText);
   573     aText.Format(KCRLFFormat, &buf);
   573     aText.Format(KCRLFFormat, &buf);
   574     return KErrNone;
   574     return KErrNone;
   575     }
   575     }
   576 
   576 
   577 void ATCmdArrayResetAndDestroyAndClose(TAny* aPtr)
   577 void ATCmdArrayResetAndDestroyAndClose(TAny* aPtr)