WSP Header Primitive Encoding

TWspPrimitiveEncoder allows encoding of header values. This encodes the input using various WSP encoding methods as follows: TWspPrimitiveEncoder is used to convert data into binary strings.


  • ShortInt() encodes the TUint8 parameter value.

            TUint8 input;
    input=0x7F; // MAX input value
    // encode short integer 
    TUInt8 uInt8 = TWspPrimitiveEncoder::ShortInt(input);
           

    If the input value is greater that 127, it returns 0.


  • LongIntL() encodes the TUint32 parameter value.

            TUint32 input;
    input=0x10000;
    // encode long int
    HBufC8  buf = TWspPrimitiveEncoder::LongIntL(input);
           

  • TextStringL() encodes the string value.

            _LIT8(KString1,"X-Header-1.foo");
    // encode field name
    HBufC8  buf = TWspPrimitiveEncoder::TextStringL(KString1);
           

  • UintVarL() encodes the TUint32 parameter value.

            TUint32 input;
    input=0x3FFF;
    //encode UintVar
    HBufC8 buf = TWspPrimitiveEncoder::UintVarL(input);
           

  • DateL() encodes the date value.

            TDateTime date(1970,EJanuary,0,0,0,0,0);
    //encode the date value
    HBufC8  buf = TWspPrimitiveEncoder::DateL(date);