devicemgmtnotifications/dmdevdialogclient/src/dmdevdialogclient.cpp
author hgs
Fri, 15 Oct 2010 11:46:45 +0530
changeset 73 ae69c2e8bc34
parent 51 2e64dc50f295
permissions -rw-r--r--
201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     1
/*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     3
* All rights reserved.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     8
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    11
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    12
* Contributors:
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    13
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    14
* Description: Implementation of fotaserver component
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    15
* 	This is part of fotaapplication.
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    16
*
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    17
*/
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    18
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    19
#include <dmdevdialogclient.h>
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    20
#include "dmdevdialogclientserver.h"
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    21
#include "dmdevdialogclientdebug.h"
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    22
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    23
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    24
// StartServerL()  
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    25
// Starts DM device Dialog server
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    26
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    27
TInt StartServerL()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    28
	{
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    29
	FLOG(_L("StartServerLt Started"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    30
	TInt res = KErrNone;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    31
	RProcess server;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    32
	res=server.Create(KDMDEVDIALOGSERVER,KNullDesC);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    33
	FLOG(_L("StartServerL-- create server error as %d"),res);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    34
	if (res!=KErrNone)
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    35
		{		
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    36
		return res;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    37
		}
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    38
	TRequestStatus stat;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    39
	server.Rendezvous(stat);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    40
	if (stat!=KRequestPending)
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    41
		server.Kill(0);		// abort startup
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    42
	else
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    43
		server.Resume();	// logon OK - start the server
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    44
	User::WaitForRequest(stat);		// wait for start or death
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    45
	res=(server.ExitType()==EExitPanic) ? KErrGeneral : stat.Int();
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    46
	FLOG(_L("StartServerL-- server.ExitType() returns %d"),res);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    47
	server.Close();
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    48
	return res;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    49
	}
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    50
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    51
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    52
// RDmDevDialog::OpenL()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    53
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    54
EXPORT_C TInt RDmDevDialog::OpenL()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    55
	{	
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    56
	FLOG(_L("RDmDevDialog::OpenL()- Begin"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    57
	TInt res = KErrNone;
73
hgs
parents: 51
diff changeset
    58
	FLOG(_L("RDmDevDialog::OpenL()- Secured client"));		
hgs
parents: 51
diff changeset
    59
	const int maxRetry(4);
hgs
parents: 51
diff changeset
    60
	TInt retry = maxRetry;
hgs
parents: 51
diff changeset
    61
	do {
hgs
parents: 51
diff changeset
    62
        res = CreateSession( KDMDEVDIALOGSERVER,TVersion(KDmDevDialogServerVersionMajor,
51
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    63
		        KDmDevDialogServerVersionMinor,0),KDefaultMessageSlots );
73
hgs
parents: 51
diff changeset
    64
        if (KErrNotFound != res && KErrServerTerminated != res) {
hgs
parents: 51
diff changeset
    65
            retry =0;
hgs
parents: 51
diff changeset
    66
        } else {
hgs
parents: 51
diff changeset
    67
            TRAP(res, StartServerL());
hgs
parents: 51
diff changeset
    68
            if (KErrNone == res || KErrAlreadyExists == res) {
hgs
parents: 51
diff changeset
    69
                retry =0;
hgs
parents: 51
diff changeset
    70
                res = CreateSession( KDMDEVDIALOGSERVER,TVersion(KDmDevDialogServerVersionMajor,
51
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    71
	                KDmDevDialogServerVersionMinor,0),KDefaultMessageSlots );
73
hgs
parents: 51
diff changeset
    72
            }
hgs
parents: 51
diff changeset
    73
        }
hgs
parents: 51
diff changeset
    74
    } while (--retry > 0);
hgs
parents: 51
diff changeset
    75
	User::LeaveIfError( res );		
51
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    76
	FLOG(_L("RDmDevDialog::OpenL()- End %d"),res);	
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    77
	return res;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    78
	}
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    79
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    80
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    81
// RDmDevDialog::Close()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    82
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    83
EXPORT_C void RDmDevDialog::Close()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    84
	{
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    85
    FLOG(_L(" RDmDevDialog::Close"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    86
	RSessionBase::Close();
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    87
	}
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    88
	
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    89
// ----------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    90
// RDmDevDialog::LaunchPkgZeroL()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    91
// ----------------------------------------------------------------------------	
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    92
EXPORT_C void RDmDevDialog::LaunchPkgZero(const TInt& aProfileId, 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    93
        const TInt& ajobId, const TInt& aUimode, 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    94
        TDes8& aResponse, TRequestStatus& aStatus )
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    95
	{		
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    96
    FLOG(_L(" RDmDevDialog::LaunchPkgZero--Begin"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    97
    SendReceive( EServerAlert, TIpcArgs(aProfileId,ajobId,aUimode,&aResponse),
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    98
            aStatus);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
    99
    FLOG(_L(" RDmDevDialog::LaunchPkgZero end "));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   100
	}
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   101
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   102
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   103
// RDmDevDialog::IsPkgZeroConnectNoteShown() 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   104
// ---------------------------------------------------------------------------  
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   105
EXPORT_C TInt RDmDevDialog::IsPkgZeroConnectNoteShown(TInt& aConectNoteShown)
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   106
    {
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   107
    FLOG(_L(" RDmDevDialog::IsPkgZeroConnectNoteShown--Begin"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   108
    TPckgBuf<TInt> result(aConectNoteShown);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   109
    TInt err = SendReceive( EPkgConnectNoteIsActive,TIpcArgs(&result));    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   110
    aConectNoteShown = result();
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   111
    FLOG(_L(" RDmDevDialog::IsPkgZeroConnectNoteShown--End as %d,%d"),err,
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   112
            aConectNoteShown);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   113
    return err;    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   114
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   115
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   116
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   117
// RDmDevDialog::DismissConnectDialog() 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   118
// --------------------------------------------------------------------------- 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   119
EXPORT_C TInt RDmDevDialog::DismissConnectDialog()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   120
    {
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   121
    FLOG(_L(" RDmDevDialog::DismissConnectDialog--Begin"));    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   122
    TInt err = SendReceive( EPkgZeroConnectNoteDismiss,TIpcArgs());        
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   123
    FLOG(_L(" RDmDevDialog::DismissConnectDialog--End as %d,%d"),err);    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   124
		return err;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   125
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   126
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   127
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   128
// RDmDevDialog::ShowConnectDialog() 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   129
// --------------------------------------------------------------------------- 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   130
EXPORT_C TInt RDmDevDialog::ShowConnectDialog()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   131
    {
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   132
    FLOG(_L(" RDmDevDialog::ShowConnectDialog--Begin"));    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   133
    TInt err = SendReceive( EPkgZeroConnectNoteShowAgain,TIpcArgs());        
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   134
    FLOG(_L(" RDmDevDialog::ShowConnectDialog--error is %d"),err);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   135
    return err;    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   136
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   137
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   138
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   139
// RDmDevDialog::ShowDisplayAlert() 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   140
// --------------------------------------------------------------------------- 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   141
EXPORT_C void RDmDevDialog::ShowDisplayAlert(const TDesC& aNoteDisplayText,
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   142
            TRequestStatus& aStatus)
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   143
    {
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   144
    FLOG(_L(" RDmDevDialog::ShowDisplayAlert--Begin"));      
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   145
    SendReceive( EShowDisplayAlert,TIpcArgs(&aNoteDisplayText),aStatus);        
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   146
    FLOG(_L(" RDmDevDialog::ShowDisplayAlert end" ));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   147
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   148
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   149
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   150
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   151
// RDmDevDialog::ShowConfirmationAlert() 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   152
// --------------------------------------------------------------------------- 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   153
EXPORT_C void RDmDevDialog::ShowConfirmationAlert(const TInt& aTimeout,
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   154
        const TDesC& aNoteHeader, const TDesC& aNoteDisplayText, 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   155
        TRequestStatus& aStatus)
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   156
    {
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   157
    FLOG(_L(" RDmDevDialog::ShowConfirmationAlert--Begin"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   158
    SendReceive( EShowConfirmationalert,TIpcArgs(aTimeout,&aNoteHeader,
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   159
            &aNoteDisplayText),aStatus);
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   160
    FLOG(_L(" RDmDevDialog::ShowConfirmationAlert--End "));    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   161
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   162
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   163
// ---------------------------------------------------------------------------
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   164
// RDmDevDialog::CancelPkgZeroNote() 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   165
// --------------------------------------------------------------------------- 
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   166
EXPORT_C TInt RDmDevDialog::CancelPkgZeroNote()
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   167
    {
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   168
    FLOG(_L(" RDmDevDialog::CancelPkgZeroNote--Begin"));
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   169
    TInt err = SendReceive(ECancelServerAlert, TIpcArgs());    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   170
    FLOG(_L(" RDmDevDialog::CancelPkgZeroNote--End "));    
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   171
    return err;
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   172
    }
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   173
2e64dc50f295 201025_02
hgs
parents:
diff changeset
   174
//End of file