/*!
 * The leaving function that queries the SQL database
 * 
 * \a id database id of the contact
 * \return the list of matched contact names
 */
void CntSymbianSrvConnection::readContactsToBufferL(const TDesC& sqlQuery, QueryType aQueryType)
{
    // Initialize connection if it is not initialized yet.
    if (!m_isInitialized) {
        ConnectSrvL();
        OpenDatabaseL();
        m_isInitialized = true;
    }

    TIpcArgs args;
    args.Set(0, &GetReceivingBufferL());
    args.Set(1, &sqlQuery);
    TInt newBuffSize = SendReceive(aQueryType, args);
    User::LeaveIfError(newBuffSize);
    if (newBuffSize > 0) {
        args.Set(0, &GetReceivingBufferL(newBuffSize));
        args.Set(1, &sqlQuery);
        User::LeaveIfError(SendReceive(aQueryType, args));
    }
}
Ejemplo n.º 2
0
// -----------------------------------------------------------------------------
// RSWInstLauncher::SilentInstall
// Launches the silent software install procedure.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
EXPORT_C TInt RSWInstLauncher::SilentInstall( RFile& aFile,
                                              const TDesC8& aOptions )
    {
    __ASSERT_ALWAYS( iConnected, PanicClient( ESWInstPanicBadHandle ) );
    
    TIpcArgs args;
    aFile.TransferToServer( args, KFileHandleIpcSlot, KFileSrvSessionIpcSlot );
    args.Set( KOptionsIpcSlot, &aOptions );    

    return SendReceive( ERequestSilentInstallHandle, args );
    }
Ejemplo n.º 3
0
// ---------------------------------------------------------------------------
// RPeninputServerImpl::SetForeground
// Set current session to be foreground application session
// ---------------------------------------------------------------------------
//
TBool RPeninputServerImpl::SetForeground(TBool aMustConnectFlag)
    {
 //   if(iIsForegroundSession)
 //       return ETrue;
    
    TInt curAppId;
    TRAP_IGNORE( curAppId = GetAppUidByWndGroupIdL(CCoeEnv::Static()->WsSession(),
                        CCoeEnv::Static()->RootWin().Identifier()).iUid);
    TIpcArgs arg;        
    TPckgC<TInt> idData(curAppId);
    arg.Set(KMsgSlot0,&idData); 

    TPckgC<TBool> flagMsg(aMustConnectFlag);    
    arg.Set(KMsgSlot1,&flagMsg); 
    
    TPckg<TInt> retMsg(iIsForegroundSession);
    arg.Set(KMsgSlot2,&retMsg);
    
    SendReceive(EPeninputRequestSetForeground,arg);
    return iIsForegroundSession;
    }
Ejemplo n.º 4
0
// ---------------------------------------------------------------------------
// RPeninputServerImpl::ServerEventDfataNum
// Get the number of server event
// ---------------------------------------------------------------------------
//
TInt RPeninputServerImpl::ServerEventDataNum()
    {  
    TInt num = -1;
    TPckg<TInt> msg(num);
    TIpcArgs arg;
    arg.Set(KMsgSlot0,&msg);
    TInt err = SendReceive(EPeninputRequestGetServerEventDataNumber,arg);
    if(err != KErrNone)
        num = err;//set the error code
    return num;
    
    }
Ejemplo n.º 5
0
// -----------------------------------------------------------------------------
// RMce::SendAppUid
// -----------------------------------------------------------------------------
//
TInt RMce::SendClientUid ( const TUid& aUid ) const
	{
    MCECLI_DEBUG("RMce::SendClientUid, Entry");
	TMceIds ids;
	ids.iAppUID = aUid.iUid;
	
    TPckgBuf<TInt> clientUidPckg( aUid.iUid );
    TPckgBuf<TMceIds> idsPckg( ids );
    TIpcArgs itcMsgArgs;
    
    itcMsgArgs.Set(EMceItcArgIds, &idsPckg);
    itcMsgArgs.Set(EMceItcArgAppUid, &clientUidPckg);

    TInt status = SendReceive ( EMceItcSetAppUid, itcMsgArgs);

    MCECLI_DEBUG_DVALUE("RMce::SendClientUid, Exit. status", status );

	return status;
    
	
	}
Ejemplo n.º 6
0
void RIpcApparcFuzzTest::RunFuzzTestL()
	{
	iTestFuzz.INFO_PRINTF1(_L("Testing appserv APIs GetExecutableNameGivenDataTypeL and AppForDataTypeL  "));	
	TInt ret;
	TVersion version(1,1,1);
	ret = CreateSession(_L("!AppListServer"),version,4);
	iTestFuzz.TEST(ret ==KErrNone);
	HBufC* buf = HBufC::NewLC(268);
	TPtr ptr = buf->Des();
	TIpcArgs args;
	args.Set(0, &ptr);	
	ret = SendReceive(14, args); // Send bad args to CApaAppListServSession::AppForDataTypeL using enum value of EAppListServAppForDataType
	iTestFuzz.TEST(ret ==KErrArgument);
	iTestFuzz.INFO_PRINTF1(_L("Testing CApaAppListServSession::AppForDataTypeL() is completed "));	
	args.Set(2, &ptr);	
	ret = SendReceive(21, args);// Send bad args to CApaAppListServSession::GetExecutableNameGivenDataTypeL using enum value EAppListServGetExecutableNameGivenDocument
	iTestFuzz.TEST(ret ==KErrArgument);
	iTestFuzz.INFO_PRINTF1(_L("Tesing CApaAppListServSession::GetExecutableNameGivenDataTypeL() is completed "));	
	iTestFuzz.INFO_PRINTF2(_L("Test successfully returns KErrArgument %d"),ret);	
	CleanupStack::PopAndDestroy(buf);	
	}
Ejemplo n.º 7
0
TInt RTestApaLsSession::TestExeRecognizerL(const CApaCommandLine& aCommandLine)
	{
	TThreadId dummyThreadId;
	TPckg<TThreadId> threadId(dummyThreadId);
	const TInt opcode=EAppListServStartAppWithoutReturningThreadId;
	TIpcArgs ipcArgs;
	aCommandLine.GetIpcArgsLC(ipcArgs);
	ipcArgs.Set(CApaCommandLine::EIpcFirstFreeSlot, &threadId);
	User::LeaveIfError(SendReceive(opcode, ipcArgs));
	CleanupStack::PopAndDestroy(); // the TIpcArgs
	return KErrNone;
	}
Ejemplo n.º 8
0
void RPeninputServerImpl::SetResourceChange(TBool aFlag)
    {
    iResourceChange = aFlag; 
    
    
    TBool bChange = aFlag;
    TIpcArgs arg;        
    
    TPckg<TBool> msg(bChange);
    arg.Set(KMsgSlot0,&msg);    
    SendReceive(EPeninputRequestDimResChangeLayout,arg);       
    }
// -----------------------------------------------------------------------------
// RUpnpMediaServerClient::SetUploadDirectoryL
// -----------------------------------------------------------------------------
//
EXPORT_C void RUpnpMediaServerClient::SetUploadDirectoryL( const TDesC& aPath,
    TRequestStatus& aStatus )
    {
    CUpnpMediaServerSettings* settings = CUpnpMediaServerSettings::NewL();
    CleanupStack::PushL( settings );
    User::LeaveIfError( settings->Set(UpnpMediaServerSettings::EUploadDirectory, aPath) );
    CleanupStack::PopAndDestroy( settings );

    TIpcArgs args;
    args.Set(0, &aPath);
    SendReceive( EMediaServerSetUploadDirectory, args, aStatus );
    }
Ejemplo n.º 10
0
// -----------------------------------------------------------------------------
// RSWInstLauncher::Install
// Launches the software install procedure.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
EXPORT_C void RSWInstLauncher::Install( TRequestStatus& aReqStatus, 
                                        RFile& aFile,
                                        const TDesC8& aParams )
    {
    __ASSERT_ALWAYS( iConnected, PanicClient( ESWInstPanicBadHandle ) );
    
    TIpcArgs args;
    aFile.TransferToServer( args, KFileHandleIpcSlot, KFileSrvSessionIpcSlot );    
    args.Set( KParamsIpcSlot, &aParams );   

    SendReceive( ERequestInstallParamsHandle, args, aReqStatus );
    }
Ejemplo n.º 11
0
// ---------------------------------------------------------------------------
// RPeninputServerImpl::IsForeground
// Test whether this session is the forground application session
// ---------------------------------------------------------------------------
//
TBool RPeninputServerImpl::IsForeground()
    {
    TBool bIsForeground;
    TIpcArgs arg;        
    
    TPckg<TBool> msg(bIsForeground);
    arg.Set(KMsgSlot0,&msg);    
    SendReceive(EPeninputRequestIsForeground,arg);
    //__ASSERT_DEBUG(bIsForeground == iIsForegroundSession,User::Leave(-1));    
    return bIsForeground;
    
    }
Ejemplo n.º 12
0
// -----------------------------------------------------------------------------
// RWimCertMgmt::CertRefLst()
// Returns certificate list on the WIM
// -----------------------------------------------------------------------------
//
void  RWimCertMgmt::CertRefLst( TCertificateAddressList aCertAddrLst, 
                                TWimCertInfo* aCertInfoArr, 
                                TUint8 aCount, 
                                TWimEntryType aCertEntryType,
                                TRequestStatus& aStatus )
    {
    _WIMTRACE ( _L( "RWimCertMgmt::CertRefLst()" ) );
    aStatus = KRequestPending;
    TInt16 size = ( TInt16 ) ( sizeof ( TCertificateAddress ) * aCount );
    iCertLst.Set( ( TUint8* ) aCertAddrLst, size, size );   

    size = ( TInt16 )( sizeof ( TWimCertInfo ) * aCount );
    iCertInfoLst.Set( ( TUint8* ) aCertInfoArr, size, size ); 
    
    TIpcArgs args;
    args.Set( 0, &iCertLst );
    args.Set( 1, &iCertInfoLst );
    args.Set( 2, aCertEntryType );
    
    SendReceiveData( EGetWIMCertLst, args, aStatus );
    }
Ejemplo n.º 13
0
// ---------------------------------------------------------------------------
// RPeninputServerImpl::GetImePluginIdListL
// Get IME plugin list for a language
// ---------------------------------------------------------------------------
//
void RPeninputServerImpl::GetImePluginIdListL(TInt aLanguage, 
                                                  TInt aPluginMode, 
                                                  RArray<TInt>& aImplmentationIds)
    {
    TInt size = sizeof(TInt) * (KMaxImeImplementations + 1);
	HBufC8* buf = HBufC8::NewLC(size);
	TPtr8 bufPtr = buf->Des();

    TIpcArgs args;
    args.Set(KMsgSlot0, aLanguage);
    args.Set(KMsgSlot1, aPluginMode);
    args.Set(KMsgSlot2, size);
    args.Set(KMsgSlot3, &bufPtr);    
    aImplmentationIds.Reset();
    TInt err = SendReceive(EPenInputRequestGetImePluginIdList,args);
    if( err == KErrNone )
        {
        ReadIntArrayFromBufL(*buf, aImplmentationIds);
        }
    
    CleanupStack::PopAndDestroy(buf);    
    }
Ejemplo n.º 14
0
// -----------------------------------------------------------------------------
// RWimCertMgmt::CertCount()
// Returns count of certificates
// -----------------------------------------------------------------------------
//
TUint8 RWimCertMgmt::CertCount( TWimEntryType aType )
    {
    _WIMTRACE ( _L( "RWimCertMgmt::CertCount()" ) );

    TPckgBuf<TUint8> pckg( 0 );
    
    TIpcArgs args;
    args.Set( 0, &pckg );
    args.Set( 1, aType );
    
    SendReceiveData( EGetCertCount, args );
    return pckg();
    }
Ejemplo n.º 15
0
// -----------------------------------------------------------------------------
// RWimCertMgmt::GetAuthObjsInfo()
// Get Authentication Object information
// -----------------------------------------------------------------------------
//
void RWimCertMgmt::RetrieveAuthObjsInfoL( const RArray<TInt>& aAuthIdList,
                      RArray<TJavaPINParams>& aAuthObjsInfoList,
                      TRequestStatus& aStatus,
                      const TWimServRqst aOpCode )             
    {
    _WIMTRACE ( _L( "RWimCertMgmt::RetrieveAuthObjsInfo" ) );
      
    TInt count = aAuthIdList.Count();
    TInt authIdLength = count * sizeof( TInt );
    TInt authobjLength = count * sizeof( TJavaPINParams ); 
    
    if ( iAuthIdLstPtr == NULL )
	    {
	    iAuthIdLstPtr = new( ELeave )TPtrC8( (TText8*)&aAuthIdList[0], authIdLength );
	    }
    else
        {
        iAuthIdLstPtr->Set( (TText8*)&aAuthIdList[0], authIdLength );
        } 
    
    if ( iAuthObjsInfoLstPtr == NULL )
        {
        iAuthObjsInfoLstPtr = new( ELeave )TPtr8( (TText8*)&aAuthObjsInfoList[0], authobjLength, authobjLength );	
        }
    else
        {
        iAuthObjsInfoLstPtr->Set( (TText8*)&aAuthObjsInfoList[0], authobjLength, authobjLength );	
        }
    
    aStatus = KRequestPending;
    TIpcArgs args;
    
    args.Set( 0, iAuthIdLstPtr );
    args.Set( 1, iAuthObjsInfoLstPtr );
    args.Set( 2, count );
    
    
    SendReceiveData( aOpCode, args, aStatus );
    }
Ejemplo n.º 16
0
// -----------------------------------------------------------------------------
// RWimCertMgmt::RemoveL() 
// Removes a certificate from WIM
// -----------------------------------------------------------------------------
//
void RWimCertMgmt::RemoveL( TWimCertRemoveAddr aWimCertRemoveAddr,
                            TRequestStatus& aStatus )
    {
    _WIMTRACE ( _L( "RWimCertMgmt::RemoveL()" ) );
    aStatus = KRequestPending;
    iPckgBufRemoveCert = new( ELeave ) 
        CWimCertPckgBuf<TWimCertRemoveAddr>( aWimCertRemoveAddr );
    iPckgBufRemoveCertAllocated = ETrue;
    
    TIpcArgs args;
    args.Set( 0, iPckgBufRemoveCert->PckgBuf() );
    
    SendReceiveData( ERemoveCertificate, args, aStatus );
    }
// ---------------------------------------------------------------------------
// CPresenceCacheClient::PresenceInfoLC()
// ---------------------------------------------------------------------------
//    
MPresenceInfo* CPresenceCacheClient::PresenceInfoLC(const MXIMPIdentity& aIdentity)
    {
    CPresenceInfoImp* presInfo(NULL);
    
    if(!ValidateXspId(aIdentity.Identity()))
        return presInfo;
    
    TInt sizeOfPresInfo(0);
    TPckgBuf<TInt> sizePckg;
    
    HBufC8* myIdPack = PackIdentityLC(aIdentity);                
                      
    // Package message arguments before sending to the server
    TIpcArgs args;
    args.Set(1, myIdPack);
    args.Set(2, &sizePckg);    
        
    // We will get either size(+ve) or error code(+ve) after this call
    TInt err = SendReceive( NRequest::EPrepReadPresenceInfoSync, args );
    sizeOfPresInfo = sizePckg();
    
    CleanupStack::PopAndDestroy(myIdPack);
    
    if(sizeOfPresInfo && (err==KErrNone)) // If found
        {
        presInfo = CPresenceInfoImp::NewLC();    
        HBufC8* presInfoDes = HBufC8::NewLC(sizeOfPresInfo);                        
        TPtr8 ptrBuf( presInfoDes->Des() );                        
                               
        SendReceive( NRequest::EGetLastPreparedPacket, TIpcArgs(&ptrBuf) );
        
        TXIMPObjectPacker< CPresenceInfoImp >::UnPackL( *presInfo, *presInfoDes );
        CleanupStack::PopAndDestroy(presInfoDes);
        }
    
    return presInfo;
    }
void CDisplayDependencyWarning::MarshallArgumentsL(TIpcArgs& aArguments)
	{
	*iStream << iAppInfo;
	*iStream << iDependencyName;
	*iStream << TPckg<TBool>(iWantedFromValid);
	if (iWantedFromValid)
		{
		*iStream << TPckg<TVersion>(iWantedFrom);
		}
	*iStream << TPckg<TBool>(iWantedToValid);
	if (iWantedToValid)
		{
		*iStream << TPckg<TVersion>(iWantedTo);
		}
	*iStream << TPckg<TBool>(iAvailableValid);
	if (iAvailableValid)
		{
		*iStream << TPckg<TVersion>(iAvailable);
		}

	iIpcInputPtr.Set(iStream->Ptr());
	aArguments.Set(0, &iIpcInputPtr);
	aArguments.Set(1, &iResultPackage);
	}
Ejemplo n.º 19
0
// ---------------------------------------------------------
// RFavouritesBuf::Open
// ---------------------------------------------------------
//
TInt RFavouritesBuf::Open
( RFavouritesHandle& aHandle, TInt aFunction, TIpcArgs& aArgs )
    {
    iBuf.iLen = 0;
	SetBuf( ERead | EWrite, iBuf.iData, iBuf.iData );   // Initially empty.
    TPckg<TFavouritesBuf> buf( iBuf );
    aArgs.Set( 3, &buf );
    TInt err = RFavouritesHandle::Open( aHandle, aFunction, aArgs );
    if ( !err && iBuf.iLen > 0 )
        {
        // If aFunction provided data, it is already here.
        SetEnd( ERead, iBuf.iData + iBuf.iLen );
        }
    return err;
    }
Ejemplo n.º 20
0
// ---------------------------------------------------------------------------
// RXIMPSrvRootClient::GetDataL()
// ---------------------------------------------------------------------------
//
HBufC8* RXIMPSrvRootClient::GetDataL( TInt aMsg )
    {
    TInt bufSize = SendReceive( aMsg );
    User::LeaveIfError( bufSize );

    HBufC8* buf = HBufC8::NewLC( bufSize );
    TPtr8 ptrBuf( buf->Des() );

    TIpcArgs msgArgs;
    msgArgs.Set( 0, &ptrBuf );

    User::LeaveIfError( SendReceive( NRequest::ERootSsFetchServerSideData, msgArgs ) );

    CleanupStack::Pop( buf );
    return buf;
    }
Ejemplo n.º 21
0
void RIpcServerCloseTest::RunTestL(const TDesC& aTargetSrvName, TInt aNumber, TInt aArgCount)
	{
	TVersion version(0,0,0);
	TInt err = KErrNotFound;
	TInt numberOfAttempts = 3;
	
	while(err!=KErrNone && numberOfAttempts>0)
		{
		err = CreateSession(aTargetSrvName, version, 200);

		if(err!=KErrNone)
			{
			// wait then try again if err!=0
			TheTest.Printf(_L("CreateSession returned: %d"), err);
			User::After(1000000);
			numberOfAttempts--;
			}
		}
	
	TheTest(err == KErrNone);
	
	HBufC8* buf = HBufC8::NewLC(255);
	TPtr8 ptr = buf->Des();
	ptr.Fill(Math::Random(),255);
		
	TIpcArgs args;
		
	for(TInt i = 0; i < aArgCount ;i++)
		{
		args.Set(i,&ptr);
		}
	
	TheTest.Printf(_L("Sending request to: %d with %d args"), aNumber, aArgCount);
	
	TRequestStatus status;
	
	SendReceive(aNumber, args, status);
	
	User::WaitForRequest(status);
	
	TheTest.Printf(_L("Status value from sending request: %d with %d args"), status.Int(), aArgCount);
	
	TheTest(status.Int() == KErrNotSupported);

	CleanupStack::PopAndDestroy(buf);
	}
EXPORT_C TInt RUpsTestSession::GetServerSid()
/**
 *
 * @return aPanicString  - If the test step panics, this member is set up with the panic string
 */
 	{
 	
 	TPckgBuf<TInt> sidBuf;
 	TInt returnServerSid;
 	TIpcArgs args;
 	args.Set(0,&sidBuf);
 	
	SendReceive(EUpsTest_GetServerSid , args);
	
 	returnServerSid=sidBuf(); 

	return returnServerSid;
	}     
Ejemplo n.º 23
0
/**
Writes file names using IPC args along with data related to TWsClCmdRegisterEffect
Out going phase animation file name is sent in second slot of IPC to server
In coming phase animation file name is sent in third slot of IPC to server
Data related to TWsClCmdRegisterEffect and folder name are sent in the normal wserv buffer

@param aForRegister an object of TWsClCmdRegisterEffect filled with data related to RegisterTFXEffect
					If non Empty then this function is called for Register effect
@param aForOverride an object of TWsClCmdOverrideEffect filled with data related to OverrideTFXEffect
					If non Empty then this function is called for Overide effect					 
@param aResourceDir directory name of animation description file
@param aFilenameOutgoing File name of Outgoing phase of TFX
@param aFilenameIncoming File name of Incoming phase of TFX
@param aCalledFrom value from TFXEffect enum reprseting whether called from RWsSession or RWindowbase 	
*/
void RTFXEffect::WriteDataUsingIPC(TWsClCmdRegisterEffect* aForRegister, TWsClCmdOverrideEffect* aForOverride, 
		const TFileName& aResourceDir, const TFileName& aFilenameOutgoing, const TFileName& aFilenameIncoming, TFXEffect aCalledFrom)
	{
	TIpcArgs ipcArgsDesc;
	ipcArgsDesc.Set(1, &aFilenameOutgoing);
	ipcArgsDesc.Set(2, &aFilenameIncoming);
	// If called for RegisterTFXEffect
	if (aForRegister)
		{
		Write(aForRegister, sizeof(*aForRegister), aResourceDir.Ptr(), aResourceDir.Size(), 
				EWsClOpRegisterTFXEffectIPC, &ipcArgsDesc);
		}
	else	// Else called for OverrideTFXEffect
		{
		Write(aForOverride, sizeof(*aForOverride), aResourceDir.Ptr(), aResourceDir.Size(), 
				(aCalledFrom == ETFXSession ? EWsClOpOverrideEffectIPC : EWsWinOpOverrideEffectIPC), &ipcArgsDesc);
		}
	}
Ejemplo n.º 24
0
TInt RSubSessionBase::DoCreateSubSession(RSessionBase& aSession,TInt aFunction,const TIpcArgs* aArgs, TBool aAutoClose)
	{
	TIpcArgs a;
	if (aArgs!=NULL)
		{
		a.iArgs[0] = aArgs->iArgs[0];
		a.iArgs[1] = aArgs->iArgs[1];
		a.iArgs[2] = aArgs->iArgs[2];
		a.iFlags = aArgs->iFlags;
		}
	TPckgBuf<TInt> reply;
	a.Set(3,&reply);
	TInt r=aSession.SendReceive(aFunction,a);
	if (r==KErrNone)
		{
		iSubSessionHandle=reply();
		if (aAutoClose)
			{
			iSession=aSession;
			// set the caller's session handle to NULL to discourage the caller from closing it.
			aSession.SetHandle(KNullHandle);
			}
		else
			{
			// Set session handle with 'no close' set, to prevent CloseSubSession() 
			// from closing down the session
			iSession.SetHandleNC(aSession.Handle());
			}
		}
	else
		{
		iSubSessionHandle=0;
		iSession.SetHandle(KNullHandle);
		// Close the caller's session so it isn't left orphaned
		if (aAutoClose)
			aSession.Close();
		}
	return(r);
	}
Ejemplo n.º 25
0
TInt RIpcFuzzTest::Fuzz(TInt aMsg, TInt aArgCount)
	{
	TIpcArgs args;
	
	for(TInt i = 0; i < aArgCount;i++)
		{
		args.Set(i,Math::Random());
		}	
	
	TInt ret;
	
	if(IsFunctionAsynchronous(aMsg))
		{
		ret = Send(aMsg, args);
		User::After(KAsynchDelay);
		}
	else
		{
		ret = SendReceive(aMsg, args);
		}
	return ret;
	}
Ejemplo n.º 26
0
void RTestExecuteLogServ::WriteL(TDes8& aLogBuffer)
/**
 * @param aLogBuffer - pre-formatted narrow buffer
 * 
 * Synchronous write to the server
 */
	{
	_LIT8(KEnd,"\r\n");
	// Check to see if there's room to add CRLF
	if(aLogBuffer.Length()+2 > aLogBuffer.MaxLength())
		{
		HBufC8* buffer = NULL;
		TRAPD(err, buffer=HBufC8::NewL(aLogBuffer.Length()+2));
		if (KErrNoMemory == err)
			{
			aLogBuffer.Replace(aLogBuffer.Length()-2, 2, KEnd);
			TIpcArgs args;
			args.Set(0,&aLogBuffer);
			args.Set(1,aLogBuffer.Length());
			User::LeaveIfError(SendReceive(EWriteLog,args));
			}
		else
			{
			CleanupStack::PushL(buffer);
			TPtr8 ptr(buffer->Des());
			ptr.Copy(aLogBuffer);
			ptr.Append(KEnd);
			TIpcArgs args;
			args.Set(0,&ptr);
			args.Set(1,ptr.Length());
			User::LeaveIfError(SendReceive(EWriteLog,args));
			CleanupStack::PopAndDestroy(buffer);
			}
		}
	else
		{
		aLogBuffer.Append(KEnd);
		TIpcArgs args;
		args.Set(0,&aLogBuffer);
		args.Set(1,aLogBuffer.Length());
		User::LeaveIfError(SendReceive(EWriteLog,args));
		}
	}
/*!
 * Open database
 */
void CntSymbianSrvConnection::OpenDatabaseL()
{
    TIpcArgs args;
    args.Set(0, &KNullDesC);
    User::LeaveIfError(SendReceive(KCntOpenDataBase, args));
}
Ejemplo n.º 28
0
QString CSmfCredMgrClientSymbian::storeAuthDataL(SmfAuthParams Set,
		QDateTime Validity, QList<QUrl> URLList, QStringList PluginList,
		QString AuthAppAID, bool Flag)
	{
	RDebug::Printf("+In storeAuthDataL()");
	CSmfStoreAuthParams* authenticationProcessData =
			new (ELeave) CSmfStoreAuthParams;
	CleanupStack::PushL(authenticationProcessData);

	//create space for iRegistrationToken
	authenticationProcessData->iRegistrationToken = HBufC::NewL(
			KMaxRegistrationTokenLength);


	//fill the input params
	smfcredmgrclientutil::SmfAuthParamstoRArray(Set,
			authenticationProcessData->iAuthTokenArray);
	authenticationProcessData->pluginIDEnabled = Flag;
	//set iValidity
	authenticationProcessData->iValidity = Validity.toTime_t();


	//set authappid
	authenticationProcessData->iAuthAppID = qt_QString2HBufC(AuthAppAID);
	//set the lists
	authenticationProcessData->iURLList
			= smfcredmgrclientutil::convertToSymbianURLList(URLList);
	authenticationProcessData->iPluginIDList
			= smfcredmgrclientutil::convertToSymbianPluginList(
					PluginList);

	//create buffer to serialize data
	CBufFlat* buf = CBufFlat::NewL(KMaxBufSize);
	CleanupStack::PushL(buf);
	RBufWriteStream stream(*buf);
	CleanupClosePushL(stream);

	authenticationProcessData->ExternalizeL(stream);
	stream.CommitL();

	TPtr8 bufPtr = buf->Ptr(0);

	TIpcArgs args;
	args.Set(0, &bufPtr);

	
	// to get the data from server, we create a space.
	HBufC8* retBuf = HBufC8::NewL(KMaxBufSize);
	CleanupStack::PushL(retBuf);

	TPtr8 outputptr = retBuf->Des();
	args.Set(1, &outputptr);

	iSession.RequestService(EStoreAuthData, args);

	//create buffer to read data received
	RBuf8 dataBuf;
	CleanupClosePushL(dataBuf);
	dataBuf.Create(outputptr);

	authenticationProcessData->InternalizeL(dataBuf);

	TPtr regTokenPtr(
			authenticationProcessData->iRegistrationToken->Des());

	//convert and return
	QString regString = qt_TDes2QString( regTokenPtr );

	CleanupStack::PopAndDestroy(&dataBuf);
	CleanupStack::PopAndDestroy(retBuf);
	CleanupStack::PopAndDestroy(&stream);
	CleanupStack::PopAndDestroy(buf);
	CleanupStack::Pop();

	return regString;
	}
Ejemplo n.º 29
0
TBool CSmfCredMgrClientSymbian::AuthDataSetL(QString RegToken,
		QDateTime Validity, SmfAuthParams& AuthTokenSet)
	{
	RDebug::Printf("+In AuthDataSetL()");
	CSmfFetchAuthTokenSet* fetchAuthTokenSetParams =
			new (ELeave) CSmfFetchAuthTokenSet;

	CleanupStack::PushL(fetchAuthTokenSetParams);

	//fill the input params
	fetchAuthTokenSetParams->iRegistrationToken = qt_QString2HBufC(RegToken);
	fetchAuthTokenSetParams->iValidity = Validity.toTime_t();

	//create buffer to serialize data
	CBufFlat* buf = CBufFlat::NewL(KMaxBufSize);
	CleanupStack::PushL(buf);
	RBufWriteStream stream(*buf);
	CleanupClosePushL(stream);

	fetchAuthTokenSetParams->ExternalizeL(stream);
	stream.CommitL();

	TPtr8 bufPtr = buf->Ptr(0);

	TIpcArgs args;
	args.Set(0, &bufPtr);

	// to get the data from server, we create a space.
	HBufC8* retBuf = HBufC8::NewL(KMaxBufSize);
	CleanupStack::PushL(retBuf);

	TPtr8 outputptr = retBuf->Des();
	args.Set(1, &outputptr);

	iSession.RequestService(ESendAuthDataSet, args);

	//create buffer to read data sent by server
	RBuf8 dataBuf;
	CleanupClosePushL(dataBuf);
	dataBuf.Create(outputptr);

	fetchAuthTokenSetParams->InternalizeL(dataBuf);


	CleanupStack::PopAndDestroy(&dataBuf);
	CleanupStack::PopAndDestroy(retBuf);
	CleanupStack::PopAndDestroy(&stream);
	CleanupStack::PopAndDestroy(buf);

	//return EFalse if count is 0
	if (fetchAuthTokenSetParams->iAuthTokenArray.Count() == 0)
		{
		CleanupStack::PopAndDestroy(fetchAuthTokenSetParams);
		RDebug::Printf("-In AuthDataSetL()");
		return EFalse;
		}

	smfcredmgrclientutil::RArrayToSmfAuthParams(
			fetchAuthTokenSetParams->iAuthTokenArray, AuthTokenSet);


	CleanupStack::PopAndDestroy(fetchAuthTokenSetParams);
	RDebug::Printf("-In AuthDataSetL()");
	return ETrue;
	}
Ejemplo n.º 30
0
// ---------------------------------------------------------------------------
// RPeninputServerImpl::DoConnectL
// ---------------------------------------------------------------------------
//
TInt RPeninputServerImpl::DoConnectL()
    { 
    TInt error = KErrNone;
    /*************** Note ************************************************/
    // Multi-thread case is not considered here!
    /*************** Note ************************************************/        
    
     // try to connect to the server
    error = CreateSession( KPeninputServerName,
                           Version(),
                           KDefaultMessageSlots,EIpcSession_Sharable);

    if( error == KErrNotFound || error == KErrServerTerminated )
        {
        // server does not yet exist or it has terminated
        // try to create the server
        error = StartThreadL();

        if ( error == KErrNone || error == KErrAlreadyExists )
            {
            // creation of server successfull, or some other client thread 
            // created it first -> try to connect again
            error = CreateSession( KPeninputServerName,
                           Version(),
                           KDefaultMessageSlots );
            }
        else
            {
            return error;
            }
        }

    TThreadId srvThreadId;
    if(KErrNone == error)
        {
        TIpcArgs arg;        
    
        TPckg<TThreadId> msg(srvThreadId);
        arg.Set(KMsgSlot0,&msg);    
        SendReceive(EPeninputRequestServerThreadId,arg);
        }
    
    iServerExit = EFalse;
	//create default observer
    /*CPeninputServerObserver* observer = CPeninputServerObserver::NewL(this,
                                                       srvThreadId,iObserver);*/
    if(iObserver)
        {
        iObserver->ReConstructL(srvThreadId);
        }
    else
        {
        iObserver = CPeninputServerObserver::NewL(this,srvThreadId);
        }

    
    TFindThread findPeninputServer( _L("*peninputserver*") );
    TFullName name;
    if (findPeninputServer.Next( name ) == KErrNone)
        {
        // if server is already running return immediately
        //return KErrAlreadyExists;
        RThread p;
        TInt r = p.Open(name);
        p.Close();
        } 
    
    return error;
    }