sysstatemgmt/systemstatemgr/ssm/src/ssmswppolicycli.cpp
changeset 69 dc67b94625c5
parent 0 4e1aa6a622a0
equal deleted inserted replaced
63:09d657f1ee00 69:dc67b94625c5
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    39 		{
    39 		{
    40 		DEBUGPRINT1(_L("RSsmSwpPolicySession: Client already has a Connected session"));
    40 		DEBUGPRINT1(_L("RSsmSwpPolicySession: Client already has a Connected session"));
    41 		User::Leave(KErrAlreadyExists);
    41 		User::Leave(KErrAlreadyExists);
    42 		}
    42 		}
    43 
    43 
    44 	const TInt err = CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots);
    44 	TInt err = CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots);
    45 	if((KErrNotFound == err) || (KErrServerTerminated == err))
    45 	if((KErrNotFound == err) || (KErrServerTerminated == err))
    46 		{
    46 		{
    47 		User::LeaveIfError(CSsmSwpPolicyServer::StartSsmSwpPolicySrv(KSsmSwpPolicySrvName));
    47 		err = CSsmSwpPolicyServer::StartSsmSwpPolicySrv(KSsmSwpPolicySrvName);
       
    48 
       
    49 		DEBUGPRINT2(_L("Starting SsmSwpPolicySrv completed with %d"),err);
       
    50 		if (KErrNone !=  err && KErrAlreadyExists != err)
       
    51 			{
       
    52 			User::Leave(err);
       
    53 			}
       
    54 
    48 		User::LeaveIfError(CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots));
    55 		User::LeaveIfError(CreateSession(KSsmSwpPolicySrvName, iVersion, KSsmSwpPolicySrvMsgSlots));
    49 		DEBUGPRINT1(_L("RSsmSwpPolicySession Connect Completed with KErrNone"));
    56 		DEBUGPRINT1(_L("RSsmSwpPolicySession Connect Completed with KErrNone"));
    50 		}
    57 		}
    51 	else
    58 	else
    52 		{
    59 		{
    70 	if(KNullHandle != iHandle)
    77 	if(KNullHandle != iHandle)
    71 		{
    78 		{
    72 		User::Leave(KErrAlreadyExists);
    79 		User::Leave(KErrAlreadyExists);
    73 		}
    80 		}
    74 
    81 
    75 	const TInt err = CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots);
    82 	TInt err = CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots);
    76 	if((KErrNotFound == err) || (KErrServerTerminated == err))
    83 	if((KErrNotFound == err) || (KErrServerTerminated == err))
    77 		{
    84 		{
    78 		User::LeaveIfError(CSsmSwpPolicyServer::StartSsmSwpPolicySrv(aServerName));
    85 		err = CSsmSwpPolicyServer::StartSsmSwpPolicySrv(aServerName);
       
    86 
       
    87 		DEBUGPRINT2(_L("Starting SsmSwpPolicySrv completed with %d"),err);
       
    88 		if (KErrNone !=  err && KErrAlreadyExists != err)
       
    89 			{
       
    90 			User::Leave(err);
       
    91 			}
       
    92 		
    79 		User::LeaveIfError(CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots));
    93 		User::LeaveIfError(CreateSession(aServerName, iVersion, KSsmSwpPolicySrvMsgSlots));
    80 		DEBUGPRINT1(_L("RSsmSwpPolicySession Connect Completed with KErrNone"));
    94 		DEBUGPRINT1(_L("RSsmSwpPolicySession Connect Completed with KErrNone"));
    81 		}
    95 		}
    82 	else
    96 	else
    83 		{
    97 		{