|
1 /* |
|
2 * Copyright (c) 2009-2010 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 * Initial Contributors: |
|
9 * Nokia Corporation - initial contribution. |
|
10 * Contributors: |
|
11 * |
|
12 * Description: |
|
13 * MSRP Implementation |
|
14 * |
|
15 */ |
|
16 |
|
17 // System Includes |
|
18 #include <e32base.h> |
|
19 |
|
20 |
|
21 // Include Files |
|
22 #include "CMSRPSession.h" |
|
23 #include "CMSRPSessionImplementation.h" |
|
24 |
|
25 |
|
26 // Member Functions |
|
27 |
|
28 CMSRPSession* CMSRPSession::NewL( RMSRP& aRMSRP, |
|
29 MMSRPSessionObserver& aObserver, |
|
30 const TUint aIapId ) |
|
31 { |
|
32 MSRPLOG("CMSRP Session.. NewL"); |
|
33 CMSRPSession* self = CMSRPSession::NewLC( aRMSRP, aObserver, aIapId ); |
|
34 CleanupStack::Pop(self); |
|
35 return self; |
|
36 } |
|
37 |
|
38 |
|
39 CMSRPSession* CMSRPSession::NewLC( RMSRP& aRMSRP, |
|
40 MMSRPSessionObserver& aObserver, |
|
41 const TUint aIapId ) |
|
42 { |
|
43 MSRPLOG("CMSRP Session.. NewLC"); |
|
44 CMSRPSession* self = new (ELeave) CMSRPSession; |
|
45 CleanupStack::PushL(self); |
|
46 self->ConstructL( aRMSRP, aObserver, aIapId ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 |
|
51 void CMSRPSession::ConstructL( RMSRP& aRMSRP, |
|
52 MMSRPSessionObserver& aObserver, |
|
53 const TUint aIapId ) |
|
54 { |
|
55 MSRPLOG("CMSRP Session.. ConstructL"); |
|
56 iMSRPSessionImpl = CMSRPSessionImplementation::NewL( aRMSRP, aObserver, aIapId ); |
|
57 } |
|
58 |
|
59 |
|
60 CMSRPSession::~CMSRPSession() |
|
61 { |
|
62 MSRPLOG("CMSRP Session.. Dtor"); |
|
63 if(NULL != iMSRPSessionImpl) |
|
64 delete iMSRPSessionImpl; |
|
65 } |
|
66 |
|
67 |
|
68 EXPORT_C TDesC8& CMSRPSession::LocalMSRPPath() |
|
69 { |
|
70 MSRPLOG("CMSRP Session.. LocalMSRPPath"); |
|
71 return iMSRPSessionImpl->LocalMSRPPath(); |
|
72 } |
|
73 |
|
74 |
|
75 EXPORT_C void CMSRPSession::SetSessionParams( CMSRPSessionParams& aSessionParams ) |
|
76 { |
|
77 MSRPLOG("CMSRP Session.. SetSessionParams"); |
|
78 iMSRPSessionImpl->SetSessionParams( aSessionParams ); |
|
79 } |
|
80 |
|
81 |
|
82 EXPORT_C TInt CMSRPSession::Connect( const TDesC8& aRemoteMsrpPath ) |
|
83 { |
|
84 MSRPLOG("CMSRP Session.. Connect"); |
|
85 TRAPD( err, iMSRPSessionImpl->ConnectL( aRemoteMsrpPath )); |
|
86 return err; |
|
87 } |
|
88 |
|
89 |
|
90 EXPORT_C TInt CMSRPSession::Listen( const TDesC8& aRemoteMsrpPath ) |
|
91 { |
|
92 MSRPLOG("CMSRP Session.. Listen"); |
|
93 TRAPD( err, iMSRPSessionImpl->ListenL( aRemoteMsrpPath )); |
|
94 return err; |
|
95 } |
|
96 |
|
97 |
|
98 EXPORT_C HBufC8* CMSRPSession::SendBuffer( |
|
99 const TDesC8& aMessage, |
|
100 const TDesC8& aMimeType ) |
|
101 { |
|
102 MSRPLOG("CMSRP Session.. SendBuffer"); |
|
103 // send the Message |
|
104 HBufC8* messageId = NULL; |
|
105 TRAPD( err, messageId = iMSRPSessionImpl->SendBufferL( aMessage, aMimeType ) ); |
|
106 if ( err ) |
|
107 { |
|
108 return NULL; |
|
109 } |
|
110 return messageId; |
|
111 } |
|
112 |
|
113 EXPORT_C TInt CMSRPSession::SendFile( |
|
114 const TFileName& aFileName, |
|
115 const TDesC8& aMimeType ) |
|
116 { |
|
117 |
|
118 MSRPLOG("CMSRP Session.. SendFile"); |
|
119 TRAPD( err,iMSRPSessionImpl->SendFileL(aFileName, aMimeType ) ); |
|
120 return err; |
|
121 |
|
122 } |
|
123 |
|
124 EXPORT_C TInt CMSRPSession::CancelFileSending( ) |
|
125 { |
|
126 MSRPLOG("CMSRP Session.. CancelFileSending"); |
|
127 /* TInt err; |
|
128 return err;*/ |
|
129 return 0; |
|
130 } |
|
131 |
|
132 EXPORT_C TInt CMSRPSession::ReceiveFile( |
|
133 const TFileName& aFileName, |
|
134 const TInt aFileSize, |
|
135 const TDesC8& aMimeType) |
|
136 { |
|
137 MSRPLOG("CMSRP Session.. ReceiveFile"); |
|
138 TRAPD( err,iMSRPSessionImpl->ReceiveFileL(aFileName,aFileSize,aMimeType )); |
|
139 return err; |
|
140 } |
|
141 |
|
142 EXPORT_C TInt CMSRPSession::CancelReceiveFile() |
|
143 { |
|
144 return 0; |
|
145 } |
|
146 |
|
147 EXPORT_C void CMSRPSession::NotifyProgress(TBool aFlag) |
|
148 { |
|
149 iMSRPSessionImpl->NotifyProgress(aFlag); |
|
150 } |
|
151 |
|
152 EXPORT_C TInt CMSRPSession::CancelSending( TDesC8& aMessageId ) |
|
153 { |
|
154 MSRPLOG("CMSRP Session.. CancelSending"); |
|
155 TRAPD( err, iMSRPSessionImpl->CancelSendingL( aMessageId ) ); |
|
156 return err; |
|
157 } |
|
158 |