|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-5FEA4AF7-5837-4D9A-9022-92A746BED0C4" xml:lang="en"><title>WSP |
|
13 Header Primitive Encoding </title><shortdesc><apiname>TWspPrimitiveEncoder</apiname> allows encoding of header |
|
14 values. This encodes the input using various WSP encoding methods as follows: <apiname>TWspPrimitiveEncoder</apiname> is |
|
15 used to convert data into binary strings. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
16 <steps-unordered> |
|
17 <step id="GUID-9857F443-84C1-4225-BF4C-11787464C84F"><cmd/> |
|
18 <info><p> <codeph>ShortInt()</codeph> encodes the <codeph>TUint8</codeph> parameter |
|
19 value. </p></info> |
|
20 <stepxmp><codeblock xml:space="preserve">TUint8 input; |
|
21 input=0x7F; // MAX input value |
|
22 // encode short integer |
|
23 TUInt8 uInt8 = TWspPrimitiveEncoder::ShortInt(input);</codeblock></stepxmp> |
|
24 <stepresult><p>If the input value is greater that 127, it returns 0. </p></stepresult> |
|
25 </step> |
|
26 <step id="GUID-B407C2DD-EE72-494E-BE59-867207CFDB48"><cmd/> |
|
27 <info><p> <codeph>LongIntL()</codeph> encodes the <codeph>TUint32</codeph> parameter |
|
28 value. </p></info> |
|
29 <stepxmp><codeblock xml:space="preserve">TUint32 input; |
|
30 input=0x10000; |
|
31 // encode long int |
|
32 HBufC8 buf = TWspPrimitiveEncoder::LongIntL(input);</codeblock></stepxmp> |
|
33 </step> |
|
34 <step id="GUID-C721283B-307E-4A56-B283-0535D0FC45CA"><cmd/> |
|
35 <info><p><codeph>TextStringL()</codeph> encodes the string value. </p></info> |
|
36 <stepxmp><codeblock xml:space="preserve">_LIT8(KString1,"X-Header-1.foo"); |
|
37 // encode field name |
|
38 HBufC8 buf = TWspPrimitiveEncoder::TextStringL(KString1);</codeblock></stepxmp> |
|
39 </step> |
|
40 <step id="GUID-E5BA35FB-9F0F-42C7-AE98-F71F07A9AC52"><cmd/> |
|
41 <info><p> <codeph>UintVarL()</codeph> encodes the <codeph>TUint32</codeph> parameter |
|
42 value. </p></info> |
|
43 <stepxmp><codeblock xml:space="preserve">TUint32 input; |
|
44 input=0x3FFF; |
|
45 //encode UintVar |
|
46 HBufC8 buf = TWspPrimitiveEncoder::UintVarL(input);</codeblock></stepxmp> |
|
47 </step> |
|
48 <step id="GUID-C491AC1F-495D-4E13-8F1F-DE7F7FE5E2F5"><cmd/> |
|
49 <info><p><codeph>DateL()</codeph> encodes the date value. </p></info> |
|
50 <stepxmp><codeblock xml:space="preserve">TDateTime date(1970,EJanuary,0,0,0,0,0); |
|
51 //encode the date value |
|
52 HBufC8 buf = TWspPrimitiveEncoder::DateL(date);</codeblock></stepxmp> |
|
53 </step> |
|
54 </steps-unordered> |
|
55 </taskbody></task> |