obex_util.h File Reference

#include "obex.h"

Go to the source code of this file.

Defines

#define OBEX_OBJECT_BUSINESS_CARD   "text/x-vCard"
#define OBEX_OBJECT_CAPABILITY   "x-obex/capability"
#define OBEX_OBJECT_FOLDER_LISTING   "x-obex/folder-listing"
#define OBEX_OBJECT_PROFILE   "x-obex/object-profile"
#define OBEX_SETPATH_NO_CREATE   2
#define OBEX_SETPATH_REVERSE   1

Typedefs

typedef _ObexDataBuffer ObexDataBuffer

Functions

int obexDataBufferCreate (ObexDataBuffer **dataBuffer, dword initialsize, void *initialData)
 Create new data buffer.
int obexDataBufferDestroy (ObexDataBuffer *dataBuffer)
 Destroy data buffer.
void * obexDataBufferGetData (ObexDataBuffer *dataBuffer)
 Get pointer to data.
dword obexDataBufferGetSize (ObexDataBuffer *dataBuffer)
 Get size of the buffer.
int obexUtilPullToFile (ObexSession *session, const wchar_t *localFilename, const wchar_t *remoteFilename, const char *contentType)
 Pull file from remote device to file.
int obexUtilPullToMemory (ObexSession *session, ObexDataBuffer **dataBuffer, const wchar_t *remoteFilename, const char *contentType)
 Pull object to memory.
int obexUtilPushFromFile (ObexSession *session, const wchar_t *localFilename, const wchar_t *remoteFilename, const char *contentType)
 Push file to remote device.
int obexUtilPushFromMemory (ObexSession *session, ObexDataBuffer *dataBuffer, const wchar_t *remoteFilename, const char *contentType)
 Push object from memory to remote device.
int obexUtilSetPath (ObexSession *session, const wchar_t *path, dword flags)
 Set current path of remote device.


Define Documentation

#define OBEX_OBJECT_BUSINESS_CARD   "text/x-vCard"

Context type for default vCard

Definition at line 30 of file obex_util.h.

#define OBEX_OBJECT_CAPABILITY   "x-obex/capability"

Context type for capability object

Definition at line 33 of file obex_util.h.

#define OBEX_OBJECT_FOLDER_LISTING   "x-obex/folder-listing"

Context type for folder listing object

Definition at line 27 of file obex_util.h.

#define OBEX_OBJECT_PROFILE   "x-obex/object-profile"

Context type for object profile

Definition at line 36 of file obex_util.h.

#define OBEX_SETPATH_NO_CREATE   2

Definition at line 24 of file obex_util.h.

#define OBEX_SETPATH_REVERSE   1

Set path flags

Definition at line 23 of file obex_util.h.


Typedef Documentation

typedef struct _ObexDataBuffer ObexDataBuffer

Data buffer

Definition at line 39 of file obex_util.h.


Function Documentation

int obexDataBufferCreate ( ObexDataBuffer **  dataBuffer,
dword  initialsize,
void *  initialData 
)

Create new data buffer.

Creates databuffer from existing data. Doesn't copy data, instead uses the buffer passed to the function.

Parameters:
dataBuffer - Out: Pointer to new databuffer.
initialsize - The initial size of the buffer.
initialData - The initial data.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

OBEX_ERROR_OUT_OF_MEMORY if out of memory.

int obexDataBufferDestroy ( ObexDataBuffer dataBuffer  ) 

Destroy data buffer.

Parameters:
dataBuffer - Pointer to data buffer.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

void* obexDataBufferGetData ( ObexDataBuffer dataBuffer  ) 

Get pointer to data.

Parameters:
dataBuffer - Pointer to data buffer.
Returns:
Returns pointer to the beginning of the data buffer or NULL.

dword obexDataBufferGetSize ( ObexDataBuffer dataBuffer  ) 

Get size of the buffer.

Parameters:
dataBuffer - Pointer to data buffer.
Returns:
Returns the size of the data buffer.

int obexUtilPullToFile ( ObexSession session,
const wchar_t *  localFilename,
const wchar_t *  remoteFilename,
const char *  contentType 
)

Pull file from remote device to file.

The function pulls file from the remote device. Different combinations of remoteFilename and contentType are used to pull different kind of objects from the remote device. For example 'x-obex/folder-listing' for contentType retrives current folder listing if the server supports it.

Parameters:
session - Session to be used in push.
localFilename - Local filename.
remoteFilename - Remote filename.
contentType - The content(or MIME) type of the file.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

OBEX_ERROR_OUT_OF_MEMORY if out of memory.

ObexResponseCode if server responds with something other than success.

int obexUtilPullToMemory ( ObexSession session,
ObexDataBuffer **  dataBuffer,
const wchar_t *  remoteFilename,
const char *  contentType 
)

Pull object to memory.

Parameters:
session - Session to be used in push.
dataBuffer - Out: Databuffer that contains the pulled object.
remoteFilename - The remote file to pull.
contentType - The content(or MIME) type of the file.
Remarks:
Use obexDataBufferGetData and obexDataBufferGetSize get the data from the data buffer. Use obexDataBufferDestroy to destroy the returned data buffer.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

OBEX_ERROR_OUT_OF_MEMORY if out of memory.

ObexResponseCode if server responds with something other than success.

int obexUtilPushFromFile ( ObexSession session,
const wchar_t *  localFilename,
const wchar_t *  remoteFilename,
const char *  contentType 
)

Push file to remote device.

Push local file to the server using given session. The local file can be full path. To ensure compatibility with different devices it is adviced to use SetPath to set the current path and only use the file name in the remoteFileName.

Parameters:
session - Session to be used in push.
localFilename - Local filename. The file to be sent.
remoteFilename - The name for the remote file.
contentType - The content(MIME) type of the file.
Remarks:
Either remoteFilename or contentType must be specified.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

OBEX_ERROR_OUT_OF_MEMORY if out of memory.

ObexResponseCode if server responds with something other than success.

int obexUtilPushFromMemory ( ObexSession session,
ObexDataBuffer dataBuffer,
const wchar_t *  remoteFilename,
const char *  contentType 
)

Push object from memory to remote device.

Parameters:
session - Session to be used in push.
dataBuffer - Databuffer that contains the data to be pushed.
remoteFilename - The name for the remote file.
contentType - The content(or MIME) type of the file.
Remarks:
Use obexDataBufferCreate to create data buffer from memory block.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

OBEX_ERROR_OUT_OF_MEMORY if out of memory.

ObexResponseCode if server responds with something other than success.

int obexUtilSetPath ( ObexSession session,
const wchar_t *  path,
dword  flags 
)

Set current path of remote device.

The function is used to set the current path in the remote device and also to create new folders. Function sends OBEX_PACKET_OPERATION_SET_PATH to the server with the given path. The OBEX_SETPATH_NO_CREATE flag prevents the server from creating new folder if the folder specified is not there. OBEX_SETPATH_REVERSE flag is used when going backwards in the directory hierarchy( cd .. ).

Remarks:
Advance one directory at one function call to ensure maximum compatibility.

Use the OBEX_SETPATH_REVERSE | OBEX_SETPATH_NO_CREATE without path parameter to reverse the directory tree.

Parameters:
session - Session to be used in setPath.
path - New path.
flags - Behaviour flags.
Returns:
OBEX_ERROR_SUCCESS if function succeeds.

OBEX_ERROR_INVALID_PARAMETER if invalid parameters are passed to function.

OBEX_ERROR_OUT_OF_MEMORY if out of memory.

ObexResponseCode if server responds with something other than success.

footer


 SourceForge.net Logo