ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth Framework Reference
|
IOBluetoothRFCOMMChannel |
Inherits from: | IOBluetoothObject |
Declared In: |
An instance of this class represents an RFCOMM channel as defined by the Bluetooth SDP spec.
An RFCOMM channel object can be obtained by opening an RFCOMM channel in a device, or by requesting a notification when a channel is created (this is commonly used to provide services).
Returns the object's RFCOMM channel ID.
Close the channel.
Returns the object's RFCOMM channel ID.
Returns the Bluetooth Device that carries the RFCOMM data.
Returns the channel maximum transfer unit.
Returns the IOBluetoothObjectID of the given IOBluetoothRFCOMMChannel.
Returns an IOBluetoothRFCOMMChannelRef representation of the target IOBluetoothRFCOMMChannel object.
Returns the direction of the channel. An incoming channel is one that was opened by the remote device.
Returns the state of the channel.
Returns TRUE if flow control is off.
Allows a client to register for a channel close notification.
Allows a client to register for RFCOMM channel open notifications for any RFCOMM channel.
Allows a client to register for RFCOMM channel open notifications for certain types of RFCOMM channels.
Registers a callback for incoming data.
Registers a callback for incoming data.
Registers a callback for events.
Registers a callback for events.
Sends an error to the remote side.
Allows an object to register itself as a client of the RFCOMM channel.
Changes the parameters of the serial connection.
Returns the IObluetoothRFCOMMChannel with the given IOBluetoothObjectID.
Method call to convert an IOBluetoothRFCOMMChannelRef into an IOBluetoothRFCOMMChannel *.
Sends a block of data in the channel syncronously.
Sends a block of data in the channel asynchronously.
Sends a block of data in the channel.
Sends a block of data in the channel synchronously.
Sends a block of data in the channel synchronously.
channelNumber |
Returns the object's RFCOMM channel ID.
See Also:
getChannelID
- (BluetoothRFCOMMChannelID)getChannelID;
Returns the RFCOMM channel number.
closeChannel |
Close the channel.
- (IOReturn)closeChannel;
An error code value. 0 if successful.
getChannelID |
Returns the object's RFCOMM channel ID.
See Also:
channelNumber
- (BluetoothRFCOMMChannelID)getChannelID;
getDevice |
Returns the Bluetooth Device that carries the RFCOMM data.
- (IOBluetoothDevice *)getDevice;
Returns the IOBluetoothDevice object.
getMTU |
Returns the channel maximum transfer unit.
- (BluetoothRFCOMMMTU)getMTU;
Channel MTU size.
Returns the length of the largest chunk of data that this channel can carry. If the caller wishes to use the write:length:sleep: api the length of the data can not be bigger than the channel MTU (maximum transfer unit).
getObjectID |
Returns the IOBluetoothObjectID of the given IOBluetoothRFCOMMChannel.
- (IOBluetoothObjectID)getObjectID;
Returns the IOBluetoothObjectID of the given IOBluetoothRFCOMMChannel.
The IOBluetoothObjectID can be used as a global reference for a given IOBluetoothRFCOMMChannel. It allows two separate applications to refer to the same IOBluetoothRFCOMMChannel.
getRFCOMMChannelRef |
Returns an IOBluetoothRFCOMMChannelRef representation of the target IOBluetoothRFCOMMChannel object.
- (IOBluetoothRFCOMMChannelRef)getRFCOMMChannelRef;
Returns an IOBluetoothRFCOMMChannelRef representation of the target IOBluetoothRFCOMMChannel object.
isIncoming |
Returns the direction of the channel. An incoming channel is one that was opened by the remote device.
- (BOOL)isIncoming;
Returns TRUE if the channel was opened by the remote device, FALSE if the channel was opened by this object.
isOpen |
Returns the state of the channel.
- (BOOL)isOpen;
TRUE if the channel state is open, FALSE otherwise.
note that "not open" means closed, opening and closing.
isTransmissionPaused |
Returns TRUE if flow control is off.
- (BOOL)isTransmissionPaused;
TRUE if the action of sending data will block the current thread, FALSE otherwise.
Returns true if the remote device flow control is stopping out transmission. This is useful because we do not buffer data, we stop the transmitting actor. With this method the transmitter can check if sending data is going to be successful or is going to block.
registerForChannelCloseNotification:selector: |
Allows a client to register for a channel close notification.
- (IOBluetoothUserNotification *) registerForChannelCloseNotification:(id)observer selector:(SEL)inSelector;
observer
Target observer object
inSelector
Selector to be sent to the observer when the RFCOMM channel is closed.
Returns an IOBluetoothUserNotification representing the outstanding RFCOMM channel close notification. To unregister the notification, call -unregister of the returned IOBluetoothUserNotification object. If an error is encountered creating the notification, nil is returned.
The given selector will be called on the target observer when the RFCOMM channel is closed. The selector should contain two arguments. The first is the user notification object. The second is the IOBluetoothRFCOMMChannel that was closed.
registerForChannelOpenNotifications:selector: |
Allows a client to register for RFCOMM channel open notifications for any RFCOMM channel.
+ (IOBluetoothUserNotification *) registerForChannelOpenNotifications:(id)object selector:(SEL)selector;
rfcommChannelRef
IOBluetoothRFCOMMChannelRef for which an IOBluetoothRFCOMMChannel * is desired.
object
Target object
selector
Selector to be called on the target object when a new RFCOMM channel is opened. The format for the selector is: -(void) selectorName:(IOBluetoothUserNotification *)inNotification channel:(IOBluetoothRFCOMMChannel *)newChannel
Returns an IOBluetoothUserNotification representing the outstanding RFCOMM channel notification. To unregister the notification, call -unregister on the resulting IOBluetoothUserNotification object. If an error is encountered creating the notification, nil is returned. The returned IOBluetoothUserNotification will be valid for as long as the notification is registered. It is not necessary to retain the result. Once -unregister is called on it, it will no longer be valid.
The given selector will be called on the target object whenever any RFCOMM channel is opened. The selector should accept two arguments. The first is the user notification object. The second is the IOBluetoothRFCOMMChannel that was opened.
registerForChannelOpenNotifications:selector:withChannelID:direction: |
Allows a client to register for RFCOMM channel open notifications for certain types of RFCOMM channels.
+ (IOBluetoothUserNotification *) registerForChannelOpenNotifications:(id)object selector:(SEL)selector withChannelID:(BluetoothRFCOMMChannelID)channelID direction:(IOBluetoothUserNotificationChannelDirection)inDirection;
object
Target object
selector
Selector to be called on the target object when a new RFCOMM channel is opened. the format for the selector is: -(void) selectorName:(IOBluetoothUserNotification *)inNotification channel:(IOBluetoothRFCOMMChannel *)newChannel
channelID
RFCOMM channel ID to match a new RFCOMM channel. If the channel ID doesn't matter, 0 may be passed in.
inDirection
The desired direction of the RFCOMM channel - kIOBluetoothUserNotificationChannelDirectionAny if the direction doesn't matter.
Returns an IOBluetoothUserNotification representing the outstanding RFCOMM channel notification. To unregister the notification, call -unregister on the resulting IOBluetoothUserNotification object. If an error is encountered creating the notification, nil is returned. The returned IOBluetoothUserNotification will be valid for as long as the notification is registered. It is not necessary to retain the result. Once -unregister is called on it, it will no longer be valid.
The given selector will be called on the target object whenever an RFCOMM channel with the given attributes is opened. The selector should accept two arguments. The first is the user notification object. The second is the IOBluetoothL2CAPChannel that was opened.
registerIncomingDataListener:refCon: |
Registers a callback for incoming data.
See Also:
registerIncomingDataListener:refCon:refCon:
- (IOReturn)registerIncomingDataListener:(IOBluetoothRFCOMMChannelIncomingDataListener)listener refCon:(void *)refCon DEPRECATED_IN_BLUETOOTH_VERSION_2_0_AND_LATER;
listener
is the callback function.
refCon
is a void*, its meaning is up to the developer. This parameter will be passed back as last parameter of the callback function.
***WARNING*** This method is being deprecated in favor of -setDelegate: Registers a callback for the incoming data. The form for the callback is:
void function(IOBluetoothRFCOMMChannelRef rfcommChannel, void *data, UInt16 length, void *refCon)
where rfcommChannel is the refernce to the channel that received data, data is a buffer with the received data, length is the buffer length (in bytes) and refCon is a user defined void* (maybe the reference to the object to call back ?).
registerIncomingDataListener:refCon:refCon: |
Registers a callback for incoming data.
See Also:
registerIncomingDataListener:refCon:
- (IOReturn)registerIncomingDataListener:(IOBluetoothRFCOMMChannelIncomingDataListener)listener refCon:(void *)refCon DEPRECATED_IN_BLUETOOTH_VERSION_2_0_AND_LATER;
listener
is the callback function.
refCon
is a void*, its meaning is up to the developer. This parameter will be passed back as last parameter of the callback function.
An error code value. 0 if successful.
***WARNING*** This method is being deprecated in favor of -setDelegate: Registers a callback for the incoming data. The form for the callback is:
void function(IOBluetoothRFCOMMChannelRef rfcommChannel, void *data, UInt16 length, void *refCon)
where rfcommChannel is the refernce to the channel that received data, data is a buffer with the received data, length is the buffer length (in bytes) and refCon is a user defined void* (maybe the reference to the object to call back ?).
registerIncomingEventListener:refCon: |
Registers a callback for events.
See Also:
registerIncomingEventListener:refCon:refCon:
- (IOReturn)registerIncomingEventListener:(IOBluetoothRFCOMMChannelIncomingEventListener)listener refCon:(void *)refCon;
listener
is the callback function.
refCon
is a void*, its meaning is up to the developer. This parameter will be passed back as second parameter of the callback function.
***WARNING*** This method is being deprecated in favor of -setDelegate: Registers a callback for events generated by the RFCOMM channel. The form for the callback is:
void function(IOBluetoothRFCOMMChannelRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event)
where rfcommChannel is the reference to the channel that generated the event, refCon is a user defined void* (maybe the reference to the object to call back?) and event is the generated event. There are three types of events available:
kIOBluetoothRFCOMMNewDataEvent when new data is received.
kIOBluetoothRFCOMMFlowControlChangedEvent change of flow control.
kIOBluetoothRFCOMMChannelTerminatedEvent when the RFCOMM channel is no more valid.
Note that the kIOBluetoothRFCOMMNewDataEvent provides the same functionality of the data listener callback. This means that if the developer has both an event callback and a datalistener callback both functions will be called when new data arrives. It is up to the developer to properly filter the events (or better to use only one callback). For a better descriptions of the events and the event structure see IOBluetoothUserLib.h.
registerIncomingEventListener:refCon:refCon: |
Registers a callback for events.
See Also:
registerIncomingEventListener:refCon:
- (IOReturn)registerIncomingEventListener:(IOBluetoothRFCOMMChannelIncomingEventListener)listener refCon:(void *)refCon;
listener
is the callback function.
refCon
is a void*, its meaning is up to the developer. This parameter will be passed back as second parameter of the callback function.
An error code value. 0 if successful.
***WARNING*** This method is being deprecated in favor of -setDelegate: Registers a callback for events generated by the RFCOMM channel. The form for the callback is:
void function(IOBluetoothRFCOMMChannelRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event)
where rfcommChannel is the reference to the channel that generated the event, refCon is a user defined void* (maybe the reference to the object to call back?) and event is the generated event. There are three types of events available:
kIOBluetoothRFCOMMNewDataEvent when new data is received.
kIOBluetoothRFCOMMFlowControlChangedEvent change of flow control.
kIOBluetoothRFCOMMChannelTerminatedEvent when the RFCOMM channel is no more valid.
Note that the kIOBluetoothRFCOMMNewDataEvent provides the same functionality of the data listener callback. This means that if the developer has both an event callback and a datalistener callback both functions will be called when new data arrives. It is up to the developer to properly filter the events (or better to use only one callback). For a better descriptions of the events and the event structure see IOBluetoothUserLib.h.
sendRemoteLineStatus: |
Sends an error to the remote side.
- (IOReturn)sendRemoteLineStatus:(BluetoothRFCOMMLineStatus)lineStatus;
lineStatus
the error type. The error code can be NoError, OverrunError, ParityError or FramingError.
An error code value. 0 if successful.
setDelegate: |
Allows an object to register itself as a client of the RFCOMM channel.
- (IOReturn)setDelegate:(id)delegate;
delegate
The object that will play the role of channel delegate [NOTE the rfcomm channel will reatin the delegate].
Returns kIOReturnSuccess if the delegate is successfully registered.
A channel delegate is the object the RFCOMM channel uses as target for data and events. The developer will implement only the the methods he/she is interested in. A list of the possible methods is at the end of this file in the definition of the informal protocol IOBluetoothRFCOMMChannelDelegate.
NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
setSerialParameters:dataBits:parity:stopBits: |
Changes the parameters of the serial connection.
- (IOReturn)setSerialParameters:(UInt32)speed dataBits:(UInt8)nBits parity:(BluetoothRFCOMMParityType)parity stopBits:(UInt8)bitStop;
speed
the baudrate.
nBits
number of data bits.
parity
the type of parity can be NoParity, OddParity, EvenParity or MaxParity.
bitStop
number of stop bits.
An error code value. 0 if successful.
withObjectID: |
Returns the IObluetoothRFCOMMChannel with the given IOBluetoothObjectID.
+ (IOBluetoothRFCOMMChannel *)withObjectID:(IOBluetoothObjectID)objectID;
objectID
IOBluetoothObjectID of the desired IObluetoothRFCOMMChannel.
Returns the IObluetoothRFCOMMChannel that matches the given IOBluetoothObjectID if one exists. If no matching RFCOMM channel exists, nil is returned.
The IOBluetoothObjectID can be used as a global reference for a given IObluetoothRFCOMMChannel. It allows two separate applications to refer to the same IObluetoothRFCOMMChannel object.
withRFCOMMChannelRef: |
Method call to convert an IOBluetoothRFCOMMChannelRef into an IOBluetoothRFCOMMChannel *.
+ (IOBluetoothRFCOMMChannel *)withRFCOMMChannelRef:(IOBluetoothRFCOMMChannelRef)rfcommChannelRef;
rfcommChannelRef
IOBluetoothRFCOMMChannelRef for which an IOBluetoothRFCOMMChannel * is desired.
Returns the IOBluetoothRFCOMMChannel * for the given IOBluetoothRFCOMMChannelRef.
write:length:sleep: |
Sends a block of data in the channel syncronously.
- (IOReturn)write:(void *)data length:(UInt16)length sleep:(BOOL)sleep DEPRECATED_IN_BLUETOOTH_VERSION_2_0_AND_LATER;
data
is a pointer to the data buffer to be sent.
length
the length of the buffer to be sent (in bytes).
sleep
is a boolean if set to TRUE the call will wait until it is possible to send data. If set to FALSE and it is not possible to send data the method will return immediately with an error.
An error code value. 0 if successful.
***WARNING*** This method is being deprecated in favor of -writeSync:... and -writeAsync:... Sends data tough the channel. The number of bytes to be sent must not exceed the channel MTU. If the return value is an error condition none of the data was sent.
writeAsync:length:refcon: |
Sends a block of data in the channel asynchronously.
- (IOReturn)writeAsync:(void *)data length:(UInt16)length refcon:(void*)refcon;
data
A pointer to the data buffer to be sent.
length
The length of the buffer to be sent (in bytes).
refcon
User supplied value that gets passed to the write callback.
Returns kIOReturnSuccess if the data was buffered successfully.
The number of bytes to be sent must not exceed the channel MTU. If the return value is an error condition none of the data was sent. Once the data has been successfully passed to the hardware to be transmitted, the delegate method -rfcommChannelWriteComplete:refcon:status: will be called with the refcon that was passed to this method.
NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
writeSimple:length:sleep:bytesSent: |
Sends a block of data in the channel.
- (IOReturn)writeSimple:(void *)data length:(UInt16)length sleep:(BOOL)sleep bytesSent:(UInt32 *)numBytesSent DEPRECATED_IN_BLUETOOTH_VERSION_2_0_AND_LATER;
data
a pointer to the data buffer to be sent.
length
the length of the buffer to be sent (in bytes).
sleep
a boolean if set to TRUE the call will wait until it is possible to send all the data.
numBytesSent
a UInt32 pointer in which the caller received the nuber of bytes sent. If set to FALSE and it is not possible to send part of the data the method will return immediately.
An error code value. 0 if successful.
***WARNING*** This method is being deprecated in favor of -writeSync:... and -writeAsync:... Sends data tough the channel. The number of bytes to be sent is arbitrary. The caller does not have to worry about the MTU.
writeSync:length: |
Sends a block of data in the channel synchronously.
See Also:
writeSync:length:refcon:
- (IOReturn)writeSync:(void *)data length:(UInt16)length;
data
A pointer to the data buffer to be sent.
length
The length of the buffer to be sent (in bytes).
Sends data tough the channel. The number of bytes to be sent must not exceed the channel MTU. If the return value is an error condition none of the data was sent. This method will block until the data has been successfully sent to the hardware for transmission (or until an error occurs).
NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
writeSync:length:refcon: |
Sends a block of data in the channel synchronously.
See Also:
writeSync:length:
- (IOReturn)writeSync:(void *)data length:(UInt16)length;
data
A pointer to the data buffer to be sent.
length
The length of the buffer to be sent (in bytes).
Returns kIOReturnSuccess if the data was written successfully.
Sends data tough the channel. The number of bytes to be sent must not exceed the channel MTU. If the return value is an error condition none of the data was sent. This method will block until the data has been successfully sent to the hardware for transmission (or until an error occurs).
NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
|
Last Updated: 2008-08-07