CObexBaseObject Class Reference

#include <mw/obexbaseobject.h>

Link against: obex.lib

class CObexBaseObject : public CBase

Inherits from

  • CObexBaseObject
    Public Member Enumerations
    enumTProgress { EContinue, EComplete, EError, ELastPacket }
    Public Member Functions
    virtual ~CObexBaseObject()
    IMPORT_C voidAddHeaderL(CObexHeader &)
    IMPORT_C voidAddHttpL(const TDesC8 &)
    IMPORT_C const TDesC8 &AppParam()
    IMPORT_C TIntBytesReceived()
    IMPORT_C TIntBytesSent()
    TUint32 ConnectionID()
    IMPORT_C const TDesC &Description()
    TObexResponse GetLastError()
    IMPORT_C TObexHeaderMaskHeaderMask()
    IMPORT_C const CObexHeaderSet &HeaderSet()
    IMPORT_C CObexHeaderSet &HeaderSet()
    IMPORT_C const RPointerArray< HBufC8 > *Http()
    TInt InitReceive()
    TInt InitSend(TObexOpcode)
    IMPORT_C TUint32Length()
    IMPORT_C const TDesC &Name()
    TProgress ParseNextReceivePacket(CObexPacket &)
    voidPrepareConnectionHeader(CObexPacket &)
    TProgress PrepareNextSendPacket(CObexPacket &)
    IMPORT_C voidReset()
    IMPORT_C voidSetAppParamL(const TDesC8 &)
    voidSetConnectionIdL(TUint32)
    IMPORT_C voidSetDescriptionL(const TDesC &)
    IMPORT_C voidSetHeaderMask(const TObexHeaderMask)
    IMPORT_C voidSetLengthL(const TUint32)
    IMPORT_C voidSetNameL(const TDesC &)
    IMPORT_C voidSetTargetL(const TDesC8 &)
    IMPORT_C voidSetTimeL(const TTime)
    IMPORT_C voidSetTypeL(const TDesC8 &)
    IMPORT_C const TDesC8 &Target()
    IMPORT_C const TTimeTime()
    IMPORT_C const TDesC8 &Type()
    IMPORT_C TObexHeaderMaskValidHeaders()
    Protected Member Functions
    CObexBaseObject()
    voidCreateHeaderStorageDataL()
    pure virtual TInt DataSize()
    pure virtual voidGetData(TInt, TDes8 &)
    voidGuessTypeFromExtL(const TDesC &)
    pure virtual voidNewData(TInt, TDes8 &)
    pure virtual voidResetData()
    voidResetHeaders()
    voidSetTimeHeaderL(const TDesC8 &)
    voidSetUtcTimeL(const TTime)
    Inherited Functions
    CBase::CBase()
    CBase::Delete(CBase *)
    CBase::Extension_(TUint,TAny *&,TAny *)
    CBase::operator new(TUint)
    CBase::operator new(TUint,TAny *)
    CBase::operator new(TUint,TLeave)
    CBase::operator new(TUint,TLeave,TUint)
    CBase::operator new(TUint,TUint)
    CBase::~CBase()

    Detailed Description

    Objects of this class are used to describe the objects to be transferred and those received via Obex. Consists of a number of attributes describing the object, along with methods to set them. CObexBaseObject is an abstract base class, which defines attribute setting and transferring functionality, but does not specify the storage mechanism for the data part (called the object body) of the object. This body part is defined in derived classes.

    Object description attributes are tracked for validity automatically, so that only valid attributes are sent to the remote machine. Also has the concept of "header masks". This selects which of the various attributes will actually be sent out/read in when the object is used in an operation with the remote machine. Objects default to transferring all valid attributes, use the header mask if restriction is required on the headers exchanged.

    See the various derived classes for description of object body representation.

    The common attributes are defined to be as close to the underlying OBEX headers as usefully possible, hence any OBEX header specified as a Unicode string (e.g. Name) translate to TDes (variant) EPOC descriptors, "byte sequences" (e.g. Type) are TDes8 (or ASCII invariant), and byte and 32 bit integers (e.g. Length) are TUint32s.

    This class is not designed for user derivation (ie. outside of this dll).

    See also: CObexHeader

    Member Enumeration Documentation

    Enum TProgress

    EnumeratorValueDescription
    EContinue
    EComplete
    EError
    ELastPacket

    Constructor & Destructor Documentation

    CObexBaseObject ( )

    CObexBaseObject()[protected]

    ~CObexBaseObject ( )

    ~CObexBaseObject()[virtual]

    Destructor.

    Member Function Documentation

    AddHeaderL ( CObexHeader & )

    IMPORT_C voidAddHeaderL(CObexHeader &aHeader)

    Adds a CObexHeader into the CObexHeaderSet

    ParameterDescription
    aHeaderA Pointer to a CObexHeader to be added to the CObexHeaderSet

    AddHttpL ( const TDesC8 & )

    IMPORT_C voidAddHttpL(const TDesC8 &aDesc)

    Add an Http header.

    ParameterDescription
    aDescHTTP header to be added to the object's collection of HTTP headers

    AppParam ( )

    IMPORT_C const TDesC8 &AppParam()const

    Gets the object's Application Parameters attribute

    This function does not parse the Application Parameters attribute into the expected Tag-Length-Value format.

    Returns: Object's Application Parameters attribute, or KNullDesC8 if none has been set

    BytesReceived ( )

    IMPORT_C TIntBytesReceived()

    Returns the number of bytes of the body of the object transferred while receiving an object.

    Returns: The number of bytes received

    BytesSent ( )

    IMPORT_C TIntBytesSent()

    Returns the number of bytes of the body of the object transferred so far while sending this object.

    Returns: The number of bytes sent

    ConnectionID ( )

    TUint32 ConnectionID()

    Returns the connection ID.

    Returns: Returns KConnIDInvalid if no connectionID is set.

    CreateHeaderStorageDataL ( )

    voidCreateHeaderStorageDataL()[protected]

    DataSize ( )

    TInt DataSize()[protected, pure virtual]

    Description ( )

    IMPORT_C const TDesC &Description()

    Gets the object's Description attribute.

    Returns: Object's Name attribute or KNullDesC if it has not been set

    GetData ( TInt, TDes8 & )

    voidGetData(TIntaPos,
    TDes8 &aDes
    )[protected, pure virtual]

    GetLastError ( )

    TObexResponse GetLastError()const

    Returns the Obex Error response code from the last call to CObexBaseObject::ParseNextReceivePacket

    Returns: The Obex Response code

    GuessTypeFromExtL ( const TDesC & )

    voidGuessTypeFromExtL(const TDesC &aExt)[protected]

    Makes a first level guess at setting the mime type from the file extension.

    This API is deprecated and may be removed at any time. For any production applications, the versit and the Application architecture (see RApaLsSession::RecognizeData) provide far more flexibilty and robustness.

    Deprecated6.1

    HeaderMask ( )

    IMPORT_C TObexHeaderMaskHeaderMask()

    Returns the currently set header mask. This defaults to 0xFF (i.e. allow everything) when Reset () or InitFromFileL is called. This does not specify which headers currently contain valid data--merely which headers will be transferred if they do contain valid data.

    Returns: The currently set header mask

    HeaderSet ( )

    IMPORT_C const CObexHeaderSet &HeaderSet()const

    See also: CObexHeaderSet

    Returns: A const reference to the HeaderSet object used by this object.

    HeaderSet ( )

    IMPORT_C CObexHeaderSet &HeaderSet()

    See also: CObexHeaderSet

    Returns: A reference to the HeaderSet object used by this object.

    Http ( )

    IMPORT_C const RPointerArray< HBufC8 > *Http()const

    Firstly updates the iHttp list, ensuring that the entries are the same as those HTTP headers within the header set. (The iHttp list could have contained old headers that were removed from the headerset using the DeleteMasked operation) Returns a pointer to the Http header array or null if no headers defined.

    Returns: A pointer to the Http header array or null if no headers defined

    InitReceive ( )

    TInt InitReceive()

    Prepare the object for receiving into.

    InitSend ( TObexOpcode )

    TInt InitSend(TObexOpcodeaOpcode)

    Prepare the object for sending. Each packet sent will contain aOpcode.

    Returns: KErrNone

    Length ( )

    IMPORT_C TUint32Length()

    Gets the object's Length attribute.

    Note this might not match the size of the file (if any) to transfer.

    Returns: Object's Length attribute or 0 if it has not been set

    Name ( )

    IMPORT_C const TDesC &Name()

    Gets the object's Name attribute.

    Returns: Object's Name attribute or KNullDesC if it has not been set

    NewData ( TInt, TDes8 & )

    voidNewData(TIntaPos,
    TDes8 &aDes
    )[protected, pure virtual]

    ParseNextReceivePacket ( CObexPacket & )

    TProgress ParseNextReceivePacket(CObexPacket &aPacket)

    Parse the passed packet, consuming headers into this object as appropriate. The returned progress can not be relied upon to indicate completion, because that is actually signalled at a diferent level, depending on the source of the packet(final bit or server complete response). Returning EComplete simply indicates that all of the object body has been received.

    ParameterDescription
    aPacketThe packet to extract the headers from

    Returns: The progress of header extraction

    PrepareConnectionHeader ( CObexPacket & )

    voidPrepareConnectionHeader(CObexPacket &aPacket)

    Fill up the Connect command with the appropriate headers.

    ParameterDescription
    aPacketThe packet to be filled

    PrepareNextSendPacket ( CObexPacket & )

    TProgress PrepareNextSendPacket(CObexPacket &aPacket)

    Fill up aPacket with whatever is left to be sent of the object. Trys to get attribute headers out asap, and tacks as much of the data part of the object onto the end of each packet as will fit. Returned value goes to EComplete on the call *after* the final packet has been written(i.e. indicates nothing left to do).

    ParameterDescription
    aPacketThe packet to be filled

    Returns: Progress in writing out the object

    Reset ( )

    IMPORT_C voidReset()

    Resets the object, to make it represent nothing.

    Call this before setting a CObexObject to represent a new object.

    ResetData ( )

    voidResetData()[protected, pure virtual]

    ResetHeaders ( )

    voidResetHeaders()[protected]

    Sets header mask to 1's (include all), but valid mask to 0's (none valid). Also reset progress indicators to avoid any un-initialised transfer attempts

    SetAppParamL ( const TDesC8 & )

    IMPORT_C voidSetAppParamL(const TDesC8 &aDesc)

    Sets the Application Parameters attribute of the object.

    This is expected to be of the format Tag-Length-Value, but this is not enforced.

    ParameterDescription
    aDescApplication Parameters attribute

    SetConnectionIdL ( TUint32 )

    voidSetConnectionIdL(TUint32aFourByte)

    Set the connection id. This method will check the headerset for a connectionId header. If one if located, then this will be modified for the new HV value. If not, a new connectionId header will be added.

    ParameterDescription
    aFourByteThe connectionID to be set

    SetDescriptionL ( const TDesC & )

    IMPORT_C voidSetDescriptionL(const TDesC &aDesc)

    Sets the Description attribute of the object.

    This is currently the easiest way to send proprietary information along with an object.

    ParameterDescription
    aDescDescription attribute

    SetHeaderMask ( const TObexHeaderMask )

    IMPORT_C voidSetHeaderMask(const TObexHeaderMaskaHeaderMask)

    Sets the header mask. aHeaderMask is built up by bit-wise or ing any of the KObexHdr... constants. For example, if it is set to KObexHdrName | KObexHdrLength, only these two headers will be specified in transfer operations with the remote machine, even if there are other valid attributes which could be used. In effect, this mask is bit-wise and ed with the "valid headers" mask when determining which headers are valid for the purposes of transfers.

    SetLengthL ( const TUint32 )

    IMPORT_C voidSetLengthL(const TUint32aLength)

    Sets the Length attribute of the object, in bytes.

    Note that this does not necessarily have to match the exact size of the body data, but is used to give an indication of the size to the receiving end.

    ParameterDescription
    aLengthLength attribute of the object

    SetNameL ( const TDesC & )

    IMPORT_C voidSetNameL(const TDesC &aDesc)

    Sets the Name attribute of the object.

    The Name is used to identify the object to the remote machine (or to identify a received object). Note that in general, this is quite distinct from the CObexFileObject::DataFile() attribute, which specifies where the body of the object is stored.

    ParameterDescription
    aDescName attribute

    SetTargetL ( const TDesC8 & )

    IMPORT_C voidSetTargetL(const TDesC8 &aDesc)

    Sets the Target attribute of the object.

    Generally, this will only have any useful meaning if the session Who attribute of the remote machine is recognised, and particularly, when connected to a strict peer (see CObex::IsStrictPeer()).

    ParameterDescription
    aDescTarget attribute

    SetTimeHeaderL ( const TDesC8 & )

    voidSetTimeHeaderL(const TDesC8 &aTimeDes)[protected]

    Add a descriptor as the one and only Time header in an object.

    ParameterDescription
    aTimeDesA narrow descriptor which will be stored in the object.

    SetTimeL ( const TTime )

    IMPORT_C voidSetTimeL(const TTimeaLocalTime)

    Sets the Time attribute of the object (stored in UTC).

    ParameterDescription
    aLocalTimeTime attribute in local time

    SetTypeL ( const TDesC8 & )

    IMPORT_C voidSetTypeL(const TDesC8 &aDesc)

    Sets the Type attribute of the object.

    This should be in the form of a valid IANA media type (see http://www.iana.org/assignments/media-types/index.html).

    ParameterDescription
    aDescType attribute

    SetUtcTimeL ( const TTime )

    voidSetUtcTimeL(const TTimeaUtcTime)[protected]

    Sets the Time attribute of the object (stored in UTC).

    ParameterDescription
    aUtcTimeTime attribute in local time

    Target ( )

    IMPORT_C const TDesC8 &Target()

    Gets the object's Target attribute.

    Returns: Object's Target attribute or KNullDesC8 if it has not been set

    Time ( )

    IMPORT_C const TTimeTime()

    Returns the time attribute of the object in local time. Returns TTime (0) if no valid time has been set.

    Returns: Object's Time attribute in local time or TTime(0) if it has not been set

    Type ( )

    IMPORT_C const TDesC8 &Type()

    Gets the object's Type attribute.

    Returns: Object's Type attribute or KNullDesC8 if it has not been set

    ValidHeaders ( )

    IMPORT_C TObexHeaderMaskValidHeaders()

    Returns the current valid header mask. This allows inspection of the current set of valid headers, particularly useful for determining whether a put object contained a body header (important for deleting files as part of file transfer).

    Returns: The current valid header mask