Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <obexobjects.h>
Link against: obex.lib

Class CObexFileObject

class CObexFileObject : public CObexBaseObject;

Description

This class is a concrete derivation of the CObexBaseObject class. Use it to store and transfer OBEX objects with the body part stored in an EPOC file. Hence this class is particularly suited to OBEX "file" beaming applications (c.f. arbitrary object beaming), although there is in reality no restriction in what it is used to transfer. Access to the body is acheived through an additional attribute to the object; the data file. This is the file-system name of the file used to store the body of the object. Note that there is no explicit relation between this and the Name of the object, although it is expected that most applications would attempt to relate the two.

When ever a valid data file is set (i.e. CObexFileObject::DataFile().Length > 0), this file is effectively open, hence stopping any other application from opening it with exclusive rights. Therefore, it is recommended that Reset () be called on the object as soon as it is no longer required, and definitely before (conceptually) passing ownership of the data file to any other object or user.

CObexFileObject is also suited to situations where an object is expected to be received, but no information about the purpose of this object is known. This is due to CObexFileObject’s ability to create temporary files "on the fly" to store received data into, when a specific file is not provided by the application.

This class is not designed for user derivation.

Derivation

Members

Defined in CObexFileObject:

Inherited from CBase:

Inherited from CObexBaseObject:


Construction and destruction


NewL()

IMPORT_C static CObexFileObject* NewL();

Description

Creates a new CObexFileObject object. Static file object factory. returns a new CObexFileObject, set up to use a temporary file to store received data into "on the fly". If used for sourcing an object to send a "NULL" object(body length 0) will be sent.

Return value

CObexFileObject *

Instance of CObexFileObject


NewL(const TDesC &)

IMPORT_C static CObexFileObject* NewL(const TDesC &aDataFile);

Description

Creates a new CObexFileObject object. Static file object factory. returns a new CObexFileObject, set up to use aDataFile as its data file, or will create a temp file if aDataFile is not a valid file name. If used for sourcing an object to send, and no valid data file is set, a "NULL" object(body length 0) will be sent.

Parameters

const TDesC16 &aDataFile

Filename to configure this object to use

Return value

CObexFileObject *

Instance of CObexFileObject


~CObexFileObject()

IMPORT_C virtual ~CObexFileObject();

Description

Destructor.

[Top]


Member functions


InitFromFileL(const TDesC &)

IMPORT_C void InitFromFileL(const TDesC &aFile);

Description

Initialises this object from the specified file.

The function attempts to set attribute values for the object as follows:

Length:set to the length of the file

Name:taken from the name portion of the path in aFile

Time:taken from the modification time of the file

Type:set appropriately if the file extension is .vcf (VCard), .vcs (Vcalendar), or .txt.

Parameters

const TDesC16 &aFile

Body data file


GetData(TInt,TDes8 &)

private: virtual void GetData(TInt aPos, TDes8 &aDes);

Description

Virtual pure function form the base object. Tries to fill aDes with data starting from aPos byte offset. returns null descriptor if no data file is set.

Parameters

TInt aPos

Position (reliative to start of object) to start extracting data from

TDes8 &aDes

Descriptor to fill


NewData(TInt,TDes8 &)

private: virtual void NewData(TInt aPos, TDes8 &aDes);

Description

Virtual pure function overload. inserts aDes into the data file at location aPos

Parameters

TInt aPos

Position (reliative to start of object) to start inserting data from

TDes8 &aDes

Descriptor to insert


DataSize()

private: virtual TInt DataSize();

Description

Return value

TInt

number of bytes in the data file (0 if no file is set)


ResetData()

private: virtual void ResetData();

Description

Set object back to a null file.