当前位置: 首页>>代码示例>>C++>>正文


C++ CreateSession函数代码示例

本文整理汇总了C++中CreateSession函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateSession函数的具体用法?C++ CreateSession怎么用?C++ CreateSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CreateSession函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateSession

/**
This function is called by the Child Thread
1.	Create a session with the server
2.	Test an SendReceive call
3.	Informs the main thread about the status of the call using
	a.	iSessionCreated, if the a connection is established
	b.	iResultServer, holds the return value for connection 
	c.	iResultSr, the return value of SendReceive	call
*/
TInt CEASShdOpCodeGetAlarmIdListByState1Step::Exec_SendReceiveL()
	{
	iResultServer = CreateSession(iSrServerName,Version(),KAlarmServerAsynchronousSlotCount);

	if (iResultServer!=KErrNone)
		{
		iResultServer=StartServer();
		if (iResultServer!=KErrNone)
			{
			return(iResultServer);
			}
		iResultServer = CreateSession(iSrServerName,Version(),KAlarmServerAsynchronousSlotCount);
		}
	if(iResultServer == 0)
		{
		iSessionCreated = ETrue;
		if(iSrMessageId >= 0)
			{
			TPckgBuf<TInt> state;
			TPckgBuf<TInt> size;
			iResultSr =	SendReceive(iSrMessageId,TIpcArgs(&state, &size));
			}
		}
	return iResultServer;
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:34,代码来源:EASShdOpCodeGetAlarmIdListByState1_CStep.cpp

示例2: CreateSession

/**
	This Fn is called by the Child Thread
1.	Create a session with the server
2.	Test an SendReceive call
3.	Informs the main thread about the status of the call using
	a.	iSessionCreated, if the a connection is established
	b.	iResult_Server, holds the return value for connection 
	c.	iResult_SR, the return value of SendReceive	call
*/
TInt CRSDbgMarkHeap1Step::Exec_SendReceive()
	{
	iResult_Server = CreateSession(SR_ServerName,Version(),2);

	if (iResult_Server!=KErrNone)
		{
		iResult_Server=StartServer();
		if (iResult_Server!=KErrNone)
			{
			return(iResult_Server);
			}

		iResult_Server = CreateSession(SR_ServerName,TVersion(),2);
		}
		
	if(iResult_Server == 0)
		{
		iSessionCreated = ETrue;
		if(SR_MESSAGE_ID >= 0)
			{
			iResult_SR	=	SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0));
			}
		}

	return iResult_Server;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:35,代码来源:RSDbgMarkHeap1_CStep.cpp

示例3: CreateSession

/**
 Connect to the CLE server with the specified name. If the server is not found, this function will attempt to start it
 and retry connecting to it.
 
@param aServerName The name of the CLE server to connect to
@leave KErrNoMemory if no memory.
@leave One of the system-wide error codes.
*/
void RCleSession::ConnectL(const TDesC& aServerName)
	{
	// Guard against multiple calls.
	if( KNullHandle != iHandle )
		{
		User::Leave( KErrAlreadyExists );
		}

	TInt err = CreateSession(aServerName, iVersion, KCleSrvMsgSlots);
	if( (KErrNotFound == err) || (KErrServerTerminated == err) )
		{
		err = CCleServer::StartCleSrv(aServerName);

		DEBUGPRINT2(_L("Starting CleSrv completed with %d"),err);
		if (KErrNone !=  err && KErrAlreadyExists != err)
			{
			User::Leave(err);
			}

		User::LeaveIfError( CreateSession(aServerName, iVersion, KCleSrvMsgSlots) );
		}
	else
		{
		User::LeaveIfError( err );
		}	
	}	
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:34,代码来源:clecli.cpp

示例4: Exec_SendReceive

/*
Exec_SendReceive():
	This Fn is called by the Child Thread
1.	Create a session with the server
2.	Test an SendReceive call
3.	Informs the main thread about the status of the call using
	a.	iSessionCreated, if the a connection is established
	b.	iResult_Server, holds the return value for connection 
	c.	iResult_SR, the return value of SendReceive	call
*/
TInt CECompactionStatus1Step::Exec_SendReceive()
	{
	iResult_Server = CreateSession(SR_ServerName,Version(),2);

	if (iResult_Server!=KErrNone)
		{

		iResult_Server=StartServer();
		if (iResult_Server!=KErrNone)
			return(iResult_Server);

		iResult_Server = CreateSession(SR_ServerName, Version(),2);
		}
	if(iResult_Server == KErrNone)
		{
		iSessionCreated = ETrue;
		if(SR_MESSAGE_ID >= 0)
			{
			if(SR_MESSAGE_TYPE == KSyncMessage)
				{
				iResult_SR	=	SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0));
				}
			else
				{
				TRequestStatus status;
				SendReceive(SR_MESSAGE_ID,TIpcArgs(0,0,0,0), status);
				iResult_SR = WaitForSomeTimeAndDecide(status);
				}
			}
		}

	return iResult_Server;
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:43,代码来源:ECompactionStatus1_CStep.cpp

示例5: CreateSession

EXPORT_C void RPackagerTestClient::ConnectL()
/** Check and create server process if it is not already running,
then create a server session. Also constructs packager member. */
	{
	// Assume the server is already running and attempt to create a session
	// 4 message slots
	TInt err = CreateSession(KPackagerServerTestName,TVersion(1,1,1),4);
	if(err == KErrNotFound)
		{
		// Server not running
		// Use the RProcess API to start it.
		RProcess server;
		User::LeaveIfError(server.Create(KPackagerServerTestExe,KNullDesC));

		// Synchronise with the server
		TRequestStatus reqStatus;
		server.Rendezvous(reqStatus);
		// Start the test harness
		server.Resume();
		// Server will call the reciprocal static synchronise cal User::WaitForRequest(reqStatus);
		User::WaitForRequest(reqStatus);
		server.Close();
		User::LeaveIfError(reqStatus.Int() != KErrNone);
		// Create the root server session
		User::LeaveIfError(CreateSession(KPackagerServerTestName,TVersion(0,0,0),4));
		}		
		
	iPackager = CCntPackager::NewL();
	}
开发者ID:Esclapion,项目名称:qt-mobility,代码行数:29,代码来源:t_packagertestclient.cpp

示例6: LOGGER_ENTERFN

//------------------------------------------------------------
// RCntParserServer::Connect()
//------------------------------------------------------------
EXPORT_C TInt RCntParserServer::Connect()
	{
	LOGGER_ENTERFN( "RCntParserServer::Connect()" );

	TInt r = KErrNone;

	if( iConnected == ECntParserNotConnected )
		{
		r = CreateSession( KCntParserName, Version(), KDefaultMessageSlots );
		if(r==KErrNone) 
			{
			iConnected=ECntParserConnected;	
			}
		else
			{
			RProcess p;
			TInt err = p.Create(KTxtServer, KNullDesC);
	   		if ( err != KErrNone )
           		{
           		// Loading failed.
           		return err;
           		}
			TRequestStatus status;
			p.Rendezvous( status );
			if( status != KRequestPending )
				{
				p.Kill(0);		// abort startup
				p.Close();
				return KErrGeneral;   // status can be KErrNone: don't return status.Int()
				}
			else
				{
				p.Resume();	// logon OK - start the server
				}
			
			User::WaitForRequest( status );

			if( status != KErrNone )
				{
				p.Close();
				return status.Int();
				}

			r = CreateSession( KCntParserName, Version() );
			if( r == KErrNone )
				{
				iConnected = ECntParserConnected;	
				}
			p.Close();
			}
		}
	else
		{
		r = KErrCouldNotConnect;
		}
	LOGGER_WRITE_1( "RCntParserServer::Connect() : return %d", r );
	return r; 
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:61,代码来源:cntparserclient.cpp

示例7: Helper

void UCreateSessionCallbackProxyAdvanced::Activate()
{
	FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSession"), GEngine->GetWorldFromContextObject(WorldContextObject));
	
	if (PlayerControllerWeakPtr.IsValid() )
		Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());

	if (Helper.OnlineSub != nullptr)
	{
		auto Sessions = Helper.OnlineSub->GetSessionInterface();
		if (Sessions.IsValid())
		{
			CreateCompleteDelegateHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(CreateCompleteDelegate);
			
			FOnlineSessionSettings Settings;
			Settings.NumPublicConnections = NumPublicConnections;
			Settings.bShouldAdvertise = true;
			Settings.bAllowJoinInProgress = true;
			Settings.bIsLANMatch = bUseLAN;
			Settings.bUsesPresence = bUsePresence;
			Settings.bAllowJoinViaPresence = true;
			Settings.bIsDedicated = bDedicatedServer;
			Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
			Settings.bAntiCheatProtected = bAntiCheatProtected;
			Settings.bUsesStats = bUsesStats;
			Settings.bShouldAdvertise = bShouldAdvertise;

			// These are about the only changes over the standard Create Sessions Node
			Settings.bAllowInvites = bAllowInvites;
			
			FOnlineSessionSetting ExtraSetting;
			for (int i = 0; i < ExtraSettings.Num(); i++)
			{
				ExtraSetting.Data = ExtraSettings[i].Data;
				//		ViaOnlineServiceAndPing
				ExtraSetting.AdvertisementType = EOnlineDataAdvertisementType::ViaOnlineService;
				Settings.Settings.Add(ExtraSettings[i].Key, ExtraSetting);
			}
			

			if (PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid())
				Sessions->CreateSession(*Helper.UserID, GameSessionName, Settings);
			else
				Sessions->CreateSession(0, GameSessionName, Settings);

			// OnCreateCompleted will get called, nothing more to do now
			return;
		}
		else
		{
			FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
		}
	}

	// Fail immediately
	OnFailure.Broadcast();
}
开发者ID:eternalst0rm,项目名称:ClashOfBalls,代码行数:57,代码来源:CreateSessionCallbackProxyAdvanced.cpp

示例8: RTSecMgrTraceFunction

TInt RSecMgrSession::Connect()
    {
    RTSecMgrTraceFunction("RSecMgrSession::Connect()") ;
    TInt err(KErrNone);
        // Try to create a Server session
    err = CreateSession ( KSecServerProcessName, Version (),
            KDefaultMessageSlots);

    if ( err != KErrNotFound && err != KErrServerTerminated)
        {
        // KErrNone or unrecoverable error
        if ( err != KErrNone)
            {
#ifdef _DEBUG
            RDebug::Print(KServerStartFailed);
#endif
            }
        
        }
    else
        {
        // Return code was KErrNotFound or KErrServerTerminated.
        // Try to start a new security manager server instance
        TInt retry(KSecSrvClientTryCount);
        while(retry > 0)
            {
            err = StartSecManagerServer ();
            if ( err != KErrNone && err != KErrAlreadyExists)
                {
                // Unrecoverable error
                #ifdef _DEBUG
                            RDebug::Print(KServerStartFailed);
                #endif
                retry = 0;
                }
            else
                {
                err = CreateSession ( KSecServerProcessName, Version (),
                                                KDefaultMessageSlots);
                if(err != KErrNotFound && err != KErrServerTerminated)
                    {
                    if ( err != KErrNone)
                                {
                    #ifdef _DEBUG
                                RDebug::Print(KServerStartFailed);
                    #endif
                                }
                    retry = 0;
                    }
                }
            retry--;
            }
        }       
    return (err);
    }
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:55,代码来源:rtsecmgrclient.cpp

示例9: CreateSession

// ---------------------------------------------------------------------------
// Connect to the notifier server. Start the server if necessary.
// ---------------------------------------------------------------------------
//
EXPORT_C TInt RBTNotifier::Connect()
    {
    TInt err = CreateSession( KBTNotifServerName, Version() );
    if( err == KErrNotFound || err == KErrServerTerminated )
        {
        err = StartBTNotifSrv();
        if( err == KErrNone || err == KErrAlreadyExists )
            {
            err = CreateSession( KBTNotifServerName, Version() );
            }
        }
    return err;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:17,代码来源:btnotifclient.cpp

示例10: _LIT

TInt CPARAM_MESS_NAMEStep::Exec_SendReceive()
	{
	_LIT(KEsockSessStartMutex,"KESSMTX"); //Keep the descriptor short
	RMutex mutex;
	TInt r;
	// Protect the openning of the session
	// with a mutex to stop thread collision
	FOREVER
		{
		r = mutex.CreateGlobal(KEsockSessStartMutex());
		if (r == KErrNone)
			break;
		if (r != KErrAlreadyExists)
			return r;
		r=mutex.OpenGlobal(KEsockSessStartMutex());
		if (r == KErrNone)
			break;
		if (r != KErrNotFound)
			return r;
		}
	mutex.Wait(); // the exclusion ensures the session is started atomically
	iResult_Server=CreateSession(SOCKET_SERVER_NAME,Version());
	// Because ESock is now loaded by the Comms Root Server which is generally started during
	// the boot this should commonly succeed; however for test code this is still a possibility
	// Hence here we try starting it; this is an atomic operation (and cheap if it's already started)
	if (iResult_Server==KErrNotFound)
		{
		r=StartC32();
		if (r==KErrNone || r==KErrAlreadyExists)
			{
			iResult_Server=CreateSession(SOCKET_SERVER_NAME,Version());
			}
		}
	mutex.Signal();
	mutex.Close();

	if (iResult_Server == KErrNone)
		{
		iSessionCreated = ETrue;

		const TInt test_id = dispatch_num<PARAM_MESS_VALUE>::result;

		iResult_SR = do_execute(Int2Type<test_id>());
		}
	else
		{
		iSessionCreated = EFalse;
		return 0;
		}
	return r;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:51,代码来源:CStep.cpp

示例11: CreateSession

EXPORT_C TInt RUpsTestServ::Connect(const TDesC& aServerName, TBool aDebugMode)
/**
 * @param aServerName - Human readable name of the test server
 * @param aDebugMode - Set to true for just in time debugging
 * @return int - Standard error codes
 * Secure version of the API call. Expects the server binary to be
 * ServerXXX.exe
 */
	{
	if(aServerName.Length() > iServerName.MaxLength())
		return KErrTooBig;
	iServerName = aServerName;
	// Assume the server is already running and attempt to create a session
	// 4 message slots
	TInt err = CreateSession(aServerName,Version(),-1);
	if(err == KErrNotFound || err == KErrServerTerminated)
		{
		// Server not running
		// Construct the server binary name
		TBuf<KMaxTestExecuteNameLength> serverFile;
		RProcess server;
		_LIT(KEmpty,"");
		_LIT(KExe,".exe");

		serverFile.Copy(aServerName);
		serverFile.Append(KExe);
		err = server.Create(serverFile,KEmpty);
		if(err != KErrNone)
			return err;
		// Synchronise with the server
		TRequestStatus reqStatus;
		server.Rendezvous(reqStatus);

		// Set just in time debugging for the process
		if(aDebugMode)
			server.SetJustInTime(ETrue);
		else
			server.SetJustInTime(EFalse);

		// Start the test harness
		server.Resume();
		// Server will call the reciprocal static synchronise call
		User::WaitForRequest(reqStatus);
		server.Close();
		if(reqStatus.Int() != KErrNone)
			return reqStatus.Int();
		// Create the root server session
		err = CreateSession(aServerName,Version(),-1);
		}
	return err;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:51,代码来源:tups_clientapi_sysserver.cpp

示例12: __ASSERT_ALWAYS

// ---------------------------------------------------------
// RLbtServer::Connect
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
EXPORT_C TInt RLbtServer::Connect()
	{
 	__ASSERT_ALWAYS(Handle() == 0, User::Panic(KLbtClientPanicCategory, ELbtServerHandleNotClosed));
	
	TRAPD(ret, ConstructL());

	if (ret == KErrNone)
		{
		ret = CreateSession(KLbtServerCoreName, Version(), KDefaultMessageSlots);
		
		if( ret == KErrNotFound )
		    {
		    RProcess lbtServer;
		    ret = lbtServer.Create(KServerCoreProcessName, KNullDesC);
		    
		    if( ret != KErrNone )
		        {
		        lbtServer.Close();
		        return ret;
		        }
		    
		    TRequestStatus status;
		    lbtServer.Rendezvous(status);
		    
		    if( status != KRequestPending )
		        {
		        User::WaitForRequest(status);
		        lbtServer.Kill(KErrNone);
		        lbtServer.Close();
		        return KErrNotFound;
		        }
		    else
		        {
		        lbtServer.Resume();		        
		        }

		    User::WaitForRequest(status);
		    lbtServer.Close();
		    ret = status.Int();

		    if( !( ret == KErrNone || ret == KErrAlreadyExists ) )
		        {
		        return ret;
		        }

		    ret = CreateSession(KLbtServerCoreName, Version(), KDefaultMessageSlots);		    
		    }
        }
	return ret;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw2,代码行数:56,代码来源:lbtserver.cpp

示例13: start

EXPORT_C TInt RMMFAudioPolicyProxy::Open(RServer2& aPolicyServerHandle)
	{
	TServerStart start(aPolicyServerHandle);
	TInt err = KErrNone;
	if(aPolicyServerHandle.Handle())
		{
		// Server is already running and attempt to create a session
		// 4 message slots
		err = CreateSession(aPolicyServerHandle, TVersion(KMMFAudioPolicyVersion,
														KMMFAudioPolicyMinorVersionNumber,
														KMMFAudioPolicyBuildVersionNumber));
		if(err != KErrNone)
			{
			return err;	
			}
		}
	else
		{
		TThreadFunction serverFunc = CMMFAudioPolicyServer::StartThread;
		RThread server;
		err = server.Create(_L(""),serverFunc, KAudioPolicyServerStackSize,
						KAudioPolicyServerInitHeapSize, KAudioPolicyServerMaxHeapSize,
						&start, EOwnerProcess);
		if(err != KErrNone)
			return err;
			// Synchronise with the server
		TRequestStatus reqStatus;
		server.Rendezvous(reqStatus);
		if (reqStatus!=KRequestPending)
			{
			server.Kill(0);
			}
		else 
			{
			// Start the test harness
			server.Resume();
			// Server will call the reciprocal static synchronise call
			}
		User::WaitForRequest(reqStatus); // wait for start or death
		server.Close();
		if(reqStatus.Int() != KErrNone)
			{
			return reqStatus.Int();
			}
		err = CreateSession(aPolicyServerHandle, TVersion(KMMFAudioPolicyVersion,
								 KMMFAudioPolicyMinorVersionNumber,
								 KMMFAudioPolicyBuildVersionNumber));
		}
	return err;		
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:50,代码来源:MmfBtAudioPolicyProxy.cpp

示例14: version

EXPORT_C TInt RTestExecuteLogServ::Connect()
/**
 * @return int - Standard error codes
 * EKA2 all variants and EKA1 target.
 * Server is an exe
 */
	{
	TVersion version(KTestExecuteLoggerMajorVersion,KTestExecuteLoggerMinorVersion,KTestExecuteLoggerBuildVersion);
	// Assume the server is already running and attempt to create a session
	TInt err = CreateSession(KTestExecuteLogServerName,version,8);
	if(err == KErrNotFound)
		{
		// Server not running
		// Construct the server binary name
		_LIT(KEmpty,"");
		// EKA2 is simple
		// No path required
		TBuf<32> serverFile;
		serverFile.Copy(KTestExecuteLogServerName);
		_LIT(KExe,".exe");
		serverFile.Append(KExe);
		RProcess server;
		err = server.Create(serverFile,KEmpty);
		if(err != KErrNone)
			return err;
		// Synchronise with the server
		TRequestStatus reqStatus;
		server.Rendezvous(reqStatus);
		server.Resume();
		// Server will call the reciprocal static synchronise call
		User::WaitForRequest(reqStatus);
		server.Close();
		if(reqStatus.Int() != KErrNone)
			return reqStatus.Int();
		// Create the root server session
		err = CreateSession(KTestExecuteLogServerName,version,8);
		}

#ifdef TEF_SHARE_AUTO
	// Makes the session shared among all threads in the process
  	if( err == KErrNone )
  		{
  		err = ShareAuto();
  		}
#endif

	return err;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:48,代码来源:client.cpp

示例15: CreateSession

// ============================================================================
// RCwrtRegistryClientSession::Connect()
// Connect to widgetregistry server
//
// ============================================================================
//
EXPORT_C TInt RWACRegistryClientSession::Connect()
    {
    TInt startupAttempts = KWACRegistryServerStartupAttempts;

    for ( ;; )
        {
        TInt ret = CreateSession( KWACRegistryName, Version(),
            KWACRegistryServerAsynchronousSlotCount );

        if ( ret != KErrNotFound && ret != KErrServerTerminated )
            {
            return ret;
            }

        if ( startupAttempts-- == 0 )
            {
            return ret;
            }

        ret = StartServer();
        if ( ret != KErrNone && ret != KErrAlreadyExists )
            {
            return ret;
            }
        }
    }
开发者ID:vivekgalatage,项目名称:widgetmanager,代码行数:32,代码来源:CwrtRegistryClient.cpp


注:本文中的CreateSession函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。