Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: obexbaseobject.h
Link against: obex.lib

Class CObexBaseObject

class CObexBaseObject : public CBase;

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).

Derivation

Members

Defined in CObexBaseObject:
AddHeaderL(), AddHttpL(), AppParam(), BytesReceived(), BytesSent(), DataSize(), Description(), EComplete, EContinue, EError, ELastPacket, GetData(), HeaderMask(), HeaderSet(), HeaderSet(), Http(), Length(), Name(), NewData(), Reset(), ResetData(), SetAppParamL(), SetDescriptionL(), SetHeaderMask(), SetLengthL(), SetNameL(), SetTargetL(), SetTimeL(), SetTypeL(), TProgress, Target(), Time(), Type(), ValidHeaders(), ~CObexBaseObject()

Inherited from CBase:
Delete(), Extension_(), operator new()

See also:


Construction and destruction


~CObexBaseObject()

virtual ~CObexBaseObject();

Description

Destructor.

[Top]


Member functions


SetHeaderMask()

IMPORT_C void SetHeaderMask(const TObexHeaderMask aHeaderMask);

Description

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.

Parameters

const TObexHeaderMask aHeaderMask


SetNameL()

IMPORT_C void SetNameL(const TDesC &aDesc);

Description

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.

Parameters

const TDesC &aDesc

Name attribute


SetTypeL()

IMPORT_C void SetTypeL(const TDesC8 &aDesc);

Description

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).

Parameters

const TDesC8 &aDesc

Type attribute


SetLengthL()

IMPORT_C void SetLengthL(const TUint32 aLength);

Description

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.

Parameters

const TUint32 aLength

Length attribute of the object


SetTimeL()

IMPORT_C void SetTimeL(const TTime aLocalTime);

Description

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

Parameters

const TTime aLocalTime

Time attribute in local time


SetDescriptionL()

IMPORT_C void SetDescriptionL(const TDesC &aDesc);

Description

Sets the Description attribute of the object.

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

Parameters

const TDesC &aDesc

Description attribute


SetTargetL()

IMPORT_C void SetTargetL(const TDesC8 &aDesc);

Description

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()).

Parameters

const TDesC8 &aDesc

Target attribute


AddHttpL()

IMPORT_C void AddHttpL(const TDesC8 &aDesc);

Description

Add an Http header.

Parameters

const TDesC8 &aDesc

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


SetAppParamL()

IMPORT_C void SetAppParamL(const TDesC8 &aDesc);

Description

Sets the Application Parameters attribute of the object.

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

Parameters

const TDesC8 &aDesc

Application Parameters attribute


AddHeaderL()

IMPORT_C void AddHeaderL(CObexHeader &aHeader);

Description

Adds a CObexHeader into the CObexHeaderSet

Parameters

CObexHeader &aHeader

A Pointer to a CObexHeader to be added to the CObexHeaderSet


BytesSent()

IMPORT_C TInt BytesSent();

Description

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

Return value

TInt

The number of bytes sent


BytesReceived()

IMPORT_C TInt BytesReceived();

Description

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

Return value

TInt

The number of bytes received


HeaderMask()

IMPORT_C TObexHeaderMask HeaderMask();

Description

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.

Return value

TObexHeaderMask

The currently set header mask


ValidHeaders()

IMPORT_C TObexHeaderMask ValidHeaders();

Description

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).

Return value

TObexHeaderMask

The current valid header mask


Name()

IMPORT_C const TDesC &Name();

Description

Gets the object's Name attribute.

Return value

const TDesC &

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


Type()

IMPORT_C const TDesC8 &Type();

Description

Gets the object's Type attribute.

Return value

const TDesC8 &

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


Length()

IMPORT_C TUint32 Length();

Description

Gets the object's Length attribute.

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

Return value

TUint32

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


Time()

IMPORT_C const TTime Time();

Description

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

Return value

const TTime

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


Description()

IMPORT_C const TDesC &Description();

Description

Gets the object's Description attribute.

Return value

const TDesC &

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


Target()

IMPORT_C const TDesC8 &Target();

Description

Gets the object's Target attribute.

Return value

const TDesC8 &

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


Http()

IMPORT_C const RPointerArray< HBufC8 > *Http() const;

Description

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.

Return value

const RPointerArray< HBufC8 > *

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


AppParam()

IMPORT_C const TDesC8 &AppParam() const;

Description

Gets the object's Application Parameters attribute

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

Return value

const TDesC8 &

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


Reset()

IMPORT_C void Reset();

Description

Resets the object, to make it represent nothing.

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


HeaderSet()

IMPORT_C const CObexHeaderSet &HeaderSet() const;

Description

Return value

const CObexHeaderSet &

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

See also:


HeaderSet()

IMPORT_C CObexHeaderSet &HeaderSet();

Description

Return value

CObexHeaderSet &

A reference to the HeaderSet object used by this object.

See also:


GetData()

protected: virtual void GetData(TInt aPos, TDes8 &aDes)=0;

Description

Parameters

TInt aPos

TDes8 &aDes


NewData()

protected: virtual void NewData(TInt aPos, TDes8 &aDes)=0;

Description

Parameters

TInt aPos

TDes8 &aDes


DataSize()

protected: virtual TInt DataSize()=0;

Description

Return value

TInt


ResetData()

protected: virtual void ResetData()=0;

Description

[Top]


Member enumerations


Enum TProgress

TProgress

Description

EContinue

EComplete

EError

ELastPacket