ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth Framework Reference

 


OBEXSession

Inherits from:

NSObject

Declared In:

Overview

Object representing an OBEX connection to a remote target.

Discussion

You will have no need for a obtaining/using a raw OBEXSession, since it requires an underlying transport to do anything useful. However, once you have an object that is a subclass of this class, you can use the functions herein to manipulate that OBEXSession. First off, you will want to use OBEXConnect (if you are a client session) to actually cause the transport to open a connection to a remote target and establish an OBEX connection over it. From there you can issue more commands based on the responses from a server.

If you are a server session, the first thing you should receive is an OBEXConnect command packet, and you will want to issue an OBEXConnectResponse packet, with your reesponse to that command (success, denied, bad request, etc.).

You can use the session accessors to access certain information, such as the negotiated max packet length.

If you wish to implement your own OBEXSession over a transport such as ethernet, you will need to see the end of the file to determine which functions to override, and what to pass to those functions.

No timeout mechanism has been implemented so far for an OBEXSessions. If you need timeouts, you will need to implement them yourself. This is being explored for a future revision. However, be aware that the OBEX Specification does not explicitly require timeouts, so be sure you allow ample time for commands to complete, as some devices may be slow when sending large amounts of data.



Methods

-clientHandleIncomingData:

Tranport subclasses need to invoke this from their own data-receive handlers. For example, when data is received over a Bluetooth RFCOMM channel in the IOBluetoothOBEXSession, it in turn calls this to dispatch the data. If you do not handle this case, your server session will not work, guaranteed.

-closeTransportConnection

You must override this - it will be called when the transport connection should be shutdown.

-getAvailableCommandPayloadLength:

Determine the maximum amount of data you can send in a particular command as an OBEX client session.

-getAvailableCommandResponsePayloadLength:

Determine the maximum amount of data you can send in a particular command response as an OBEX server session.

-getMaxPacketLength

Gets current max packet length.

-hasOpenOBEXConnection

Has a successful connect packet been sent and received? This API tells you so.

-hasOpenTransportConnection

You must override this - it will be called periodically to determine if a transport connection is open or not.

-OBEXAbort

Send an OBEX Abort command to the session's target.

-OBEXAbort:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send an OBEX Abort command to the session's target.

-OBEXAbortResponse

Send a abort response to a session's target.

-OBEXAbortResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send a abort response to a session's target.

-OBEXConnect

Initiate an OBEX connection to a device. Causes underlying transport (Bluetooth, et al) to attempt to connect to a remote device. After success, an OBEX connect packet is sent to establish the OBEX Connection.

-OBEXConnect:maxPacketLength:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Initiate an OBEX connection to a device. Causes underlying transport (Bluetooth, et al) to attempt to connect to a remote device. After success, an OBEX connect packet is sent to establish the OBEX Connection.

-OBEXConnectResponse

Send a connect response to a session's target.

-OBEXConnectResponse:flags:maxPacketLength:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send a connect response to a session's target.

-OBEXDisconnect

Send an OBEX Disconnect command to the session's target. THIS DOES NOT necessarily close the underlying transport connection. Deleting the session will ensure that closure.

-OBEXDisconnect:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send an OBEX Disconnect command to the session's target. THIS DOES NOT necessarily close the underlying transport connection. Deleting the session will ensure that closure.

-OBEXDisconnectResponse

Send a disconnect response to a session's target.

-OBEXDisconnectResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send a disconnect response to a session's target.

-OBEXGet

Send an OBEX Get command to the session's target.

-OBEXGet:headers:headersLength:eventSelector:selectorTarget:refCon:

Send an OBEX Get command to the session's target.

-OBEXGetResponse

Send a get response to a session's target.

-OBEXGetResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send a get response to a session's target.

-OBEXPut

Send an OBEX Put command to the session's target.

-OBEXPut:headersData:headersDataLength:bodyData:bodyDataLength:eventSelector:selectorTarget:refCon:

Send an OBEX Put command to the session's target.

-OBEXPutResponse

Send a put response to a session's target.

-OBEXPutResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send a put response to a session's target.

-OBEXSetPath

Send an OBEX SetPath command to the session's target.

-OBEXSetPath:constants:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send an OBEX SetPath command to the session's target.

-OBEXSetPathResponse

Send a set path response to a session's target.

-OBEXSetPathResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

Send a set path response to a session's target.

-openTransportConnection

Opens a transport connection to a device. A Bluetooth connection is one example of a transport.

-openTransportConnection:selectorTarget:refCon:

Opens a transport connection to a device. A Bluetooth connection is one example of a transport.

-sendDataToTransport

You must override this to send data over your transport. This does nothing by default, it will return a kOBEXUnsupportedError.

-sendDataToTransport:dataLength:

You must override this to send data over your transport. This does nothing by default, it will return a kOBEXUnsupportedError.

-serverHandleIncomingData:

Tranport subclasses need to invoke this from their own data-receive handlers. For example, when data is received over a Bluetooth RFCOMM channel in the IOBluetoothOBEXSession, it in turn calls this to dispatch the data. If you do not handle this case, your server session will not work, guaranteed.

-setEventCallback:

Sets the C-API callback used when the session recieves data.

-setEventRefCon:

Sets the C-API callback refCon used when the session recieves data.

-setEventSelector

Allow you to set a selector to be called when events occur on the OBEX session.

-setEventSelector:target:refCon:

Allow you to set a selector to be called when events occur on the OBEX session.


clientHandleIncomingData:


Tranport subclasses need to invoke this from their own data-receive handlers. For example, when data is received over a Bluetooth RFCOMM channel in the IOBluetoothOBEXSession, it in turn calls this to dispatch the data. If you do not handle this case, your server session will not work, guaranteed.

-(void) clientHandleIncomingData:(OBEXTransportEvent*)event; 
Parameters
event

New event received from the transport.

Discussion

Tranport subclasses must call this for OBEX client sessions to work!


closeTransportConnection


You must override this - it will be called when the transport connection should be shutdown.

-(OBEXError)closeTransportConnection; 
Return Value

Return whether or not the transport connection was closed successfully or not. Return OBEXSuccess ( 0 ) on success, otherwise an error code.

Discussion

Tranport subclasses must override this! When called you should take whatever steps are necessary to actually close down the transport connection.


getAvailableCommandPayloadLength:


Determine the maximum amount of data you can send in a particular command as an OBEX client session.

-(OBEXMaxPacketLength)getAvailableCommandPayloadLength:(OBEXOpCode)inOpCode; 
Parameters
inOpCode

The opcode you are interested in sending (as a client).

Return Value

The maximum amount of data a particular packet can handle, after accounting for any command overhead.

Discussion

Each OBEX Command has a certain amount of overhead. Since the negotiated max packet length does not indicate what the maximum data amount you can send in a particular command's packet, you can use this function to determine how much data to provide in optional headers or body data headers.


getAvailableCommandResponsePayloadLength:


Determine the maximum amount of data you can send in a particular command response as an OBEX server session.

-(OBEXMaxPacketLength)
        getAvailableCommandResponsePayloadLength:(OBEXOpCode)inOpCode; 
Parameters
inOpCode

The opcode you are interested in responding to (as a server).

Return Value

The maximum amount of data a particular packet can handle, after accounting for any command response overhead.

Discussion

Each OBEX Command response has a certain amount of overhead. Since the negotiated max packet length does not indicate what the maximum data amount you can send in a particular response's packet, you can use this function to determine how much data to provide in optional headers or body data headers.


getMaxPacketLength


Gets current max packet length.

-(OBEXMaxPacketLength)getMaxPacketLength; 
Return Value

Max packet length.

Discussion

This value *could* change before and after a connect command has been sent or a connect command response has been received, since the recipient could negotiate a lower max packet size.


hasOpenOBEXConnection


Has a successful connect packet been sent and received? This API tells you so.

-(BOOL)hasOpenOBEXConnection; 
Return Value

True or false, we are OBEX-connected to another OBEX entity.

Discussion

A "transport" connection may exist (such as a Bluetooth baseband connection), but the OBEX connection may not be established over that transport. If it has been, this function returns true.


hasOpenTransportConnection


You must override this - it will be called periodically to determine if a transport connection is open or not.

-(Boolean)hasOpenTransportConnection; 
Return Value

Return whether or not the transport connection is still open.

Discussion

Tranport subclasses must override this! When called you simply return if the transport connection is still open or not.


OBEXAbort


Send an OBEX Abort command to the session's target.

See Also:

OBEXAbort:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXAbort:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXAbortHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXAbort:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send an OBEX Abort command to the session's target.

See Also:

OBEXAbort

-(OBEXError)OBEXAbort:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXAbortHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXAbortResponse


Send a abort response to a session's target.

See Also:

OBEXAbortResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXAbortResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXAbortResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXAbortResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send a abort response to a session's target.

See Also:

OBEXAbortResponse

-(OBEXError)OBEXAbortResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXAbortResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXConnect


Initiate an OBEX connection to a device. Causes underlying transport (Bluetooth, et al) to attempt to connect to a remote device. After success, an OBEX connect packet is sent to establish the OBEX Connection.

See Also:

OBEXConnect:maxPacketLength:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXConnect:(OBEXFlags)inFlags maxPacketLength:(OBEXMaxPacketLength)inMaxPacketLength optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inFlags

OBEX connect flags. See OBEX.h for possibilities.

inMaxPacketLength

Maximum packet size you want to support. May be negotiated down, depending on target device.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXConnectHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector. If you have already established an OBEX connection and you call this again you will get an 'kOBEXSessionAlreadyConnectedError' as a result.


OBEXConnect:maxPacketLength:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Initiate an OBEX connection to a device. Causes underlying transport (Bluetooth, et al) to attempt to connect to a remote device. After success, an OBEX connect packet is sent to establish the OBEX Connection.

See Also:

OBEXConnect

-(OBEXError)OBEXConnect:(OBEXFlags)inFlags maxPacketLength:(OBEXMaxPacketLength)inMaxPacketLength optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inFlags

OBEX connect flags. See OBEX.h for possibilities.

inMaxPacketLength

Maximum packet size you want to support. May be negotiated down, depending on target device.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXConnectHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector. If you have already established an OBEX connection and you call this again you will get an 'kOBEXSessionAlreadyConnectedError' as a result.


OBEXConnectResponse


Send a connect response to a session's target.

See Also:

OBEXConnectResponse:flags:maxPacketLength:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXConnectResponse:(OBEXOpCode)inResponseOpCode flags:(OBEXFlags)inFlags maxPacketLength:(OBEXMaxPacketLength)inMaxPacketLength optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inFlags

OBEX connect flags. See OBEX.h for possibilities.

inConstants

OBEX connect constants. See OBEX.h for possibilities.

inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXConnectResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXConnectResponse:flags:maxPacketLength:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send a connect response to a session's target.

See Also:

OBEXConnectResponse

-(OBEXError)OBEXConnectResponse:(OBEXOpCode)inResponseOpCode flags:(OBEXFlags)inFlags maxPacketLength:(OBEXMaxPacketLength)inMaxPacketLength optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inFlags

OBEX connect flags. See OBEX.h for possibilities.

inConstants

OBEX connect constants. See OBEX.h for possibilities.

inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXConnectResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXDisconnect


Send an OBEX Disconnect command to the session's target. THIS DOES NOT necessarily close the underlying transport connection. Deleting the session will ensure that closure.

See Also:

OBEXDisconnect:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXDisconnect:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXDisconnectHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector. Be careful not to exceed the max packet length in your optional headers, or your command will be rejected. It is recommended that you call getMaxPacketLength on your session before issuing this command so you know how much data the session's target will accept in a single transaction.


OBEXDisconnect:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send an OBEX Disconnect command to the session's target. THIS DOES NOT necessarily close the underlying transport connection. Deleting the session will ensure that closure.

See Also:

OBEXDisconnect

-(OBEXError)OBEXDisconnect:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXDisconnectHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector. Be careful not to exceed the max packet length in your optional headers, or your command will be rejected. It is recommended that you call getMaxPacketLength on your session before issuing this command so you know how much data the session's target will accept in a single transaction.


OBEXDisconnectResponse


Send a disconnect response to a session's target.

See Also:

OBEXDisconnectResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXDisconnectResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXDisconnectResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXDisconnectResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send a disconnect response to a session's target.

See Also:

OBEXDisconnectResponse

-(OBEXError)OBEXDisconnectResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXDisconnectResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXGet


Send an OBEX Get command to the session's target.

See Also:

OBEXGet:headers:headersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXGet:(Boolean)isFinalChunk headers:(void*)inHeaders headersLength:(size_t)inHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
isFinalChunk

Specify if this request is complete in one shot - that all the headers you are supplying will fit in the negotiated max packet length.

inHeadersData

Can be NULL. Ptr to some data you want to send as your headers, such as Length, Name, etc. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for your convenience.

inHeadersDataLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXGetHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXGet:headers:headersLength:eventSelector:selectorTarget:refCon:


Send an OBEX Get command to the session's target.

See Also:

OBEXGet

-(OBEXError)OBEXGet:(Boolean)isFinalChunk headers:(void*)inHeaders headersLength:(size_t)inHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
isFinalChunk

Specify if this request is complete in one shot - that all the headers you are supplying will fit in the negotiated max packet length.

inHeadersData

Can be NULL. Ptr to some data you want to send as your headers, such as Length, Name, etc. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for your convenience.

inHeadersDataLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXGetHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXGetResponse


Send a get response to a session's target.

See Also:

OBEXGetResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXGetResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXGetResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXGetResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send a get response to a session's target.

See Also:

OBEXGetResponse

-(OBEXError)OBEXGetResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXGetResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXPut


Send an OBEX Put command to the session's target.

See Also:

OBEXPut:headersData:headersDataLength:bodyData:bodyDataLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXPut:(Boolean)isFinalChunk headersData:(void*)inHeadersData headersDataLength:(size_t)inHeadersDataLength bodyData:(void*)inBodyData bodyDataLength:(size_t)inBodyDataLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
isFinalChunk

Specify if this request is complete in one shot - that all the headers you are supplying will fit in the negotiated max packet length.

inHeadersData

Can be NULL. Ptr to some data you want to send as your headers, such as Length, Name, etc. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inHeadersDataLength

Length of data in ptr passed in above.

inBodyData

Can be NULL. Ptr to some data you want to send as your BODY header. Do not construct a real OBEX header here, it will be done for you - just pass a pointer to your data, we'll do the rest. HOWEVER, be aware that some overhead (3 bytes) will be added to the data in constructing the BODY header for you.

inBodyDataLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXPutHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXPut:headersData:headersDataLength:bodyData:bodyDataLength:eventSelector:selectorTarget:refCon:


Send an OBEX Put command to the session's target.

See Also:

OBEXPut

-(OBEXError)OBEXPut:(Boolean)isFinalChunk headersData:(void*)inHeadersData headersDataLength:(size_t)inHeadersDataLength bodyData:(void*)inBodyData bodyDataLength:(size_t)inBodyDataLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
isFinalChunk

Specify if this request is complete in one shot - that all the headers you are supplying will fit in the negotiated max packet length.

inHeadersData

Can be NULL. Ptr to some data you want to send as your headers, such as Length, Name, etc. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inHeadersDataLength

Length of data in ptr passed in above.

inBodyData

Can be NULL. Ptr to some data you want to send as your BODY header. Do not construct a real OBEX header here, it will be done for you - just pass a pointer to your data, we'll do the rest. HOWEVER, be aware that some overhead (3 bytes) will be added to the data in constructing the BODY header for you.

inBodyDataLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXPutHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXPutResponse


Send a put response to a session's target.

See Also:

OBEXPutResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXPutResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXPutResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXPutResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send a put response to a session's target.

See Also:

OBEXPutResponse

-(OBEXError)OBEXPutResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXPutResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXSetPath


Send an OBEX SetPath command to the session's target.

See Also:

OBEXSetPath:constants:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXSetPath:(OBEXFlags)inFlags constants:(OBEXConstants)inConstants optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inFlags

OBEX setpath flags. See OBEX.h for possibilities.

inConstants

OBEX setpath constants. See OBEX.h for possibilities.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXSetPathHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXSetPath:constants:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send an OBEX SetPath command to the session's target.

See Also:

OBEXSetPath

-(OBEXError)OBEXSetPath:(OBEXFlags)inFlags constants:(OBEXConstants)inConstants optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inFlags

OBEX setpath flags. See OBEX.h for possibilities.

inConstants

OBEX setpath constants. See OBEX.h for possibilities.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXSetPathHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the transport. You will receive a response to your command on your selector.


OBEXSetPathResponse


Send a set path response to a session's target.

See Also:

OBEXSetPathResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:

-(OBEXError)OBEXSetPathResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXSetPathResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Return Value

An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


OBEXSetPathResponse:optionalHeaders:optionalHeadersLength:eventSelector:selectorTarget:refCon:


Send a set path response to a session's target.

See Also:

OBEXSetPathResponse

-(OBEXError)OBEXSetPathResponse:(OBEXOpCode)inResponseOpCode optionalHeaders:(void*)inOptionalHeaders optionalHeadersLength:(size_t)inOptionalHeadersLength eventSelector:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inMaxPacketLength

Maximum packet size you want your OBEX session to communicate with. This MUST be lower than the max packet size the client has reported to you in the connect command you received from it.

inOptionalHeaders

Can be NULL. Ptr to some data you want to send as your optional headers. Use the provided header contruction kit in OBEX.h and OBEXHeadersToBytes() for convenience.

inOptionalHeadersLength

Length of data in ptr passed in above.

inSelector

A VALID selector to be called when something interesting happens due to this call. Selector in your target object MUST have the following signature, or it will not be called properly (look for error messages in Console.app):

- (void)OBEXSetPathResponseHandler:(const OBEXSessionEvent*)inSessionEvent;

inTarget

A VALID target object for the selector.

inUserRefCon

Whatever you want to pass here. It will be passed back to you in the refCon portion of the OBEXSessionEvent struct. nil is, of course, OK here.

Discussion

A NULL selector or target will result in an error. After return, the data passed in will have been sent over the underlying OBEX transport. You will receive any responses to your command response on your selector.


openTransportConnection


Opens a transport connection to a device. A Bluetooth connection is one example of a transport.

See Also:

openTransportConnection:selectorTarget:refCon:

-(OBEXError)openTransportConnection:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inSelector

Selector to call for success, failure or timeout.

inTarget

Target on which to call the selector.

inUserRefCon

Caller's reference constant.

Return Value

Should return kOBEXSuccess ( 0 ) on success, otherwise an error code.

Discussion

Tranport subclasses must override this! when called you should attempt to open your transport connection, and if you are successful, return kOBEXSuccess, otherwise an interesting error code.


openTransportConnection:selectorTarget:refCon:


Opens a transport connection to a device. A Bluetooth connection is one example of a transport.

See Also:

openTransportConnection

-(OBEXError)openTransportConnection:(SEL)inSelector selectorTarget:(id)inTarget refCon:(void *)inUserRefCon; 
Parameters
inSelector

Selector to call for success, failure or timeout.

inTarget

Target on which to call the selector.

inUserRefCon

Caller's reference constant.

Discussion

Tranport subclasses must override this! when called you should attempt to open your transport connection, and if you are successful, return kOBEXSuccess, otherwise an interesting error code.


sendDataToTransport


You must override this to send data over your transport. This does nothing by default, it will return a kOBEXUnsupportedError.

See Also:

sendDataToTransport:dataLength:

-(OBEXError)sendDataToTransport:(void *)inDataToSend dataLength:(size_t)inDataLength; 
Parameters
inDataToSend

Data to shove over the transport to a remote OBEX session.

inDataLength

Length of data passed in.

Return Value

Return whether or not the transport could send the data or not. If you are successful, return kOBEXSuccess, otherwise an interesting error code.

Discussion

Tranport subclasses must override this! When called you should send the data over the transport to the remote session.


sendDataToTransport:dataLength:


You must override this to send data over your transport. This does nothing by default, it will return a kOBEXUnsupportedError.

See Also:

sendDataToTransport

-(OBEXError)sendDataToTransport:(void *)inDataToSend dataLength:(size_t)inDataLength; 
Parameters
inDataToSend

Data to shove over the transport to a remote OBEX session.

inDataLength

Length of data passed in.

Discussion

Tranport subclasses must override this! When called you should send the data over the transport to the remote session.


serverHandleIncomingData:


Tranport subclasses need to invoke this from their own data-receive handlers. For example, when data is received over a Bluetooth RFCOMM channel in the IOBluetoothOBEXSession, it in turn calls this to dispatch the data. If you do not handle this case, your server session will not work, guaranteed.

-(void) serverHandleIncomingData:(OBEXTransportEvent*)event; 
Parameters
event

New event received from the transport.

Discussion

Tranport subclasses must call this for OBEX server sessions to work!


setEventCallback:


Sets the C-API callback used when the session recieves data.

-(void)setEventCallback:(OBEXSessionEventCallback)inEventCallback; 
Parameters
inEventCallback

Function to callback. Should be non-NULL, unless you are attempting to clear the callback, but doing that doesn't make much sense.

Discussion

This is really not intended for client sessions. Only subclasses would really be interested in using this. They should set these when their subclass object is created, because otherwise they will have no way of receiving the initial command data packet. This is a partner to setEventRefCon, described below.


setEventRefCon:


Sets the C-API callback refCon used when the session recieves data.

-(void)setEventRefCon:(void*)inRefCon; 
Parameters
inRefCon

User's refCon that will get passed when their event callback is invoked.

Discussion

This is really not intended for client sessions. Only subclasses would really be interested in using this. They should set these when their subclass object is created, because otherwise they will have no context in their callback.


setEventSelector


Allow you to set a selector to be called when events occur on the OBEX session.

See Also:

setEventSelector:target:refCon:

-(void)setEventSelector:(SEL)inEventSelector target:(id)inEventSelectorTarget refCon:(id)inUserRefCon; 
Parameters
inEventSelector

Selector to call on the target.

inEventSelectorTarget

Target to be called with the selector.

inUserRefCon

User's refCon that will get passed when their event callback is invoked.

Discussion

Really not needed to be used, since the event selector will get set when an OBEX command is sent out.


setEventSelector:target:refCon:


Allow you to set a selector to be called when events occur on the OBEX session.

See Also:

setEventSelector

-(void)setEventSelector:(SEL)inEventSelector target:(id)inEventSelectorTarget refCon:(id)inUserRefCon; 
Parameters
inEventSelector

Selector to call on the target.

inEventSelectorTarget

Target to be called with the selector.

inUserRefCon

User's refCon that will get passed when their event callback is invoked.

Discussion

Really not needed to be used, since the event selector will get set when an OBEX command is sent out.

Typedefs


OBEXTransportEvent


private

typedef struct OBEXTransportEvent OBEXTransportEvent;
Discussion

You will need to construcy these when data is received, and then pass a pointer to it to one of the incoming data methods defined below. Pass 0 as your status if data was received OK. Otherwise, you can put your own error code in there. For the transport type, be sure to use one of the defined types above.


OBEXTransportEventType


private

typedef uint32_t OBEXTransportEventType;
Discussion

Pass these types in the OBEXTransportEvent, and then pass the struct on to the session object once you have filled it out. This is how you can communicate with the session when events happen - if data is received, the type will be 'kOBEXTransportEventTypeDataReceived'. if an error has occurred on your transport, like the remote target died, you can send a status event with a non-zero value. Since session objects will receive this status code on their event handlers, you should try to pass a useful status/error code, such as an IOReturn value.


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2008-08-07