ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth Framework Reference
|
OBEXSession |
Inherits from: | NSObject |
Declared In: |
Object representing an OBEX connection to a remote target.
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.
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.
You must override this - it will be called when the transport connection should be shutdown.
Determine the maximum amount of data you can send in a particular command as an OBEX client session.
Determine the maximum amount of data you can send in a particular command response as an OBEX server session.
Gets current max packet length.
Has a successful connect packet been sent and received? This API tells you so.
You must override this - it will be called periodically to determine if a transport connection is open or not.
Send an OBEX Abort command to the session's target.
Send an OBEX Abort command to the session's target.
Send a abort response to a session's target.
Send a abort response to a session's target.
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.
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.
Send a connect response to a session's target.
Send a connect response to a session's target.
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.
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.
Send a disconnect response to a session's target.
Send a disconnect response to a session's target.
Send an OBEX Get command to the session's target.
Send an OBEX Get command to the session's target.
Send a get response to a session's target.
Send a get response to a session's target.
Send an OBEX Put command to the session's target.
Send an OBEX Put command to the session's target.
Send a put response to a session's target.
Send a put response to a session's target.
Send an OBEX SetPath command to the session's target.
Send an OBEX SetPath command to the session's target.
Send a set path response to a session's target.
Send a set path response to a session's target.
Opens a transport connection to a device. A Bluetooth connection is one example of a transport.
Opens a transport connection to a device. A Bluetooth connection is one example of a transport.
You must override this to send data over your transport. This does nothing by default, it will return a kOBEXUnsupportedError.
You must override this to send data over your transport. This does nothing by default, it will return a kOBEXUnsupportedError.
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.
Sets the C-API callback used when the session recieves data.
Sets the C-API callback refCon used when the session recieves data.
Allow you to set a selector to be called when events occur on the OBEX session.
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;
event
New event received from the transport.
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 whether or not the transport connection was closed successfully or not. Return OBEXSuccess ( 0 ) on success, otherwise an error code.
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;
inOpCode
The opcode you are interested in sending (as a client).
The maximum amount of data a particular packet can handle, after accounting for any command overhead.
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;
inOpCode
The opcode you are interested in responding to (as a server).
The maximum amount of data a particular packet can handle, after accounting for any command response overhead.
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;
Max packet length.
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;
True or false, we are OBEX-connected to another OBEX entity.
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 whether or not the transport connection is still open.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
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.
An error code value on failure (see OBEX.h and IOReturn.h for possible return values). 0 (kOBEXSuccess) if successful.
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;
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.
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;
inSelector
Selector to call for success, failure or timeout.
inTarget
Target on which to call the selector.
inUserRefCon
Caller's reference constant.
Should return kOBEXSuccess ( 0 ) on success, otherwise an error code.
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;
inSelector
Selector to call for success, failure or timeout.
inTarget
Target on which to call the selector.
inUserRefCon
Caller's reference constant.
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;
inDataToSend
Data to shove over the transport to a remote OBEX session.
inDataLength
Length of data passed in.
Return whether or not the transport could send the data or not. If you are successful, return kOBEXSuccess, otherwise an interesting error code.
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;
inDataToSend
Data to shove over the transport to a remote OBEX session.
inDataLength
Length of data passed in.
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;
event
New event received from the transport.
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;
inEventCallback
Function to callback. Should be non-NULL, unless you are attempting to clear the callback, but doing that doesn't make much sense.
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;
inRefCon
User's refCon that will get passed when their event callback is invoked.
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;
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.
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;
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.
Really not needed to be used, since the event selector will get set when an OBEX command is sent out.
OBEXTransportEvent |
private
typedef struct OBEXTransportEvent OBEXTransportEvent;
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;
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.
|
Last Updated: 2008-08-07