diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-4FE5CA06-8C3A-4AC1-80CE-4418AC55937A.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-4FE5CA06-8C3A-4AC1-80CE-4418AC55937A.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,74 @@ + + + + + +Reading +headers in a WSP bufferTWspField object holds the name and value pair +of the WSP header field. TWspHeaderSegmenter pulls the header +/ value pair out of the WSP buffer (into TWspField). Call TWspHeaderSegmenter::NextL() to +iterate through the WSP buffer. It calls TWspPrimitiveDecoder. +

CWspHeaderEncoder allows you to encode +the values and parameters of the header field. It creates one header at a +time from the name / value pairs.

+

The following are the steps to encode the WSP header:

+
+ + +Create a header encoder object. +//creates a pointer to CWspHeaderEncoder object +CWspHeaderEncoder* primEncoder = CWspHeaderEncoder::NewLC(); + + +Start a new encoded header to encode the parameter value. +// start a new encoded header +primEncoder->StartHeaderL(0x27); + + +Call CWspHeaderEncoder::StartValueLengthL() to calculate +the length of encodings that are added subsequently. The value calculated, +is stored as part of the encoded string, as specified in the WSP standard. +primEncoder->StartValueLengthL(); + + +Encode the header field and add it to the encoded field. + Note: The appropriate WSP method is used for encoding the header +field of a data type such as integer, date, text string and so on. +primEncoder->AddIntegerL(0x7F); +primEncoder->AddUintVarL(0xff); +primEncoder->AddLongIntL(999999); +_LIT8(KString, "WSP Encode: String"); +primEncoder->AddTextStringL(KString); +TDateTime time(2006,EMarch,20,06,36,30,000000); //create a date time object +primEncoder->AddDateL(time); // add +TUInt intVal=489; +primEncoder->AddLTokenL(intVal); +_LIT8(KTokenText, "WSP Encode: Token Text"); +primEncoder->AddLTokenTextL(KTokenText); + + +Call CWspHeaderEncoder::EndValuesLengthL() at the +time of header construction when ValueLength can be calculated. + + +Assuming that the length of the header encodings has been calculated +and added to the encoder field, call CWspHeaderEncoder::EndValuesLengthL(). +primEncoder->EndValueLengthL(); + + +Call CWspHeaderEncoder::EndHeaderL(), to complete +the header encoding. This completes and returns the encoded header field's +8 bit buffer. EndHeaderL() panics if EndValueLengthL() is +not called after CWspHeaderEncoder::StartValueLengthL(). +HBufC8* buf = primEncoder->EndHeaderL(); +

This returns a pointer to the buffer containing the encoded +field.

+
+
+
\ No newline at end of file