|
1 /* |
|
2 * Copyright (c) 2004 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: Login data codec. |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "PEngLoginDataCodec.h" |
|
20 #include "PresenceDebugPrint.h" |
|
21 #include <E32Std.h> |
|
22 #include <CIMPSSAPSettings.h> |
|
23 #include <s32strm.h> |
|
24 #include <s32mem.h> |
|
25 |
|
26 |
|
27 // ============================= MEMBER FUNCTIONS =============================== |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // PEngLoginDataCodec::PackLoginDataL() |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 EXPORT_C HBufC8* PEngLoginDataCodec::PackLoginDataL( const CIMPSSAPSettings& aSAP ) |
|
34 { |
|
35 PENG_DP_TXT( "PEngLoginDataCodec::PackLoginDataL() - CIMPSSAPSettings" ); |
|
36 |
|
37 HBufC8* packBuffer = HBufC8::NewLC( 5000 ); |
|
38 TPtr8 pack( packBuffer->Des() ); |
|
39 |
|
40 RDesWriteStream ws; |
|
41 ws.Open( pack ); // CSI: 65 # |
|
42 CleanupClosePushL( ws ); |
|
43 |
|
44 aSAP.ExternalizeL( ws ); |
|
45 |
|
46 ws.CommitL(); |
|
47 CleanupStack::PopAndDestroy(); //ws |
|
48 |
|
49 |
|
50 packBuffer = packBuffer->ReAllocL( packBuffer->Length() ); |
|
51 CleanupStack::Pop(); |
|
52 return packBuffer; |
|
53 } |
|
54 |
|
55 |
|
56 // ----------------------------------------------------------------------------- |
|
57 // PEngLoginDataCodec::UnPackLoginDataL() |
|
58 // ----------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C void PEngLoginDataCodec::UnPackLoginDataL( const TDesC8& aLoginData, |
|
61 CIMPSSAPSettings& aSAP ) |
|
62 { |
|
63 PENG_DP_TXT( "PEngLoginDataCodec::UnPackLoginDataL() - CIMPSSAPSettings" ); |
|
64 |
|
65 RDesReadStream rs; |
|
66 rs.Open( aLoginData ); // CSI: 65 # |
|
67 CleanupClosePushL( rs ); |
|
68 |
|
69 aSAP.Reset(); |
|
70 aSAP.InternalizeL( rs ); |
|
71 |
|
72 CleanupStack::PopAndDestroy(); //rs |
|
73 } |
|
74 |
|
75 |
|
76 // End of File |