|
1 // Copyright (c) 1997-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 "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 // |
|
15 |
|
16 #include <c32comm.h> |
|
17 #include "TOBEXCON.H" |
|
18 |
|
19 #ifdef __EPOC32__ |
|
20 #define FIR_PDD_NAME _L("DIFIR") // Brutus FIR PDD |
|
21 #define FIR_LDD_NAME _L("EFIR") // Brutus FIR LDD |
|
22 #endif |
|
23 |
|
24 #ifdef __WINS__ |
|
25 _LIT(KWinsPddName,"ecdrv"); |
|
26 _LIT(KWinsLddName,"ecomm"); |
|
27 #endif //__WINS__ |
|
28 |
|
29 void RunAppL(void) |
|
30 { |
|
31 // Construct and install the active scheduler |
|
32 CActiveScheduler *exampleScheduler = new (ELeave) CActiveScheduler(); |
|
33 // Push onto the cleanup stack |
|
34 CleanupStack::PushL(exampleScheduler); |
|
35 // Install as the active scheduler |
|
36 CActiveScheduler::Install(exampleScheduler); |
|
37 //Create Obex objects and console handler |
|
38 CConsoleBase* aConsole = |
|
39 //Console::NewL(_L("OBEX DLL Test Code"),TSize(20,10)); |
|
40 Console::NewL(_L("OBEX DLL Test Code"),TSize(KConsFullScreen,KConsFullScreen)); |
|
41 // Load Device drivers |
|
42 |
|
43 #ifdef __EPOC32__ |
|
44 TInt ret1; |
|
45 aConsole->Printf(_L("Loading C32...\n")); |
|
46 ret1=StartC32(); |
|
47 if (ret1!=KErrNone && ret1!=KErrAlreadyExists) |
|
48 aConsole->Printf(_L(" Failed %d\n"), ret1); |
|
49 else |
|
50 aConsole->Printf(_L(" Sucess\n")); |
|
51 #endif |
|
52 #ifdef __WINS__ |
|
53 User::LoadLogicalDevice(KWinsLddName); |
|
54 User::LoadPhysicalDevice(KWinsPddName); |
|
55 #endif //__WINS__ |
|
56 |
|
57 #ifdef __EPOC32__ |
|
58 TInt ret2; |
|
59 |
|
60 aConsole->Printf(_L("Loading Fast IR PDD\n")); |
|
61 |
|
62 ret2=User::LoadPhysicalDevice(FIR_PDD_NAME); |
|
63 if (ret2!=KErrNone && ret2!=KErrAlreadyExists) |
|
64 aConsole->Printf(_L(" Failed %d\n"), ret2); |
|
65 else |
|
66 aConsole->Printf(_L(" Sucess\n")); |
|
67 |
|
68 aConsole->Printf(_L("Loading Fast IR LDD\n")); |
|
69 ret2=User::LoadLogicalDevice(FIR_LDD_NAME); |
|
70 if (ret2!=KErrNone && ret2!=KErrAlreadyExists) |
|
71 aConsole->Printf(_L(" Failed %d\n"), ret2); |
|
72 else |
|
73 aConsole->Printf(_L(" Success\n")); |
|
74 #endif |
|
75 |
|
76 CleanupStack::PushL(aConsole); |
|
77 CActiveConsole* my_console = CActiveConsole::NewLC(aConsole); |
|
78 my_console->RequestCharacter(); |
|
79 CActiveScheduler::Start(); |
|
80 CleanupStack::PopAndDestroy(3); |
|
81 } |
|
82 |
|
83 TInt E32Main() |
|
84 { |
|
85 __UHEAP_MARK; |
|
86 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack |
|
87 TRAPD(error,RunAppL()); // more initialization, then do example |
|
88 __ASSERT_ALWAYS(!error,User::Panic(_L("TOBEX"),error)); |
|
89 delete cleanup; // destroy clean-up stack |
|
90 __UHEAP_MARKEND; |
|
91 |
|
92 return 0; // and return |
|
93 } |