|
1 // Copyright (c) 2008-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 /** |
|
17 @internalComponent |
|
18 */ |
|
19 |
|
20 #include <ecom/implementationproxy.h> |
|
21 |
|
22 #include "cptpiptransport.h" |
|
23 #include "cptpipconnection.h" |
|
24 #include "mmtpconnectionmgr.h" |
|
25 #include "ptpippanic.h" |
|
26 |
|
27 __FLOG_STMT(_LIT8(KComponent,"PTPIPTransport");) |
|
28 |
|
29 /** |
|
30 PTPIP transport plug-in factory method. |
|
31 @return A pointer to a PTP IP transport plug-in. Ownership IS transfered. |
|
32 @leave One of the system wide error codes, if a processing failure occurs. |
|
33 */ |
|
34 TAny* CPTPIPTransport::NewL(TAny* aParameter) |
|
35 { |
|
36 if ( aParameter != NULL ) |
|
37 { |
|
38 User::Leave(KErrArgument); |
|
39 } |
|
40 |
|
41 CPTPIPTransport* self = new (ELeave) CPTPIPTransport; |
|
42 CleanupStack::PushL(self); |
|
43 self->ConstructL(); |
|
44 CleanupStack::Pop(self); |
|
45 return self; |
|
46 } |
|
47 |
|
48 |
|
49 |
|
50 /** |
|
51 Destructor |
|
52 */ |
|
53 CPTPIPTransport::~CPTPIPTransport() |
|
54 { |
|
55 __FLOG(_L8("~Destructor - Entry")); |
|
56 delete iConnection; |
|
57 __FLOG(_L8("~Destructor - Exit")); |
|
58 __FLOG_CLOSE; |
|
59 } |
|
60 |
|
61 /** |
|
62 Second phase constructor. |
|
63 */ |
|
64 void CPTPIPTransport::ConstructL() |
|
65 { |
|
66 __FLOG_OPEN(KMTPSubsystem, KComponent); |
|
67 __FLOG(_L8("ConstructL - Entry")); |
|
68 __FLOG(_L8("PTPIP MTP Device class plug-in loaded.")); |
|
69 __FLOG(_L8("ConstructL - Exit")); |
|
70 } |
|
71 |
|
72 /** |
|
73 Constructor |
|
74 */ |
|
75 CPTPIPTransport::CPTPIPTransport() |
|
76 { |
|
77 // Do nothing. |
|
78 } |
|
79 |
|
80 /** |
|
81 Starts the Transport. Creates the connection object which controls the TCP/IP sockets. |
|
82 */ |
|
83 void CPTPIPTransport::StartL(MMTPConnectionMgr& aConnectionMgr) |
|
84 { |
|
85 __FLOG(_L8("CPTPIPTransport::StartL - Entry")); |
|
86 __ASSERT_ALWAYS(!iConnection, Panic(EPTPIPConnectionAlreadyExist)); |
|
87 iConnection = CPTPIPConnection::NewL(aConnectionMgr); |
|
88 aConnectionMgr.ConnectionOpenedL(*iConnection); |
|
89 __FLOG(_L8("CPTPIPTransport::StartL - Exit")); |
|
90 } |
|
91 |
|
92 /** |
|
93 Stops the transport. Deletes the connection object controlling the TCP/IP sockets |
|
94 */ |
|
95 void CPTPIPTransport::Stop(MMTPConnectionMgr& aConnectionMgr) |
|
96 { |
|
97 __FLOG(_L8("Stop - Entry")); |
|
98 if(iConnection) |
|
99 { |
|
100 // Check that we did not earlier close the connection due to some |
|
101 // error. If so then the connectionclosed would already have been closed. |
|
102 if (iConnection->ConnectionOpen()) |
|
103 { |
|
104 aConnectionMgr.ConnectionClosed(*iConnection); |
|
105 } |
|
106 delete iConnection; |
|
107 iConnection = NULL; |
|
108 } |
|
109 |
|
110 __FLOG(_L8("Stop - Exit")); |
|
111 } |
|
112 |
|
113 /** |
|
114 Nothing to do in mode change. |
|
115 */ |
|
116 void CPTPIPTransport::ModeChanged(TMTPOperationalMode /*aMode*/) |
|
117 { |
|
118 __FLOG(_L8("ModeChanged - Entry")); |
|
119 __FLOG(_L8("ModeChanged - Exit")); |
|
120 } |
|
121 |
|
122 /** |
|
123 No Extended Interface. |
|
124 */ |
|
125 TAny* CPTPIPTransport::GetExtendedInterface(TUid /*aInterfaceUid*/) |
|
126 { |
|
127 __FLOG(_L8("GetExtendedInterface - Entry")); |
|
128 __FLOG(_L8("GetExtendedInterface - Exit")); |
|
129 return 0; |
|
130 } |
|
131 |
|
132 /** |
|
133 Define the implementation UID of PTPIP transport implementation. |
|
134 */ |
|
135 static const TImplementationProxy ImplementationTable[] = |
|
136 { |
|
137 |
|
138 IMPLEMENTATION_PROXY_ENTRY((0xA0004A60), CPTPIPTransport::NewL) |
|
139 |
|
140 }; |
|
141 |
|
142 /** |
|
143 PTPIP transport implementation table. |
|
144 */ |
|
145 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
146 { |
|
147 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
148 return ImplementationTable; |
|
149 } |
|
150 |
|
151 /** |
|
152 Dummy dll entry point. |
|
153 */ |
|
154 TBool E32Dll() |
|
155 { |
|
156 return ETrue; |
|
157 } |
|
158 |
|
159 |
|
160 |