Location:
obexobjects.h
Link against: obex.lib
class CObexBufObject : public CObexBaseObject;
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.
Derivation
CBase
- Base class for all classes to be instantiated on the heap
CObexBaseObject
- Objects of this class are used to describe the objects to be transferred and those received via Obex
CObexBufObject
- Use this class to hold objects where the body part is stored in a
CBufFlat object
Members
Defined in CObexBufObject
:
DataBuf()
, DataSize()
, EDoubleBuffering
, ESingleBuffering
, GetData()
, NewData()
, NewL()
, ResetData()
, SetDataBufL()
, SetDataBufL()
, SetDataBufL()
, SetDataBufL()
, SetDataBufL()
, TFileBuffering
, WriteToFile()
, ~CObexBufObject()
Inherited from CBase
:
Delete()
,
Extension_()
,
operator new()
Inherited from CObexBaseObject
:
AddHeaderL()
,
AddHttpL()
,
AppParam()
,
BytesReceived()
,
BytesSent()
,
Description()
,
EComplete
,
EContinue
,
EError
,
ELastPacket
,
HeaderMask()
,
HeaderSet()
,
Http()
,
Length()
,
Name()
,
Reset()
,
SetAppParamL()
,
SetDescriptionL()
,
SetHeaderMask()
,
SetLengthL()
,
SetNameL()
,
SetTargetL()
,
SetTimeL()
,
SetTypeL()
,
TProgress
,
Target()
,
Time()
,
Type()
,
ValidHeaders()
static IMPORT_C CObexBufObject *NewL(CBufBase *aDataBuf);
Description
Allocates and constructs a new OBEX dynamic buffer object, specifying a buffer.
Parameters
CBufBase *aDataBuf |
The buffer for the body of the object. This must be set either by this constructor or by calling SetDataBufL() before using the object.
|
|
Return value
virtual IMPORT_C ~CObexBufObject();
Description
Destructor.
IMPORT_C TInt WriteToFile(const TPtrC &aFileName);
Description
Writes contents of object to a file
Parameters
const TPtrC &aFileName |
Target file
|
|
Return value
TInt
|
a Symbian OS error code if file write fails.
|
|
IMPORT_C void SetDataBufL(TObexBufferingDetails &aDetails);
Description
Set the data buffers as specified in the supplied TObexBufferingDetails
object.
Parameters
TObexBufferingDetails &aDetails |
The 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.
|
|
Panic codes
Obex |
ENullFileHandle TObexPanicCode::ENullFileHandle The RFile object does not point to a valid (open) file.
|
Obex |
EEmptyBuffer TObexPanicCode::EEmptyBuffer The supplied buffer is of zero length.
|
Obex |
EInvalidBufferDetails TObexPanicCode::EInvalidBufferDetails An unknown TObexBufferingDetails object was supplied
|
Obex |
EInvalidBufferStrategy TObexPanicCode::EInvalidBufferStrategy An unknown TFileBuffering value was supplied.
|
|
IMPORT_C void SetDataBufL(CBufBase *aDataBuf);
Description
Sets a buffer to use the object body data.
Note that the function can leave.
Parameters
CBufBase *aDataBuf |
The buffer for the body of the object.
|
|
Panic codes
Obex |
ENullPointer TObexPanicCode::ENullPointer A NULL value was supplied for the data buffer.
|
|
IMPORT_C void SetDataBufL(const TPtrC &aFilename);
Description
Set object to use aFilename as its data area. Leaves if unable to open file.
Parameters
const TPtrC &aFilename |
The filename to link the object to.
|
|
IMPORT_C void SetDataBufL(const TPtrC &aFilename, CBufBase *aDataBuf);
Description
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.
Parameters
const TPtrC &aFilename |
The filename to link the object to.
|
CBufBase *aDataBuf |
The buffer for the body of the object.
|
|
Panic codes
Obex |
ENullPointer TObexPanicCode::ENullPointer A NULL value was supplied for the data buffer.
|
Obex |
EEmptyBuffer TObexPanicCode::EEmptyBuffer The supplied buffer is of zero length.
|
|
IMPORT_C void SetDataBufL(const TPtrC &aFilename, CBufBase &aDataBuf, const TFileBuffering aBufferingStrategy);
Description
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.
Parameters
const TPtrC &aFilename |
The file to link the object to.
|
CBufBase &aDataBuf |
A buffer to use.
|
const TFileBuffering aBufferingStrategy |
The buffering strategy to employ.
|
|
Panic codes
Obex |
EEmptyBuffer TObexPanicCode::EEmptyBuffer The supplied buffer is of zero length.
|
Obex |
EInvalidBufferStrategy TObexPanicCode::EInvalidBufferStrategy An unknown TFileBuffering
|
|
IMPORT_C CBufBase *DataBuf();
Description
Gets the buffer.
Return value
CBufBase *
|
The buffer for the body of the object.
|
|
private: virtual void GetData(TInt aPos, TDes8 &aDes);
Description
Reads aDes (up to MaxLength) from aPos offset into the buffer
Parameters
TInt aPos |
The offset into the buffer to read from
|
TDes8 &aDes |
The descriptor to read from
|
|
private: virtual void NewData(TInt aPos, TDes8 &aDes);
Description
Writes aDes into the buffer at aPos offset, growing the buffer if necessary
Parameters
private: virtual TInt DataSize();
Description
Return value
private: virtual void ResetData();
Description
TFileBuffering
Description
Obex file buffering method.
ESingleBuffering |
Only the supplied buffer will be used to buffer file writes.
|
EDoubleBuffering |
The object will create a second buffer and perform double buffering.
|
|