void CalFileVersionUtils::FileVersionSupportedL(const TAgnVersion& aFileVersion, CalCommon::TCalFileVersionSupport& aStatus) { if ( aFileVersion == CurrentFileVersion() || aFileVersion == TAgnVersion(TVersion(KMajorVersionNumber, KMinorVersionNumber, KBuildCompatibleVersion))) { // The the file was created by an agenda model // of the current version // aStatus = CalCommon::EFileIsCurrentVersion; } else { RArray<TAgnVersion> supportedFileVersions; CleanupClosePushL(supportedFileVersions); supportedFileVersions.AppendL(TAgnVersion(TVersion(KMajorVersionNumber, KOldMinorVersionNumber, KOldBuildV94))); supportedFileVersions.AppendL(TAgnVersion(TVersion(KMajorVersionNumber, KOldMinorVersionNumber, KOldBuildV92))); supportedFileVersions.AppendL(TAgnVersion(TVersion(KMajorVersionNumber, KOldMinorVersionNumber, KOldBuildV91))); // The file version is not current but if it is in the // list of versions supported by this agenda model it can // be converted to current version. // aStatus = CalCommon::EUnsupportedFileVersion; for ( TInt i = 0; i < supportedFileVersions.Count(); ++i ) { if ( supportedFileVersions[i] == aFileVersion ) { aStatus = CalCommon::EFileNeedsConverting; break; } } CleanupStack::PopAndDestroy(&supportedFileVersions); } }
CAgnCalendarConverter* CalFileVersionUtils::CreateConverterL(const TAgnVersion& aFileVersion, CAgnServFile& aAgnServerFile) /** @internalComponent */ { CAgnCalendarConverter* converter = NULL; if (aFileVersion == TAgnVersion(TVersion(KMajorVersionNumber, KOldMinorVersionNumber, KOldBuildV91))) { // file format 1.1.209 used in 9.1 converter = CAgnCalendarConverter209::NewL(aAgnServerFile); } else if (aFileVersion == TAgnVersion(TVersion(KMajorVersionNumber, KOldMinorVersionNumber, KOldBuildV92))) { // file format 1.1.210 used in 9.2 converter = CAgnCalendarConverter210::NewL(aAgnServerFile); } else if (aFileVersion == TAgnVersion(TVersion(KMajorVersionNumber, KOldMinorVersionNumber, KOldBuildV94))) { // file format 1.1.211 used in 9.4 compacted file version converter = CAgnCalendarConverter211::NewL(aAgnServerFile); } else if (aFileVersion == CurrentFileVersion() ) { converter = NULL; } else { User::Leave(KErrNotSupported); } return converter; }
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(); }
//--------------------------------------------------------------------------- void TData::Import(const std::wstring &FileName) { if(std::_waccess(FileName.c_str(), 0)) throw EGraphError(LoadRes(RES_FILE_NOT_FOUND, FileName)); TConfigFile ConfigFile; ConfigFile.LoadFromUtf8File(FileName); std::wstring SavedByVersion = ConfigFile.Section(L"Graph").Read(L"Version", L"NA"); if(SavedByVersion == L"NA") throw EGraphError(LoadRes(RES_NOT_GRAPH_FILE, FileName)); if(TVersion(SavedByVersion) <= L"2.4") throw EGraphError(LoadRes(RES_INVALID_VERSION, SavedByVersion, L"2.5")); try { if(SavedByVersion < TVersion(L"4.4.0.414")) ConfigFile.LoadFromAnsiFile(FileName); Import(ConfigFile); } catch(Func32::EFuncError &Error) { throw; } catch(...) { throw EGraphError(LoadRes(RES_ERROR_READING_FILE, FileName)); } }
// ----------------------------------------------------------------------------- // CPhoneMediatorSender::SendEvent // ----------------------------------------------------------------------------- // EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, TPhoneCommandParam& aCommandParam ) { switch( aCommandId ) { case EPhoneViewActivateMuteUIChanges: { TPhoneCmdParamBoolean& booleanParam = static_cast<TPhoneCmdParamBoolean&>( aCommandParam ); const TBool audioMute( booleanParam.Boolean() ); TInt response = KErrNone; TInt command = -1; if( audioMute ) { __PHONELOG( EBasic, EPhoneMediatorCenter, "CPhoneMediatorSender::SendEvent - transformed to Mediator Command EVtCmdMute" ); command = EVtCmdMute; response = IssueCommand( KMediatorVideoTelephonyDomain, KCatPhoneToVideotelCommands, command, TVersion( KPhoneToVideotelCmdVersionMajor, KPhoneToVideotelCmdVersionMinor, KPhoneToVideotelCmdVersionBuild ), KNullDesC8 ); } else { __PHONELOG( EBasic, EPhoneMediatorCenter, "CPhoneMediatorSender::SendEvent - transformed to Mediator Command EVtCmdUnmute" ); command = EVtCmdUnmute; response = IssueCommand( KMediatorVideoTelephonyDomain, KCatPhoneToVideotelCommands, command, TVersion( KPhoneToVideotelCmdVersionMajor, KPhoneToVideotelCmdVersionMinor, KPhoneToVideotelCmdVersionBuild ), KNullDesC8 ); } if( ( response == KErrInUse ) && ( iCommandBuffer.iCommandId == KErrNotFound ) ) { // Previous command wasn't handled yet so buffer the last unhandled command. // This command will be sent after we get response to the previous command iCommandBuffer.iCommandId = command; iCommandBuffer.iDomainUid = KMediatorVideoTelephonyDomain; iCommandBuffer.iCategoryUid = KCatPhoneToVideotelCommands; iCommandBuffer.iVersion = TVersion( KPhoneToVideotelCmdVersionMajor, KPhoneToVideotelCmdVersionMinor, KPhoneToVideotelCmdVersionBuild ); } } break; default: break; } }
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; }
TInt RSignalSession::Connect() { TInt retry = 2; // A maximum of two iterations of the loop required for(;;) { TInt r = CreateSession(KServerName,TVersion(KIpcServerMajorVersionNumber, KIpcServerMinorVersionNumber, KIpcServerBuildVersionNumber), -1, EIpcSession_Sharable); if ( (KErrNotFound != r) && (KErrServerTerminated != r) ) { return r; } if ( --retry == 0 ) { return r; } r = StartServer(); if ( (KErrNone != r) && (KErrAlreadyExists != r) ) { return r; } } }
LOCAL_C void baseRomImage() // // Set base addresses for the ROM image. // { test.Start(_L("Setting up the header")); Mem::FillZ(&TheRomHeader,sizeof(TRomHeader)); test.Printf(_L("1")); TheRomHeader.iVersion=TVersion(1,0,1); test.Printf(_L("2")); TTime t; t.HomeTime(); test.Printf(_L("3")); TheRomHeader.iTime=t.Int64(); test.Printf(_L("4")); TheRomHeader.iRomBase=UserSvr::RomHeaderAddress(); test.Printf(_L("5")); TheRomHeader.iRomRootDirectoryList=TheCurrentBase=UserSvr::RomHeaderAddress()+sizeof(TRomHeader); test.Printf(_L("6")); // test.Next(_L("Set dirs base")); TheRootDir->SetBaseDirs(); // test.Next(_L("Set files base")); TheRootDir->SetBaseFiles(); TheRomHeader.iRomSize=TheCurrentBase-UserSvr::RomHeaderAddress(); // test.End(); }
/**--------------------------------------------------------- * * Connect() * * Opens a session to EventMediator server and starts the server if it * not yet started * * Returns: KErrNone: OK * value: error * *----------------------------------------------------------*/ EXPORT_C TInt REventMediator::Connect(void) { TInt ret = KErrNone; TRAP(ret, CreateListenedEventsListL()); if (ret != KErrNone) { return ret; } TInt retry=2; for (;;) { TInt r=CreateSession(KEventMediatorServer, TVersion(KEventMediatorMajorVersionNumber, KEventMediatorMinorVersionNumber, KEventMediatorBuildVersionNumber), 2 * KDefaultMessageSlots); if (r!=KErrNotFound && r!=KErrServerTerminated) return r; if (--retry==0) return r; r = Launcher::LaunchServer(KEventMediatorServer, KEventMediatorFile, KEventMediatorUid3); if (r!=KErrNone && r!=KErrAlreadyExists) return r; } }
// --------------------------------------------------------------------------- // This function connects to DUN server and creates a new session. // --------------------------------------------------------------------------- // TInt RDun::Connect() { FTRACE(FPrint( _L("RDun::Connect()") )); TInt retry; TInt retVal = KErrNone; for ( retry=KDunRetryCount; retry>=0; retry-- ) { retVal=CreateSession( KDialupServerName, TVersion(KDunServerMajorVersionNumber, KDunServerMinorVersionNumber, KDunServerBuildVersionNumber), KDunNumOfMessageSlots ); if ( retVal == KErrNotFound || retVal == KErrServerTerminated ) { retVal = StartServer(); if ( retVal!=KErrNone && retVal!=KErrAlreadyExists ) { FTRACE(FPrint( _L("RDun::Connect() complete (%d)"), retVal )); return retVal; } } else // KErrNone, or other error code. { FTRACE(FPrint( _L("RDun::Connect() complete (%d)"), retVal )); return retVal; } } FTRACE(FPrint( _L("RDun::Connect() complete (%d)"), retVal )); return retVal; }
// ----------------------------------------------------------------------------- // RHssInterface::Version // Needed only when activating the server. // ----------------------------------------------------------------------------- // TVersion RHssInterface::Version() const { return( TVersion( KHotSpotMajorVersionNumber, KHotSpotMinorVersionNumber, KHotSpotBuildVersionNumber ) ); }
// // DTrkXtiDriverFactory::Install // void DTrkXtiDriverFactory::GetCaps(TDes8& aDes) const { TCapsTrkXtiDriver b; b.iVersion = TVersion(KMajorXtiVersionNumber, KMinorXtiVersionNumber, KBuildXtiVersionNumber); Kern::InfoCopy(aDes,(TUint8*)&b, sizeof(b)); }
/** Logical device constructor. This is called while creating the LDD factory object as a part of the driver (LDD) loading. */ DExDriverLogicalDevice::DExDriverLogicalDevice() { // Set iParseMask to KDeviceAllowPhysicalDevice to tell the kernel // that this driver supports a PDD. Based on this flag value, kernel // will search for a matching PDD to load. KDeviceAllowUnit can be set // to make driver support multiple units. KDeviceAllowInfo can also be // set if driver wants to use device info. // iParseMask = KDeviceAllowPhysicalDevice | KDeviceAllowUnit; // LDD is not deciding which units have to be supported. PDD defines // which units are supported by setting iUnitsMask in physical device. // Hence, mask is set to 0xffffffff here. // iUnitsMask=KUartUnitMaskLdd; // Set the version of the interface supported by this LDD, that consists // of driver major number, device minor number and build version number. // It will normally be incremented if the interface changes.Validating // code assumes that clients requesting older versions will be OK with // a newer version, but clients requesting newer versions will not want // an old version. // iVersion = TVersion(KExLddMajorVerNum,KExLddMinorVerNum,KExLddBuildVerNum); }
void CProtocolExaout::Describe(TServerProtocolDesc& anEntry) /** * Return the description of the protocol. * * Becauses this example does not provide the socket service (SAP), * most of the fields in the description can be set to zero. Only * the following need to be initialized to something specific: * * - iName The name of the protocol ("exain"). * - iAddrFamily The address family of the protocol (KAfExain). * - iProtocol The protocol number (KProtocolExain). */ { /** @code */ anEntry.iName=_S("exaout"); anEntry.iAddrFamily=KAfExaout; anEntry.iSockType=0; anEntry.iProtocol=KProtocolExaout; anEntry.iVersion=TVersion(1, 0, 0); anEntry.iByteOrder=EBigEndian; anEntry.iServiceInfo=0; anEntry.iNamingServices=0; anEntry.iSecurity=0; anEntry.iMessageSize=0; anEntry.iServiceTypeInfo=0; anEntry.iNumSockets=0; /** @endcode */ }
/* ---------------------------------------------------------------------------------------- // This is the standard retry pattern for server connection ---------------------------------------------------------------------------------------- */ TInt RExampleServerClient::Connect() { TInt retry=2; for (;;) { TInt r=CreateSession(KCrashServerName, TVersion(SServMajorVersionNumber, SServMinorVersionNumber, SServBuildVersionNumber) ,1); if (r!=KErrNotFound && r!=KErrServerTerminated) { return r; } if (--retry==0) { return r; } r=StartServer(); if (r!=KErrNone && r!=KErrAlreadyExists) { return r; } } }
// ----------------------------------------------------------------------------- // CPhoneMediatorSender::SendEvent // ----------------------------------------------------------------------------- // EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, const TInt aCallId ) const { switch( aCommandId ) { case EPhoneViewRemoveCallHeader: { __PHONELOG1( EBasic, EPhoneMediatorCenter, "CPhoneMediatorSender::SendEvent - EPhoneEventCallData iCallId:%d" ,aCallId ); TTelephonyCallDataParam callDataParam; callDataParam.iCallId = aCallId; callDataParam.iCallState = ECallStateIdle; TTelephonyCallDataParamPackage callDataParamPackage( callDataParam ); iEventSender->RaiseEvent( KMediatorTelephonyDomain, KCatEventsFromTelephony, EPhoneEventCallData, TVersion( KTelephonyEventsVersionMajor, KTelephonyEventsVersionMinor, KTelephonyEventsVersionBuild ), callDataParamPackage ); } break; default: break; } }
// --------------------------------------------------------- // TVersion RSCPClient::Version() // Constructs a TVersion object containing the defined version // numbers, and returns it // // Status : Approved // --------------------------------------------------------- // EXPORT_C TVersion RSCPClient::Version() const { Dprint( (_L("<--> RSCPClient::Version()") )); return( TVersion( KSCPServMajorVersionNumber, KSCPServMinorVersionNumber, KSCPServBuildVersionNumber ) ); }
// --------------------------------------------------------------------------- // Connect() // // Connect to CertProvisionInfoServer // --------------------------------------------------------------------------- // TInt RInfoServerClient::Connect() { BTIC_TRACE_PRINT("[CInfoServerClient] Connect --->"); TInt retry( 2 ); for (;;) { TInt status = CreateSession( KBTICCertProvInfoServer, TVersion( 0, 0, 0 ), 1 ); if ( ( status != KErrNotFound ) && ( status != KErrServerTerminated ) ) { return status; } if ( --retry == 0 ) { return status; } status = StartServer(); if ( ( status != KErrNone ) && ( status != KErrAlreadyExists ) ) { return status; } } }
// ----------------------------------------------------------------------------- // CPhoneMediatorSender::SendEvent // ----------------------------------------------------------------------------- // EXPORT_C void CPhoneMediatorSender::SendEvent( const TPhoneViewCommandId aCommandId, const TInt aCallId, TPhoneCommandParam& aCommandParam ) const { switch( aCommandId ) { case EPhoneViewCreateCallHeader: { TPhoneCmdParamCallHeaderData& callHeaderParam = static_cast<TPhoneCmdParamCallHeaderData&>( aCommandParam ); __PHONELOG2( EBasic, EPhoneMediatorCenter, "CPhoneMediatorSender::SendEvent - EPhoneEventCallData iCallId:%d iCLIText:%S", aCallId, &callHeaderParam.CLIText() ); TTelephonyCallDataParam callDataParam; callDataParam.iCallId = aCallId; callDataParam.iCLIText = callHeaderParam.CLIText(); callDataParam.iCallState = MapCallState( callHeaderParam.CallState() ); callDataParam.iRemotePhoneNumber = callHeaderParam.RemotePhoneNumber(); callDataParam.iCallType = MapCallType( callHeaderParam.CallType() ); TTelephonyCallDataParamPackage callDataParamPackage( callDataParam ); iEventSender->RaiseEvent( KMediatorTelephonyDomain, KCatEventsFromTelephony, EPhoneEventCallData, TVersion( KTelephonyEventsVersionMajor, KTelephonyEventsVersionMinor, KTelephonyEventsVersionBuild ), callDataParamPackage ); } break; default: break; } }
void CSimpleIf::FillInInfo(TNifIfInfo& aInfo) { aInfo.iVersion = TVersion(1,1,1); aInfo.iFlags = KNifIfIsBase | KNifIfUsesNotify | KNifIfCreatedByLink; aInfo.iName = _L("simpleif"); aInfo.iProtocolSupported=0; }
CSession2* CMdSServer::NewSessionL( const TVersion& aVersion, const RMessage2& /*aMessage*/ ) const { // Check we are the right version if ( !User::QueryVersionSupported( TVersion( KMdSServMajorVersionNumber, KMdSServMinorVersionNumber, KMdSServBuildVersionNumber ), aVersion ) ) { User::Leave( KErrNotSupported ); } if ( iShutdownObserver->UpdateInProgress() ) { __LOGLB( ELogAlways, "CMdSServer::NewSessionL: iad update in progress: KErrLocked"); User::Leave(KErrLocked); } if ( iServerErrorStatus != KErrNone ) { // leave with the same error code that the server has User::Leave ( iServerErrorStatus ); } __LOGLB( ELogAlways, "New Session" ); // Make new session return CMdSServerSession::NewL( *const_cast<CMdSServer*> ( this ) ); }
// ----------------------------------------------------------------------------- // RMediatorServer::CancelCommand // Cancels ongoing command in Mediator // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt RMediatorServer::CancelCommand( TUid aDomain, TUid aCategory, TInt aCommandId ) { LOG(_L("[Mediator Server]\t RMediatorServer::CancelCommand\n")); // Check that session is open. __ASSERT_DEBUG( Handle(), User::Panic( KMediatorServerPanic, EMediatorClientNoSessionActive )); // Fill category TMediatorCategory category; category.iDomain = aDomain; category.iCategory = aCategory; TMediatorCategoryBuffer categoryBuffer( category ); // And command TCommand command; command.iCommandId = aCommandId; //All the remaining parameters of TCommand are initiatilized to 0 as its not used on the server side. //this is just to suppress the tool warnings. command.iVersion = TVersion(0,0,0); command.iCaps.SetEmpty(); command.iTimeout = 0; TCommandBuffer commandBuffer( command ); // Send the command return SendReceive( ECancelCommand, TIpcArgs( &categoryBuffer, &commandBuffer ) ); }
CSharableSession* CAlmSettingsServer::NewSessionL(const TVersion& aVersion) const { if(!User::QueryVersionSupported(TVersion(KSettingsServerMajorVersionNumber,KSettingsServerMinorVersionNumber,KSettingsServerBuildVersionNumber),aVersion)) User::Leave(KErrNotSupported); RThread client=Message().Client(); return CAlmSettingsSession::NewL(client,*const_cast<CAlmSettingsServer*>(this)); }
EXPORT_C TInt RFTokenClient::Connect() { TInt err = KErrNone; TFindServer serveFinder(FTOKEN_SERVER_NAME); TFullName fullName; if (serveFinder.Next(fullName) != KErrNone) { const TUidType serverUid(KNullUid,KNullUid,KServerUid3); RProcess server; err = server.Create(_L("Z:\\sys\\bin\\!ftokenserver.exe"),FTOKEN_SERVER_NAME,serverUid); if (!err) { TRequestStatus stat; server.Rendezvous(stat); if (stat!=KRequestPending) { server.Kill(0); // abort startup } else { server.Resume(); // logon OK - start the server } User::WaitForRequest(stat); // wait for start or death err = stat.Int(); } } if ( !err ) { err = CreateSession(FTOKEN_SERVER_NAME,TVersion(1,1,1)); } return err; }
EXPORT_C TInt RClassControllerClient::Connect() { TInt retry = 2; FOREVER { //Create Session, With server name from shared header //And lowest version number of the server with which this client is compatible. //Number of message slots available, -1 for meessages from global free pool TInt err = CreateSession(KServerName, TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber), KMessageSlots); if ((err != KErrNotFound) && (err != KErrServerTerminated)) { return err; } if (--retry == 0) { return err; } err = StartServer(); if ((err != KErrNone) && (err != KErrAlreadyExists)) { return err; } } }
DBmOmap::DBmOmap() // // Constructor // { //iUnitsMask=0; iVersion = TVersion(1,0,1); // place requirement on xor clock TResourceMgr::Request(KPowerArmEn_XorpCk); // Stop timer TOmap::ModifyRegister32(KGPTimerBase + KHoGpTimer_TCLR, KHtGpTimer_TCLR_St, KClear32); //Stop the timer // Drive this gptimer by the arm xor clock TOmapPlat::ModifyConfigReg(KHoBaseConfMOD_CONF_CTRL1, KGPTimerClkSel, 0); // Prescale enable = 12/4 = 3MHz TOmap::ModifyRegister32(KGPTimerBase + KHoGpTimer_TCLR, (KHmGpTimer_TCLR_PTV), (1 << KHsGpTimer_TCLR_PTV | KHtGpTimer_TCLR_PRE) ); // Enable "smart Idle mode" TOmap::SetRegister32(KGPTimerBase + KHoGpTimerTIOCP_CFG, (KHtGpTimer_TIOCP_CFG_SmartIdle << KHsGpTimer_TIOCP_CFG_IdleMode)); // Load TimerLoad register to zero so when overflow occurs the counter starts from zero again. TOmap::SetRegister32(KGPTimerBase + KHoGpTimer_TLDR, 0x0); // Load Timer Trig register which clears the prescale counter and loads the value in TLDR to TCRR TOmap::SetRegister32(KGPTimerBase + KHoGpTimer_TTGR, 0x1); // Start the GPTimer. This configuration will pause counting when stopped by the jtag TOmap::ModifyRegister32(KGPTimerBase + KHoGpTimer_TCLR, KClear32, (KHtGpTimer_TCLR_St|KHtGpTimer_TCLR_AR|KHtGpTimer_TCLR_CE)); while(TOmap::Register32(KGPTimerBase + KHoGpTimer_TWPS)); }
/** 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 CRSDbgMbufFreeSpace1Step::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; }
/* 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 CECntRequestEvent1Step::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) { HBufC8 *buf = NULL; TRAPD(err, buf = HBufC8::NewL(1000) ); TEST(err == KErrNone); TPtr8 ptr = buf->Des(); iResult_SR = SendReceive(SR_MESSAGE_ID,TIpcArgs(&ptr,666,0,0)); delete buf; } } return iResult_Server; }
EXPORT_C TInt RLbsLocMonitorSession::Connect() { const TInt KNumAttempts = 200; TInt retry = KNumAttempts; _LIT(KLocMonServerName,"testLocMonitorServer"); // TInt testcase, propRead; propRead = iTestSessionKey.Get(KLocSrvTestSuite, KLbsLocMonitorTestSessionKey,testcase); // Get the value of the location server test case to alter the behaviour // of this test location monitor if (propRead==KErrNone) { switch(testcase) { case EClearDBLocMonitorOpenSessionFail: // The test case where the creation of a session with the location monitor fails return KErrServerTerminated; break; default: break; } } TRAPD(ret, CreateTimerL()); if (KErrNone==ret) { for (;;) // FOREVER { ret = CreateSession(KLocMonServerName, TVersion(0,0,0),12); if ( (ret != KErrNotFound) && (ret != KErrServerTerminated)) { return ret; } if (--retry == 0) { return ret; } ret = StartServer(); if ( (ret != KErrAlreadyExists) && (ret != KErrNone) ) { return ret; } } } else { return ret; } }
EXPORT_C TVersion RConsole::Version() // // Return the client side version number. // { return TVersion(KW32MajorVersionNumber,KW32MinorVersionNumber,KE32BuildVersionNumber); }