author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 14 May 2010 17:13:29 +0300 | |
changeset 109 | b3a1d9898418 |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32test\window\t_mmcpw.cpp |
|
15 |
// Tests MMC card password notifier |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include <e32svr.h> |
|
20 |
||
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#define __E32TEST_EXTENSION__ |
0 | 22 |
#include <e32test.h> |
23 |
#include <e32twin.h> |
|
24 |
#include <e32def.h> |
|
25 |
#include <e32def_private.h> |
|
26 |
#include <e32std.h> |
|
27 |
#include <e32std_private.h> |
|
28 |
||
29 |
static RTest test(_L("T_MMCPW")); |
|
30 |
||
31 |
GLDEF_C TInt E32Main() |
|
32 |
{ |
|
33 |
test.Start(_L("E32Main")); |
|
34 |
||
35 |
test.Next(_L("Creating notifier.")); |
|
36 |
RNotifier n; |
|
37 |
||
38 |
test.Next(_L("Connected to notify server.")); |
|
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
39 |
TInt r = n.Connect(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
test_KErrNone(r); |
0 | 41 |
|
42 |
TPckgBuf<TMediaPswdSendNotifyInfoV1> send; |
|
43 |
send().iVersion = TVersion(1, 0, 0); |
|
44 |
TPckgBuf<TMediaPswdReplyNotifyInfoV1> reply; |
|
45 |
reply().iVersion = TVersion(1, 0, 0); |
|
46 |
||
47 |
test.Next(_L("Launching notify server.")); |
|
48 |
TRequestStatus rs; |
|
49 |
n.StartNotifierAndGetResponse(rs, TUid::Uid(KMediaPasswordNotifyUid), send, reply); |
|
50 |
||
51 |
test.Next(_L("Waiting for dialog to respond.")); |
|
52 |
User::WaitForRequest(rs); |
|
53 |
||
54 |
test.Next(_L("Reading exit mode and resultant password.")); |
|
55 |
test(reply().iEM == EMPEMUnlock || reply().iEM == EMPEMCancel || reply().iEM == EMPEMUnlockAndStore); |
|
56 |
test.Printf(_L("reply().iEM = %d(d).\n"), TInt(reply().iEM)); |
|
57 |
||
58 |
switch (reply().iEM) |
|
59 |
{ |
|
60 |
case EMPEMUnlock: |
|
61 |
case EMPEMUnlockAndStore: |
|
62 |
{ |
|
63 |
if (reply().iEM == EMPEMUnlock) |
|
64 |
test.Printf(_L("EMPEMUnlock selected.\n")); |
|
65 |
else |
|
66 |
test.Printf(_L("EMPEMUnlockAndStore selected.\n")); |
|
67 |
||
68 |
TMediaPassword pw; |
|
69 |
pw.Copy(reply().iPW, KMaxMediaPassword); |
|
70 |
||
71 |
TInt i; // bad for-scope under VC |
|
72 |
||
73 |
for (i = 0; i < KMaxMediaPassword; i++) |
|
74 |
test.Printf(_L("%02x "), pw[i]); |
|
75 |
test.Printf(_L("\n")); |
|
76 |
||
77 |
for (i = 0; i < KMaxMediaPassword; i++) |
|
78 |
test.Printf(_L("%02x "), i); |
|
79 |
test.Printf(_L("\n")); |
|
80 |
} |
|
81 |
break; |
|
82 |
||
83 |
case EMPEMCancel: |
|
84 |
test.Printf(_L("EMPEMCancel selected.\n")); |
|
85 |
break; |
|
86 |
} |
|
87 |
||
88 |
test.Next(_L("Closing notifier.")); |
|
89 |
n.Close(); |
|
90 |
||
91 |
test.Getch(); |
|
92 |
||
93 |
test.End(); |
|
94 |
||
95 |
return KErrNone; |
|
96 |
} |
|
97 |