CObexBufObject Class Reference

#include <mw/obexobjects.h>

Link against: obex.lib

class CObexBufObject : public CObexBaseObject

Inherits from

Public Member Enumerations
enumTFileBuffering { ESingleBuffering, EDoubleBuffering }
Public Member Functions
virtual ~CObexBufObject()
IMPORT_C CBufBase *DataBuf()
HBufC *FileName()
IMPORT_C CObexBufObject *NewL(CBufBase *)
IMPORT_C voidSetDataBufL(TObexBufferingDetails &)
IMPORT_C voidSetDataBufL(CBufBase *)
IMPORT_C voidSetDataBufL(const TPtrC &)
IMPORT_C voidSetDataBufL(const TPtrC &, CBufBase *)
IMPORT_C voidSetDataBufL(const TPtrC &, CBufBase &, const TFileBuffering)
IMPORT_C TIntWriteToFile(const TPtrC &)
Inherited Enumerations
CObexBaseObject:TProgress
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()
CObexBaseObject::AddHeaderL(CObexHeader &)
CObexBaseObject::AddHttpL(const TDesC8 &)
CObexBaseObject::AppParam()const
CObexBaseObject::BytesReceived()
CObexBaseObject::BytesSent()
CObexBaseObject::CObexBaseObject()
CObexBaseObject::ConnectionID()
CObexBaseObject::CreateHeaderStorageDataL()
CObexBaseObject::Description()
CObexBaseObject::GetLastError()const
CObexBaseObject::GuessTypeFromExtL(const TDesC &)
CObexBaseObject::HeaderMask()
CObexBaseObject::HeaderSet()
CObexBaseObject::HeaderSet()const
CObexBaseObject::Http()const
CObexBaseObject::InitReceive()
CObexBaseObject::InitSend(TObexOpcode)
CObexBaseObject::Length()
CObexBaseObject::Name()
CObexBaseObject::ParseNextReceivePacket(CObexPacket &)
CObexBaseObject::PrepareConnectionHeader(CObexPacket &)
CObexBaseObject::PrepareNextSendPacket(CObexPacket &)
CObexBaseObject::Reset()
CObexBaseObject::ResetHeaders()
CObexBaseObject::SetAppParamL(const TDesC8 &)
CObexBaseObject::SetConnectionIdL(TUint32)
CObexBaseObject::SetDescriptionL(const TDesC &)
CObexBaseObject::SetHeaderMask(const TObexHeaderMask)
CObexBaseObject::SetLengthL(const TUint32)
CObexBaseObject::SetNameL(const TDesC &)
CObexBaseObject::SetTargetL(const TDesC8 &)
CObexBaseObject::SetTimeHeaderL(const TDesC8 &)
CObexBaseObject::SetTimeL(const TTime)
CObexBaseObject::SetTypeL(const TDesC8 &)
CObexBaseObject::SetUtcTimeL(const TTime)
CObexBaseObject::Target()
CObexBaseObject::Time()
CObexBaseObject::Type()
CObexBaseObject::ValidHeaders()
CObexBaseObject::~CObexBaseObject()

Detailed Description

Use this class to hold objects where the body part is stored in a CBufFlat object. Please note that although parameters are supplied as CBufBase objects, non-CBufFlat parameters are not supported and will have unpredictable results. At no point does the CObexBufObject create, or take ownership of any CBaseBuf object it uses - it is always the responsibility of the creator/owner of the CBaseBuf to free it when no longer required.

As this class does not take ownership of the buffers it uses, it equally can not create its own buffers ad-hoc for storing new data into. Hence at no time is it valid for a CObexBufObject to exist with out it having a valid data buffer set. If such a situation arises, where it is required that received information should be discarded, consider using a CObexNullObject.

It is also posible to supply a file instead of a memory buffer, or to supply both. This functionality is due to the MObexServerNotify class expecting to work only on CObexBufObjects, so CObexFileObjects cannot be returned from the upcalls. To use a file for body storage, call NewL() passing in a NULL pointer, then call SetDataBufL() manually afterwards. There are three overloads---to allow purely memory based objects, purely file based, or a hybrid. The hybrid object buffers into a memory buffer (which is not allowed to grow), then writes data to the file when the buffer is full. The buffering behaviour can therefore be tuned to the application by setting the size of the buffer prior to use.

This class is not designed for user derivation.

Member Enumeration Documentation

Enum TFileBuffering

Obex file buffering method.

EnumeratorValueDescription
ESingleBuffering

Only the supplied buffer will be used to buffer file writes.

EDoubleBuffering

The object will create a second buffer and perform double buffering.

Constructor & Destructor Documentation

~CObexBufObject ( )

IMPORT_C~CObexBufObject()[virtual]

Destructor.

Member Function Documentation

DataBuf ( )

IMPORT_C CBufBase *DataBuf()

Gets the buffer.

Returns: The buffer for the body of the object.

FileName ( )

HBufC *FileName()

Returns a pointer to the HBuf holding the filename this object is using. May return a null pointer.

Returns: iFilename The file name.

NewL ( CBufBase * )

IMPORT_C CObexBufObject *NewL(CBufBase *aDataBuf)[static]

Allocates and constructs a new OBEX dynamic buffer object, specifying a buffer.

ParameterDescription
aDataBufThe buffer for the body of the object. This must be set either by this constructor or by calling SetDataBufL() before using the object.

Returns: New OBEX dynamic buffer object

SetDataBufL ( TObexBufferingDetails & )

IMPORT_C voidSetDataBufL(TObexBufferingDetails &aDetails)
Set the data buffers as specified in the supplied TObexBufferingDetails object.
panic
Obex ENullFileHandle TObexPanicCode::ENullFileHandle The RFile object does not point to a valid (open) file.
panic
Obex EEmptyBuffer TObexPanicCode::EEmptyBuffer The supplied buffer is of zero length.
panic
Obex EInvalidBufferDetails TObexPanicCode::EInvalidBufferDetails An unknown TObexBufferingDetails object was supplied
panic
Obex EInvalidBufferStrategy TObexPanicCode::EInvalidBufferStrategy An unknown TFileBuffering value was supplied.
ParameterDescription
aDetailsThe buffering techniques to use. This only has to persist over the duration of the call to SetDataBufL, once this has returned it can be allowed to go out of scope.

SetDataBufL ( CBufBase * )

IMPORT_C voidSetDataBufL(CBufBase *aDataBuf)

Sets a buffer to use the object body data.

Note that the function can leave.

panic
Obex ENullPointer TObexPanicCode::ENullPointer A NULL value was supplied for the data buffer.
Deprecated
ParameterDescription
aDataBufThe buffer for the body of the object.

SetDataBufL ( const TPtrC & )

IMPORT_C voidSetDataBufL(const TPtrC &aFilename)

Set object to use aFilename as its data area. Leaves if unable to open file.

Deprecated

ParameterDescription
aFilenameThe filename to link the object to.

SetDataBufL ( const TPtrC &, CBufBase * )

IMPORT_C voidSetDataBufL(const TPtrC &aFilename,
CBufBase *aDataBuf
)

Set object to use aFilename as its data area. Leaves if unable to open file. Buffers data into aDataBuf before writing to file. Will not grow the memory buffer, so user can tune buffering behaviour when calling function.

panic
Obex ENullPointer TObexPanicCode::ENullPointer A NULL value was supplied for the data buffer.
panic
Obex EEmptyBuffer TObexPanicCode::EEmptyBuffer The supplied buffer is of zero length.
Deprecated
ParameterDescription
aFilenameThe filename to link the object to.
aDataBufThe buffer for the body of the object.

SetDataBufL ( const TPtrC &, CBufBase &, const TFileBuffering )

IMPORT_C voidSetDataBufL(const TPtrC &aFilename,
CBufBase &aDataBuf,
const TFileBufferingaBufferingStrategy
)

Set object to write to file, using buffering and the specified buffering strategy. Note the size of the buffer passed to this function will determine the size of the second buffer if double buffering is employed.

panic
Obex EEmptyBuffer TObexPanicCode::EEmptyBuffer The supplied buffer is of zero length.
panic
Obex EInvalidBufferStrategy TObexPanicCode::EInvalidBufferStrategy An unknown TFileBuffering
Deprecated
ParameterDescription
aFilenameThe file to link the object to.
aDataBufA buffer to use.
aBufferingStrategyThe buffering strategy to employ.

WriteToFile ( const TPtrC & )

IMPORT_C TIntWriteToFile(const TPtrC &aFileName)

Writes contents of object to a file

ParameterDescription
aFileNameTarget file

Returns: a Symbian OS error code if file write fails.