|
1 /* |
|
2 * Copyright (c) 2006 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: Inlines for the Transport ECOM plug-ins |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 namespace |
|
26 { |
|
27 _LIT(KPanic, "SenTransport"); |
|
28 } |
|
29 |
|
30 // Interface's (abstract base class's) static factory method implementation. |
|
31 // Asks ECOM plugin framework to instantiate appropriate concrete plugin |
|
32 // implementation. |
|
33 // |
|
34 // Instantiates the default WSF transport: HTTP Channel plug-in |
|
35 inline CSenTransport* CSenTransport::NewL(CSenTransportContext* apCtx) |
|
36 { |
|
37 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES |
|
38 const TUid KHttpChannelTransportPluginUid = {0x10274C74}; |
|
39 #else |
|
40 const TUid KHttpChannelTransportPluginUid = {0x101F974A}; |
|
41 #endif |
|
42 |
|
43 TAny* constructorParameters = reinterpret_cast<TAny*>(apCtx); |
|
44 |
|
45 // Find implementation behind KHttpChannelTransportPluginUid |
|
46 TAny* intf = REComSession::CreateImplementationL(KHttpChannelTransportPluginUid, |
|
47 _FOFF (CSenTransport, |
|
48 iDtor_ID_Key), |
|
49 constructorParameters); |
|
50 |
|
51 |
|
52 return reinterpret_cast <CSenTransport*> (intf); |
|
53 } |
|
54 |
|
55 // Interface's (abstract base class's) static factory method implementation. |
|
56 // Asks ECOM plugin framework to instantiate appropriate concret plugin |
|
57 // implementation. |
|
58 inline CSenTransport* CSenTransport::NewL(const TDesC8& aCue, |
|
59 CSenTransportContext* apCtx) |
|
60 { |
|
61 #ifndef RD_SEN_COMPILE_SIS_PACKAGE_FILES |
|
62 const TUid KCSenTransportInterfaceUid = {0x10274C72}; |
|
63 #else |
|
64 const TUid KCSenTransportInterfaceUid = {0x101F9749}; |
|
65 #endif |
|
66 |
|
67 TEComResolverParams resolverParams; |
|
68 resolverParams.SetDataType(aCue); |
|
69 resolverParams.SetWildcardMatch(EFalse); |
|
70 |
|
71 TAny* constructorParameters = reinterpret_cast<TAny*>(apCtx); |
|
72 |
|
73 // Find implementation for our interface. |
|
74 // - KCSenTransportInterfaceUid is the UID of Transport ECOM plugin. |
|
75 // - This call will leave, if the plugin architecture cannot find |
|
76 // implementation. |
|
77 // - The returned pointer points to one of our interface implementation |
|
78 // instances. |
|
79 TAny* intf = REComSession::CreateImplementationL (KCSenTransportInterfaceUid, |
|
80 _FOFF (CSenTransport, |
|
81 iDtor_ID_Key), |
|
82 constructorParameters, |
|
83 resolverParams); |
|
84 |
|
85 return reinterpret_cast<CSenTransport*> (intf); |
|
86 } |
|
87 |
|
88 |
|
89 // Interface's (abstract base class's) destructor |
|
90 inline CSenTransport::~CSenTransport() |
|
91 { |
|
92 // If in the NewL some memory is reserved for member data, it must be |
|
93 // released here. |
|
94 delete ipCtx; |
|
95 ipCtx = NULL; |
|
96 |
|
97 // Inform the ECOM framework that this specific instance of the |
|
98 // interface has been destroyed. |
|
99 REComSession::DestroyedImplementation(iDtor_ID_Key); |
|
100 } |
|
101 |
|
102 inline CSenTransport::CSenTransport(CSenTransportContext* apCtx, |
|
103 TBool aSessionOwned): |
|
104 CSenTransportBase(aSessionOwned), ipCtx(apCtx) |
|
105 { |
|
106 } |
|
107 |
|
108 inline MSenTransportContext& CSenTransport::Context() |
|
109 { |
|
110 __ASSERT_ALWAYS(ipCtx != NULL, User::Panic(KPanic, ETransportCtxNotInitialized)); |
|
111 |
|
112 return *ipCtx; |
|
113 } |
|
114 |
|
115 // End of File |