serviceproviders/sapi_contacts_vpbk/tsrc/dev/tcontactsgetidsprovidertest/src/tcontactsgetidsprovidertestblocks.cpp
changeset 24 f4292e0e20df
parent 22 fc9cf246af83
child 33 50974a8b132e
equal deleted inserted replaced
23:5c0037c72160 24:f4292e0e20df
   105 //
   105 //
   106 TInt Ctcontactsgetidsprovidertest::RunMethodL(CStifItemParser& aItem) 
   106 TInt Ctcontactsgetidsprovidertest::RunMethodL(CStifItemParser& aItem) 
   107     {
   107     {
   108     static TStifFunctionInfo const KFunctions[] =
   108     static TStifFunctionInfo const KFunctions[] =
   109         {          
   109         {          
   110         ENTRY("GetIdsL", Ctcontactsgetidsprovidertest::GetIdsL)            
   110         ENTRY("GetIdsL", Ctcontactsgetidsprovidertest::GetIdsL),      
       
   111         ENTRY("AddContactAndGrp", Ctcontactsgetidsprovidertest::AddL)
   111         };
   112         };
   112     const TInt count = sizeof( KFunctions ) / 
   113     const TInt count = sizeof( KFunctions ) / 
   113                         sizeof( TStifFunctionInfo );
   114                         sizeof( TStifFunctionInfo );
   114     return RunInternalL( KFunctions, count, aItem );
   115     return RunInternalL( KFunctions, count, aItem );
   115     }
   116     }
   166           iLog->Log(_L("Result Iterator Not Found"));
   167           iLog->Log(_L("Result Iterator Not Found"));
   167           User::Leave(KErrNotFound);
   168           User::Leave(KErrNotFound);
   168           }
   169           }
   169       } */
   170       } */
   170   }
   171   }
   171 
   172  TInt Ctcontactsgetidsprovidertest::AddL( CStifItemParser& aItem )
       
   173      {  
       
   174      TInt error = KErrGeneral;
       
   175      TBuf<25> errcodedes(KNullDesC);
       
   176      LoadServiceL(); 
       
   177      aItem.GetNextInt(iExpErrorCode);
       
   178      CLiwDefaultMap* pMap = CLiwDefaultMap::NewL();    
       
   179         
       
   180     CLiwDefaultMap* fieldMap = CLiwDefaultMap::NewL();     
       
   181     TInt pos = 0;             
       
   182     fieldMap->InsertL(KFieldLabel,TLiwVariant(_L("firstname")));
       
   183         
       
   184     fieldMap->InsertL(KFieldValue,TLiwVariant(_L("Arnold")));
       
   185     //pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
       
   186     
       
   187     
       
   188     pMap->InsertL(KContactId, TLiwVariant( _L("")));
       
   189     pMap->InsertL(KFirstName, TLiwVariant(fieldMap));
       
   190     
       
   191     const TLiwGenericParam paramContentType(KType, TLiwVariant( _L("Contact"))); 
       
   192     const TLiwGenericParam paramAddData(KData, TLiwVariant(pMap)); ;
       
   193         
       
   194     iInList ->AppendL( paramContentType );
       
   195     iInList ->AppendL( paramAddData );   
       
   196      iIface->ExecuteCmdL(command9,
       
   197                          *iInList,
       
   198                          *iOutList); 
       
   199                          //KLiwOptASyncronous,
       
   200 //                         this);    
       
   201      const TLiwGenericParam* p = iOutList->FindFirst(pos,
       
   202                                                      KErrorCode); // Finding Error Code
       
   203      if(p)
       
   204          {
       
   205          TInt retcode = p->Value().AsTInt32();
       
   206          errcodedes.Num(retcode);
       
   207          iLog->Log(_L("return  code:"));
       
   208          iLog->Log(errcodedes);    
       
   209          if(iExpErrorCode == retcode)
       
   210                  {
       
   211                  iLog->Log(errcodedes);
       
   212                  iResult = KErrNone;
       
   213                  }
       
   214              else
       
   215                  {
       
   216                  User::Leave(KErrGeneral);
       
   217                  }             
       
   218              }
       
   219             
       
   220      iInList->Reset();
       
   221      iOutList->Reset();
       
   222      iLog->Log(_L(""));
       
   223      
       
   224      
       
   225      pMap = CLiwDefaultMap::NewL();
       
   226      pos = 0;
       
   227 
       
   228      pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
       
   229      pMap->InsertL(KGroupId, TLiwVariant(_L8("")));
       
   230      pMap->InsertL(KGroupLabel, TLiwVariant(_L("Group1")));
       
   231 
       
   232      const TLiwGenericParam paramContentType1(KType, TLiwVariant( _L("Group")));
       
   233      const TLiwGenericParam paramAddData1(KData, TLiwVariant(pMap)); ;
       
   234 
       
   235      iInList ->AppendL( paramContentType1 );
       
   236      iInList ->AppendL( paramAddData1 );
       
   237      iIface->ExecuteCmdL(command9,
       
   238                               *iInList,
       
   239                               *iOutList);
       
   240                            //   KLiwOptASyncronous,
       
   241                              // this);  
       
   242 
       
   243      p = iOutList->FindFirst( pos, KErrorCode );
       
   244      TLiwVariant err = p->Value();
       
   245      TInt code = err.AsTInt32();
       
   246 
       
   247      if(p)
       
   248       {
       
   249       TInt retcode = p->Value().AsTInt32();
       
   250       errcodedes.Num(retcode);
       
   251       iLog->Log(_L("return  code:"));
       
   252       iLog->Log(errcodedes);    
       
   253       if(iExpErrorCode == retcode)
       
   254               {
       
   255               iLog->Log(errcodedes);
       
   256               iResult = KErrNone;
       
   257               }
       
   258           else
       
   259               {
       
   260               User::Leave(KErrGeneral);
       
   261               }             
       
   262       }
       
   263              
       
   264       iInList->Reset();
       
   265       iOutList->Reset();
       
   266       iLog->Log(_L(""));
       
   267 
       
   268        pMap = CLiwDefaultMap::NewL();
       
   269        pos = 0;
       
   270 
       
   271        pMap->InsertL(KDBUri, TLiwVariant( _L("cntdb://c:contacts.cdb")));
       
   272        pMap->InsertL(KGroupId, TLiwVariant(_L8("")));
       
   273        pMap->InsertL(KGroupLabel, TLiwVariant(_L("Group2")));
       
   274 
       
   275        const TLiwGenericParam paramContentType2(KType, TLiwVariant( _L("Group")));
       
   276        const TLiwGenericParam paramAddData2(KData, TLiwVariant(pMap)); ;
       
   277 
       
   278        iInList ->AppendL( paramContentType2 );
       
   279        iInList ->AppendL( paramAddData2 );
       
   280        iIface->ExecuteCmdL(command9,
       
   281                                 *iInList,
       
   282                                 *iOutList);
       
   283                             //    KLiwOptASyncronous,
       
   284                               //  this);  
       
   285 
       
   286        p = iOutList->FindFirst( pos, KErrorCode );
       
   287        if(p)
       
   288         {
       
   289         TInt retcode = p->Value().AsTInt32();
       
   290         errcodedes.Num(retcode);
       
   291         iLog->Log(_L("return  code:"));
       
   292         iLog->Log(errcodedes);    
       
   293         if(iExpErrorCode == retcode)
       
   294                 {
       
   295                 iLog->Log(errcodedes);
       
   296                 iResult = KErrNone;
       
   297                 }
       
   298             else
       
   299                 {
       
   300                 User::Leave(KErrGeneral);
       
   301                 }             
       
   302         }
       
   303                
       
   304         iInList->Reset();
       
   305         iOutList->Reset();
       
   306         iLog->Log(_L(""));
       
   307    
       
   308          
       
   309          
       
   310      return iResult;
       
   311      }
       
   312 
       
   313  
   172 /* --------------------------------------------------------------------------
   314 /* --------------------------------------------------------------------------
   173  Ctmediaprovidertesting :: GetImageFilesL
   315  Ctmediaprovidertesting :: GetImageFilesL
   174  Calls the Getlist of Media management SAPI.
   316  Calls the Getlist of Media management SAPI.
   175 -----------------------------------------------------------------------------
   317 -----------------------------------------------------------------------------
   176 */
   318 */