1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32test.h> |
|
19 #include <e32debug.h> |
|
20 #include <d32ethernet.h> |
|
21 |
|
22 LOCAL_D RTest test(_L("DRIVER1_TEST")); |
|
23 |
|
24 _LIT(KDriver1LddFileName,"enet"); |
|
25 _LIT(KDriver1PddFileName,"ethernet"); |
|
26 |
|
27 _LIT8(KTestSendData,"abcdefghijklmnopqrstuvwxyz"); |
|
28 _LIT8(KTestLargeSendData,"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); |
|
29 |
|
30 GLDEF_C TInt E32Main() |
|
31 { |
|
32 test.Title(); |
|
33 |
|
34 TInt r; |
|
35 RDebug::Printf(">>>>>>E32Main()"); |
|
36 |
|
37 test.Start(_L("Load Physical Device")); |
|
38 r=User::LoadPhysicalDevice(KDriver1PddFileName); |
|
39 if (r != KErrNone) |
|
40 RDebug::Printf("LoadPhysicalDevice: value of error =%d", r); |
|
41 test(r==KErrNone || r==KErrAlreadyExists); |
|
42 |
|
43 test.Next(_L("Load Logical Device")); |
|
44 r=User::LoadLogicalDevice(KDriver1LddFileName); |
|
45 if (r != KErrNone) |
|
46 RDebug::Printf("LoadLogicalDevice: value of error =%d", r); |
|
47 test(r==KErrNone || r==KErrAlreadyExists); |
|
48 |
|
49 __KHEAP_MARK; |
|
50 |
|
51 test.Next(_L("Open Logical Channel")); |
|
52 RBusDevEthernet ldd; |
|
53 |
|
54 r=ldd.Open(0); |
|
55 RDebug::Printf("Value returned from ldd.Open()=%d", r); |
|
56 test(r==KErrNone); |
|
57 |
|
58 test.Next(_L("SendData")); |
|
59 TRequestStatus status; |
|
60 ldd.Write(status,KTestSendData); |
|
61 |
|
62 test.Next(_L("SendDataCancel")); |
|
63 ldd.WriteCancel(); |
|
64 User::WaitForRequest(status); |
|
65 r=status.Int(); |
|
66 //test(r==KErrCancel); |
|
67 |
|
68 test.Next(_L("SendData")); |
|
69 ldd.Write(status,KTestSendData); |
|
70 User::WaitForRequest(status); |
|
71 r=status.Int(); |
|
72 //test(r==KErrNone); |
|
73 |
|
74 test.Next(_L("ReceiveData")); |
|
75 TBuf8<256> buffer; |
|
76 ldd.Read(status,buffer); |
|
77 |
|
78 test.Next(_L("ReceiveDataCancel")); |
|
79 ldd.ReadCancel(); |
|
80 User::WaitForRequest(status); |
|
81 r=status.Int(); |
|
82 test(r==KErrCancel); |
|
83 |
|
84 test.Next(_L("Close Logical Channel")); |
|
85 ldd.Close(); |
|
86 |
|
87 __KHEAP_MARKEND; |
|
88 |
|
89 test.End(); |
|
90 |
|
91 return(0); |
|
92 |
|
93 } |
|
94 |
|
95 |
|