smf/smfcredentialmgr/smfcredmgrclient/smfcredmgrclient_p.cpp
changeset 26 83d6a149c755
parent 24 1cee9f1b95e0
equal deleted inserted replaced
25:a180113055cb 26:83d6a149c755
    23 #include "smfcredmgrclientutil.h"
    23 #include "smfcredmgrclientutil.h"
    24 #include "smfcredmgrclient_p.h"
    24 #include "smfcredmgrclient_p.h"
    25 
    25 
    26 CSmfCredMgrClientSymbian::CSmfCredMgrClientSymbian(
    26 CSmfCredMgrClientSymbian::CSmfCredMgrClientSymbian(
    27 		SmfCredMgrClient* aPublicImpl) :
    27 		SmfCredMgrClient* aPublicImpl) :
    28 		CActive(EPriorityStandard),
    28 	CActive(EPriorityStandard), iPublicImpl(aPublicImpl)
    29 		iPublicImpl(aPublicImpl) 
       
    30 	{
    29 	{
    31 
    30 
    32 	}
    31 	}
    33 
    32 
    34 CSmfCredMgrClientSymbian* CSmfCredMgrClientSymbian::NewL(
    33 CSmfCredMgrClientSymbian* CSmfCredMgrClientSymbian::NewL(
   541 	TIpcArgs args;
   540 	TIpcArgs args;
   542 	args.Set(0, &bufPtr);
   541 	args.Set(0, &bufPtr);
   543 
   542 
   544 	iSession.RequestService(ESmfDeleteKeys, args);
   543 	iSession.RequestService(ESmfDeleteKeys, args);
   545 	}
   544 	}
       
   545 
       
   546 TBool CSmfCredMgrClientSymbian::CheckServiceAuthorizationL( const QString& AuthAppId )
       
   547 	{
       
   548 	RDebug::Printf("+In CSmfCredMgrClientSymbian::CheckServiceAuthorizationL()");
       
   549 	
       
   550 	//create buffer to serialize data
       
   551 	HBufC* authAppIdDes = qt_QString2HBufC(AuthAppId);
       
   552 	CleanupStack::PushL(authAppIdDes);
       
   553 	
       
   554 	TPtr authAppIdPtr = authAppIdDes->Des();
       
   555 	TIpcArgs args;
       
   556 	args.Set(0, &authAppIdPtr);
       
   557 	
       
   558 	// to get the data from server, we create a space.
       
   559 	HBufC8* retBuf = HBufC8::NewL(10);
       
   560 	CleanupStack::PushL(retBuf);
       
   561 
       
   562 	TPtr8 outputptr = retBuf->Des();
       
   563 	args.Set(1, &outputptr);
       
   564 
       
   565 	iSession.RequestService(ESmfCheckServiceAuthorization, args);
       
   566 	
       
   567 	TLex8 iLex = TLex8(outputptr);
       
   568 	TBool value = EFalse;
       
   569 	iLex.Val(value);
       
   570 
       
   571 	CleanupStack::PopAndDestroy(retBuf);
       
   572 	CleanupStack::PopAndDestroy(authAppIdDes);
       
   573 
       
   574 	return value;	
       
   575 	}
       
   576 
       
   577 TBool CSmfCredMgrClientSymbian::DeleteAuthDataL( const QString& AuthAppId, const QString& RegToken, 
       
   578 		const QDateTime& Validity )
       
   579 	{
       
   580 	RDebug::Printf("+In DeleteAuthDataL()");
       
   581 	CSmfFetchAuthTokenSet* deleteAuthTokenParams =
       
   582 			new (ELeave) CSmfFetchAuthTokenSet;
       
   583 
       
   584 	CleanupStack::PushL(deleteAuthTokenParams);
       
   585 
       
   586 	//fill the input params
       
   587 	deleteAuthTokenParams->iRegistrationToken = qt_QString2HBufC(RegToken);
       
   588 	deleteAuthTokenParams->iValidity = Validity.toTime_t();
       
   589 
       
   590 	//create buffer to serialize data
       
   591 	CBufFlat* buf = CBufFlat::NewL(KMaxBufSize);
       
   592 	CleanupStack::PushL(buf);
       
   593 	RBufWriteStream stream(*buf);
       
   594 	CleanupClosePushL(stream);
       
   595 
       
   596 	deleteAuthTokenParams->ExternalizeL(stream);
       
   597 	stream.CommitL();
       
   598 
       
   599 	TPtr8 bufPtr = buf->Ptr(0);
       
   600 
       
   601 	TIpcArgs args;
       
   602 	args.Set(0, &bufPtr);
       
   603 	
       
   604 	//create buffer to serialize data
       
   605 	HBufC* authAppIdDes = qt_QString2HBufC(AuthAppId);
       
   606 	CleanupStack::PushL(authAppIdDes);
       
   607 	
       
   608 	TPtr authAppIdPtr = authAppIdDes->Des();
       
   609 	args.Set(1, &authAppIdPtr);
       
   610 	
       
   611 	// to get the data from server, we create a space.
       
   612 	HBufC8* retBuf = HBufC8::NewL(10);
       
   613 	CleanupStack::PushL(retBuf);
       
   614 
       
   615 	TPtr8 outputptr = retBuf->Des();
       
   616 	args.Set(2, &outputptr);
       
   617 
       
   618 	iSession.RequestService(EDeleteAuthData, args);
       
   619 	
       
   620 	TLex8 iLex = TLex8(outputptr);
       
   621 	TBool value = EFalse;
       
   622 	iLex.Val(value);
       
   623 
       
   624 	CleanupStack::PopAndDestroy(retBuf);
       
   625 	CleanupStack::PopAndDestroy(authAppIdDes);
       
   626 	CleanupStack::PopAndDestroy(&stream);
       
   627 	CleanupStack::PopAndDestroy(buf);
       
   628 	CleanupStack::PopAndDestroy(deleteAuthTokenParams);
       
   629 
       
   630 	return value;		
       
   631 	}