|
1 /* |
|
2 * Copyright (c) 2007 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 "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: Reference implementation for ISC Driver extension |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "IscDriverExtensionDevice.h" |
|
23 #include "IscChannel.h" |
|
24 #include "IscTrace.h" |
|
25 #include "kern_priv.h" |
|
26 |
|
27 // EXTERNAL DATA STRUCTURES |
|
28 |
|
29 // EXTERNAL FUNCTION PROTOTYPES |
|
30 |
|
31 // CONSTANTS |
|
32 _LIT( KIscDriverExtensionName,"IscDriverExtension" ); |
|
33 _LIT( KIscDriverName,"IscDriver" ); |
|
34 |
|
35 // MACROS |
|
36 |
|
37 // LOCAL CONSTANTS AND MACROS |
|
38 |
|
39 // MODULE DATA STRUCTURES |
|
40 |
|
41 // LOCAL FUNCTION PROTOTYPES |
|
42 |
|
43 // FORWARD DECLARATIONS |
|
44 |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // DIscDriverExtensionDevice::DIscDriverExtensionDevice |
|
51 // C++ default constructor |
|
52 // ( other items were commented in a header ). |
|
53 // ----------------------------------------------------------------------------- |
|
54 // |
|
55 DIscDriverExtensionDevice::DIscDriverExtensionDevice() |
|
56 : iIscDriverDevice( NULL ) |
|
57 { |
|
58 C_TRACE( ( _T( "DIscDriverExtensionDevice::DIscDriverExtensionDevice()" ) ) ); |
|
59 iParseMask |= KDeviceAllowUnit; |
|
60 iParseMask |= KDeviceAllowInfo; |
|
61 } |
|
62 |
|
63 // Destructor |
|
64 DIscDriverExtensionDevice::~DIscDriverExtensionDevice() |
|
65 { |
|
66 |
|
67 } |
|
68 |
|
69 |
|
70 // ----------------------------------------------------------------------------- |
|
71 // DIscDriverExtensionDevice::Install |
|
72 // Complete the installation of driver |
|
73 // ( other items were commented in a header ). |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 TInt DIscDriverExtensionDevice::Install() |
|
77 { |
|
78 C_TRACE( ( _T( "DIscDriverExtensionDevice::Install()" ) ) ); |
|
79 |
|
80 // Find pointer to ISC Driver. |
|
81 TInt err( KErrNone ); |
|
82 DObjectCon* lDevices = Kern::Containers()[ELogicalDevice]; |
|
83 TKName driverName; |
|
84 |
|
85 ASSERT_RESET_ALWAYS( lDevices, "IscDriverExtension", EIscLogicalDevicesNotFound ); |
|
86 |
|
87 //TInt driverHandle( KErrNone ); // API change in SOS9.2 WK08 |
|
88 TFindHandle driverHandle; |
|
89 err = lDevices->FindByName( driverHandle, KIscDriverName, driverName ); |
|
90 if( KErrNone != err ) |
|
91 { |
|
92 C_TRACE( ( _T( "DIscDriverExtensionDevice::Install() Pointer to IscDriver not found!" ) ) ); |
|
93 ASSERT_RESET_ALWAYS( 0, "IscDriverExtension", EIscDriverNotFound ); |
|
94 } |
|
95 iIscDriverDevice = static_cast<DIscDevice*>( lDevices->At( driverHandle ) ); |
|
96 ASSERT_RESET_ALWAYS( iIscDriverDevice, "IscDriverExtension", EIscDriverNotFound ) |
|
97 return ( SetName( &KIscDriverExtensionName ) ); |
|
98 |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // DIscDevice::Create |
|
103 // Create a logical channel |
|
104 // ( other items were commented in a header ). |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 TInt DIscDriverExtensionDevice::Create( |
|
108 DLogicalChannelBase*& aChannel ) |
|
109 { |
|
110 aChannel=new DIscChannel( iIscDriverDevice ); |
|
111 return aChannel?KErrNone:KErrNoMemory; |
|
112 } |
|
113 |
|
114 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
115 // ----------------------------------------------------------------------------- |
|
116 // E32Dll |
|
117 // Epoc Kernel Architecture 2 style entry point |
|
118 // ( other items were commented in a header ). |
|
119 // ----------------------------------------------------------------------------- |
|
120 // |
|
121 DECLARE_STANDARD_LDD() |
|
122 { |
|
123 DLogicalDevice* device = new DIscDriverExtensionDevice; |
|
124 ASSERT_RESET_ALWAYS( device,"IscDriverExtension",EIscPanicCreateLogicalDevice ); |
|
125 return device; |
|
126 |
|
127 } |
|
128 |
|
129 // End of File |