|
1 // Copyright (c) 2001-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 // $Workfile: irHeader.cpp $ |
|
15 // $Author: Stevep $ |
|
16 // $Revision: 10 $ |
|
17 // $Date: 25/03/02 9:03 $ |
|
18 // |
|
19 // |
|
20 |
|
21 //class include |
|
22 #include <irheader.h> |
|
23 |
|
24 //system includes |
|
25 #include <s32strm.h> //RReadStream, RWriteStream |
|
26 #include <msvstore.h> //CMsvStore, RMsvWriteStream, RMsvReadStream |
|
27 #include <obex.h> |
|
28 |
|
29 //user includes |
|
30 #include <obexinternalutils.h> |
|
31 |
|
32 CIrHeader::CIrHeader(): |
|
33 CObexMtmHeader(KUidStreamIrHeaders, KObexMessageStreamVersion) |
|
34 /** |
|
35 * Default constructor, initialises the base class and sets the value of iIrProtocolInfo.iTransport |
|
36 * as appropriate for IR |
|
37 */ |
|
38 { |
|
39 iIrProtocolInfo.iTransport = KIrTransport; |
|
40 iIrProtocolInfo.iClassName = KIrObexClassName; |
|
41 iIrProtocolInfo.iAttributeName = KIrObexAttributeName; |
|
42 } |
|
43 |
|
44 |
|
45 EXPORT_C CIrHeader::~CIrHeader() |
|
46 /** |
|
47 * Destructor. Empty |
|
48 */ |
|
49 |
|
50 { |
|
51 } |
|
52 |
|
53 |
|
54 EXPORT_C void CIrHeader::ConstructL() |
|
55 /** |
|
56 * Second-phase constructor. Calls BaseConstructL to initialise the base members |
|
57 */ |
|
58 { |
|
59 BaseConstructL(); |
|
60 } |
|
61 |
|
62 EXPORT_C CIrHeader* CIrHeader::NewL() |
|
63 /** |
|
64 * Canonical NewL factory function |
|
65 */ |
|
66 { |
|
67 CIrHeader* self = new (ELeave) CIrHeader; |
|
68 CleanupStack::PushL(self); |
|
69 self->ConstructL(); |
|
70 CleanupStack::Pop(); //self |
|
71 return self; |
|
72 } |
|
73 |
|
74 EXPORT_C void CIrHeader::ExternalizeL(RMsvWriteStream& aWriteStream) const |
|
75 /** |
|
76 * Externaliser. Writes data out to aWriteStream. Calls BaseExternalizeL() to write out |
|
77 * the base data first. |
|
78 * @param aWriteStream Stream to write data to |
|
79 * @leave KErrXXX Standard SymbianOS stream leave codes |
|
80 */ |
|
81 { |
|
82 BaseExternalizeL(aWriteStream); |
|
83 |
|
84 //TBuf16 |
|
85 ObexInternalUtils::ExternalizeL(iIrProtocolInfo.iTransport, aWriteStream); |
|
86 |
|
87 //TBuf8 |
|
88 ObexInternalUtils::ExternalizeL(iIrProtocolInfo.iClassName, aWriteStream); |
|
89 ObexInternalUtils::ExternalizeL(iIrProtocolInfo.iAttributeName, aWriteStream); |
|
90 ObexInternalUtils::ExternalizeL(iIrProtocolInfo.iAddr, aWriteStream); |
|
91 } |
|
92 |
|
93 |
|
94 EXPORT_C void CIrHeader::InternalizeL(RMsvReadStream& aReadStream) |
|
95 /** |
|
96 * Internaliser. Reads data in from aReadStream. Calls BaseInternalizeL() to read in the base |
|
97 * data first. |
|
98 * @param aReadStream Stream to read data in from |
|
99 * @leave KErrXXX Standard SymbianOS stream leave codes |
|
100 */ |
|
101 { |
|
102 BaseInternalizeL(aReadStream); |
|
103 |
|
104 //TBuf16 |
|
105 ObexInternalUtils::InternalizeL(iIrProtocolInfo.iTransport, aReadStream); |
|
106 |
|
107 //TBuf8 |
|
108 ObexInternalUtils::InternalizeL(iIrProtocolInfo.iClassName, aReadStream); |
|
109 ObexInternalUtils::InternalizeL(iIrProtocolInfo.iAttributeName, aReadStream); |
|
110 ObexInternalUtils::InternalizeL(iIrProtocolInfo.iAddr, aReadStream); |
|
111 } |
|
112 |
|
113 |
|
114 EXPORT_C void CIrHeader::SetAddrL(const TDesC8& aAddr) |
|
115 /** |
|
116 * Set the IR address of the recipient |
|
117 * |
|
118 * @param aAddr the address of the recipient (NB: only one recipient is currently supported) |
|
119 * @leave KErrXXX system-wide leave codes if assignment fails |
|
120 */ |
|
121 { |
|
122 iIrProtocolInfo.iAddr.Copy(aAddr); |
|
123 } |
|
124 |
|
125 EXPORT_C TPtrC8 CIrHeader::Addr() const |
|
126 /** |
|
127 * Get the IR address of the recipient |
|
128 * |
|
129 * @return The address of the recipient (NB: only one recipient is currently supported) |
|
130 */ |
|
131 { |
|
132 return iIrProtocolInfo.iAddr; |
|
133 } |
|
134 |
|
135 EXPORT_C const TObexIrProtocolInfo& CIrHeader::IrProtocolInfo() const |
|
136 /** |
|
137 * Get the IR protocol info of the recipient |
|
138 * |
|
139 * @return The protocol info of the recipient (NB: only one recipient is currently supported) |
|
140 */ |
|
141 { |
|
142 return iIrProtocolInfo; |
|
143 } |