class CObexBufObject : public CObexBaseObject |
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.
Public Member Functions | |
---|---|
~CObexBufObject() | |
IMPORT_C CBufBase * | DataBuf() |
HBufC * | FileName() |
IMPORT_C CObexBufObject * | NewL(CBufBase *) |
IMPORT_C void | SetDataBufL(TObexBufferingDetails &) |
IMPORT_C void | SetDataBufL(CBufBase *) |
IMPORT_C void | SetDataBufL(const TPtrC &) |
IMPORT_C void | SetDataBufL(const TPtrC &, CBufBase *) |
IMPORT_C void | SetDataBufL(const TPtrC &, CBufBase &, const TFileBuffering) |
IMPORT_C TInt | WriteToFile(const TPtrC &) |
Private Member Functions | |
---|---|
CObexBufObject() | |
void | CloseDataFile() |
void | CloseFileServer() |
void | ConstructL(CBufBase *) |
void | CopyFileL(const TDesC &) |
TInt | DataSize() |
void | GetData(TInt, TDes8 &) |
void | GetFileData(TInt, TDes8 &) |
void | NewData(TInt, TDes8 &) |
TInt | NewFileData(TInt, TDes8 &) |
TInt | OpenDataFile(const TDesC &) |
TInt | OpenFileServer() |
void | PrepareToSetBufferL() |
void | ResetData() |
TInt | WriteBufferToFile(TBool) |
Public Member Enumerations | |
---|---|
enum | TFileBuffering { ESingleBuffering, EDoubleBuffering } |
Inherited Enumerations | |
---|---|
CObexBaseObject:TProgress |
Private Attributes | |
---|---|
CBufBase * | iBuf |
TInt | iBufOffset |
TInt | iBufSegSize |
TInt | iBuffered |
CBufBase * | iDoubleBuf |
RFile * | iFile |
RFs * | iFileServ |
HBufC * | iFilename |
MObexFileWriter * | iWriter |
void | CopyFileL | ( | const TDesC & | aFilename | ) | [private] |
const TDesC & aFilename |
IMPORT_C CObexBufObject * | NewL | ( | CBufBase * | aDataBuf | ) | [static] |
CBufBase * aDataBuf |
TInt | OpenDataFile | ( | const TDesC & | aFilename | ) | [private] |
const TDesC & aFilename |
IMPORT_C void | SetDataBufL | ( | TObexBufferingDetails & | aDetails | ) |
TObexBufferingDetails & aDetails |
IMPORT_C void | SetDataBufL | ( | const TPtrC & | aFilename | ) |
const TPtrC & aFilename |
IMPORT_C void | SetDataBufL | ( | const TPtrC & | aFilename, |
CBufBase * | aDataBuf | |||
) |
IMPORT_C void | SetDataBufL | ( | const TPtrC & | aFilename, |
CBufBase & | aDataBuf, | |||
const TFileBuffering | aBufferingStrategy | |||
) |
const TPtrC & aFilename | |
CBufBase & aDataBuf | |
const TFileBuffering aBufferingStrategy |
IMPORT_C TInt | WriteToFile | ( | const TPtrC & | aFileName | ) |
const TPtrC & aFileName |
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. |