MObexServerNotify Class Reference

#include <mw/obexserver.h>

class MObexServerNotify
Public Member Functions
pure virtual voidAbortIndication()
pure virtual voidErrorIndication(TInt)
pure virtual TInt GetCompleteIndication()
pure virtual TInt GetPacketIndication()
pure virtual CObexBufObject *GetRequestIndication(CObexBaseObject *)
virtual IMPORT_C voidMOSN_ExtensionInterfaceL(TUid, void *&)
pure virtual TInt ObexConnectIndication(const TObexConnectInfo &, const TDesC8 &)
pure virtual voidObexDisconnectIndication(const TDesC8 &)
pure virtual TInt PutCompleteIndication()
pure virtual TInt PutPacketIndication()
pure virtual CObexBufObject *PutRequestIndication()
pure virtual TInt SetPathIndication(const CObex::TSetPathInfo &, const TDesC8 &)
pure virtual voidTransportDownIndication()
pure virtual voidTransportUpIndication()

Detailed Description

OBEX synchronous server notification interface.

Any service that provides OBEX server functionality must implement one of the two server observer classes -- this one or MObexServerNotifyAsync.

The CObexServer object handles the protocol side of an OBEX server session, while this class provides the server policy for a particular session.

PUT and GET requests are handled synchronously, with the implementer returning a CObexBufObject which will be processed immediately.

See also: MObexServerNotifyAsync CObexServer

Member Function Documentation

AbortIndication ( )

voidAbortIndication()[pure virtual]

Called when an abort packet is received from the client.

An OBEX abort command simply cancels the current operation, and does not necessarily have to cause the connection to be dropped. On return, a ERespSuccess packet is sent to the client.

ErrorIndication ( TInt )

voidErrorIndication(TIntaError)[pure virtual]

Called if an OBEX protocol error occurs.

It is only called for fatal errors that cause the OBEX connection to terminate. An error that does not terminate the connection, for example the server issuing a semantically valid, but unrecognised command, will not be indicated.

ParameterDescription
aErrorError code that describes the OBEX error. OBEX specific error codes are listed from KErrIrObexClientNoDevicesFound.

GetCompleteIndication ( )

TInt GetCompleteIndication()[pure virtual]

Called when the final packet of the object has been returned to the client.

Note like PutCompleteIndication(), this function might not be called for each GetRequestIndication(), if the operation is interrupted by an error.

Before version 6.1, the return type was void.

Returns: KErrNoneinstructs the remote client that the get completed successfully. Any other value cancels the operation with an appropriate OBEX server response code.

GetPacketIndication ( )

TInt GetPacketIndication()[pure virtual]

Called for every packet of get reply sent by the server back to the client.

The function is only called while an object is being sent to the client, not while the client is providing its initial specification for the object it requires.

You can use this function to provide user notification on the object being sent, and its progress. As with PutPacketIndication(), you should consider that this function might get called often, especially for large objects and small OBEX packet sizes, so the speed of execution here is important.

Returns: KErrNone to continue sending the object, or any other error code to cancel the operation

GetRequestIndication ( CObexBaseObject * )

CObexBufObject *GetRequestIndication(CObexBaseObject *aRequiredObject)[pure virtual]

Called when a full get request has been received from the client.

aRequestedObject holds all the details about the object the remote client has requested. Use this function to analyse the client's request, and return a pointer to the object to be returned to the client, or NULL to return no object.

If NULL is returned, the server will send ERespForbidden to the client; if an error occurs in returning the object, ERespInternalError is returned, otherwise the returned object is sent back to the client.

ParameterDescription
aRequiredObjectDetails about the object the remote client has requested

Returns: Object to return to the client

MOSN_ExtensionInterfaceL ( TUid, void *& )

IMPORT_C voidMOSN_ExtensionInterfaceL(TUidaInterface,
void *&aObject
)[virtual]

Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is. This virtual function allows the M- classes to be extended in future in a binary compatible way by providing a method that clients can override in future to allow extra callbacks to be made via aObject.

ParameterDescription
aInterfaceUID of the interface to return
aObjectthe container for another interface as specified by aInterface

ObexConnectIndication ( const TObexConnectInfo &, const TDesC8 & )

TInt ObexConnectIndication(const TObexConnectInfo &aRemoteInfo,
const TDesC8 &aInfo
)[pure virtual]

Called when an OBEX connection is made from a remote client.

Override this function to provide any extra OBEX connection processing. Despite this method returning a value, implementers cannot use this to refuse the connection attempt.

ParameterDescription
aRemoteInfoConnection information supplied by that remote machine
aInfoFurther information about the requested connection (reserved)

Returns: Ignored

ObexDisconnectIndication ( const TDesC8 & )

voidObexDisconnectIndication(const TDesC8 &aInfo)[pure virtual]

Called on a (graceful) OBEX disconnection by the client.

Override this to provide any extra processing OBEX disconnection processing.

Note that this indication will not be raised if the remote machine simply drops the transport connection. However, ErrorIndication() will be called if the disconnection is unexpected/ invalid (i.e. another operation was in progress at the time). In all cases, TransportDownIndication() will be called.

ParameterDescription
aInfoContains information about the disconnection (reserved)

PutCompleteIndication ( )

TInt PutCompleteIndication()[pure virtual]

Called after the final put packet has been successfully received and parsed.

Note that there will not necessarily be a call to this function corresponding to each PutRequestIndication() as, if an error occurs while the put is being carried out, ErrorIndication() will be called instead.

Before version 6.1, the return type was void.

Returns: KErrNoneinstructs the remote client that the put completed successfully. Any other value cancels the operation with an appropriate OBEX server response code.

PutPacketIndication ( )

TInt PutPacketIndication()[pure virtual]

Called on receipt of every packet of an OBEX PUT operation.

It will always be preceded by a PutRequestIndication(). The object returned by the request indication will be updated to reflect all the information received concerning the object which the client is sending, from packets up to and including the current one.

You can use this function to provide periodic user notification on the progress of the transfer (noting that the Length attribute may take an arbitrary number of packets to become non-zero, and the constraints on its accuracy). Due to the nature of OBEX operations, where any header attribute can be sent at any point in the transfer, this is also a good place to marshal the details of a received object, and possibly prompt for action on the received object (e.g. renaming on filename clashes).

Note that this function could be hit quite heavily, in proportion to the size of the object transferred. Therefore more consideration should be given to the speed of execution of this function than that of the other indications.

Returns: KErrNone instructs the server to allow the client to continue the put operation. Any other value cancels the operation with an appropriate OBEX server response code.

PutRequestIndication ( )

CObexBufObject *PutRequestIndication()[pure virtual]

Called on receipt of the first packet of a (valid) put request.

It is called before any parsing of the packet is performed, simply to establish whether this server is interested in receiving objects at all.

Note if the returned object cannot be initialised for receiving, ERespInternalError is returned to the client.

Returns: CObexBaseObject-derived object, which the object being put will be parsed into. If this is NULL, ERespForbidden is returned to the client.

SetPathIndication ( const CObex::TSetPathInfo &, const TDesC8 & )

TInt SetPathIndication(const CObex::TSetPathInfo &aPathInfo,
const TDesC8 &aInfo
)[pure virtual]

Called when an OBEX SETPATH command is received by the server.

ParameterDescription
aPathInfoSETPATH command parameters
aInfoNot currently used

Returns: System wide error code indicating the success of the setpath command

TransportDownIndication ( )

voidTransportDownIndication()[pure virtual]

Called when the transport connection is dropped (by either party).

It is called whether the OBEX connection was gracefully disconnected or not. The function is the definitive place for disconnection processing.

TransportUpIndication ( )

voidTransportUpIndication()[pure virtual]

Called when the underlying transport connection is made from a remote client to the server.

Note that this does not, however, indicate an OBEX connection has been successfully established.

You can define any low-level connection policy here. It is also a good place to set up the local connection information (CObex::LocalInfo()), if any non-defaults are required.