![]() |
Public Member Functions | |
(int) | - sendQueuedCommands |
(int) | - sendData: |
(BOOL) | - hasSpaceInOutputBuffer |
(BOOL) | - outputStreamAvailable |
(void) | - onSpaceAvailableInOutputBuffer |
(NSObject *) | - idblueDevice |
(void) | - setIDBlueDevice: |
(int) | - write: |
(BOOL) | - addSessionHandler: |
(BOOL) | - removeSessionHandler: |
(int) | - removeAllSessionHandlers |
(BOOL) | - hasSessionHandler: |
(SessionHandlerCollection *) | - sessionHandlers |
(BOOL) | - addDataHandler: |
(BOOL) | - removeDataHandler: |
(int) | - removeAllDataHandlers |
(BOOL) | - hasDataHandler: |
(ObjectCollection *) | - dataHandlers |
(void) | - onDataReceived:withLen: |
(BOOL) | - isOpen |
(BOOL) | - open |
(BOOL) | - close |
(void) | - onOpened |
(void) | - onOpening |
(void) | - onOpenFailed |
(void) | - onClosed |
(void) | - onClosing |
(void) | - onCloseFailed |
(void) | - onIDBlueDeviceAdded: |
(void) | - onIDBlueDeviceRemoved: |
Protected Attributes | |
ObjectCollection * | _dataHandlers |
SessionHandlerCollection * | _sessionHandlers |
BOOL | _sessionOpen |
NSObject * | _idblueDevice |
ObjectCollection * | _queuedCommands |
IDBlueSession is the base class for all sessions to an IDBLUE device (IDBLUE supports Bluetooth and USB sessions).
- (BOOL) addDataHandler: | (id<IDataHandler>) | handler |
Adds a DataReceivedhandler to be notified when data is received from an IDBLUE device.
handler | The DataReceivedhandler to receive notifications when data is received. |
- (BOOL) addSessionHandler: | (id<ISessionHandler>) | handler |
Adds an object that will receive session open / close notifications
handler | The object implementing ISessionHandler to receive open / close notifications from the current IDBlueSession |
- (BOOL) close |
Close the session to the attached IDBLUE device
- (ObjectCollection *) dataHandlers |
Gets the collection of DataReceivedhandlers
- (BOOL) hasDataHandler: | (id<IDataHandler>) | handler |
Get whether the given DataReceivedhandler object is registered
handler | The DataReceivedhandler to check for |
- (BOOL) hasSessionHandler: | (id<ISessionHandler>) | handler |
Get whether the given ISessionHandler is contained in the list of handlers that are notified of session events (open, close, etc.).
handler | The handler to check for |
- (BOOL) hasSpaceInOutputBuffer |
Get whether there is any space remaning in the output buffer
- (NSObject *) idblueDevice |
Get the current IDBLUE device
- (BOOL) isOpen |
Gets if the current IDBlueSession is open
- (void) onClosed |
Notifies all ISessionHandlers that the session has been closed
- (void) onCloseFailed |
Notifies all ISessionHandlers that the close session has failed
- (void) onClosing |
Notifies all ISessionHandlers that the session is closing
- (void) onDataReceived: | (byte*) | data | |
withLen: | (size_t) | len | |
onDataReceived should be called from within classes deriving from IDBlueSession when incoming data is received from an IDBLUE device. onDataReceived forwards incoming data into the current IDBlueCommandSender object of the IDBlueSession.
data | The byte array containing the data received from IDBLUE |
len | The number of bytes in the data array. |
- (void) onIDBlueDeviceAdded: | (id) | device |
Notifies all ISessionHandlers that an IDBLUE device is available
device | The IDBLUE device that was added |
Reimplemented from <ISessionHandler>.
- (void) onIDBlueDeviceRemoved: | (id) | device |
Notifies all ISessionHandlers that an IDBLUE device was removed
device | The IDBLUE device that was removed |
Reimplemented from <ISessionHandler>.
- (void) onOpened |
Notifies all ISessionHandlers that the session has been opened
- (void) onOpenFailed |
Notifies all ISessionHandlers that opening the session has failed
- (void) onOpening |
Notifies all ISessionHandlers that the session is opening
- (void) onSpaceAvailableInOutputBuffer |
This method should be called by subclasses of IDBlueSession when space is available in the output buffer. Calling this method will send queued commands to IDBLUE
- (BOOL) open |
Open a session to the attached IDBLUE device
- (BOOL) outputStreamAvailable |
Get wheter the output stream is available for writing
- (int) removeAllDataHandlers |
Remove all DataReceivedhandlers from receiving notifications
- (int) removeAllSessionHandlers |
Removes all session handlers from receiving notifications
- (BOOL) removeDataHandler: | (id<IDataHandler>) | handler |
Remove the DataReceivedhandler from the list of handlers that are notified when data is received from an IDBLUE device
handler | The DataReceivedhandler to remove |
- (BOOL) removeSessionHandler: | (id<ISessionHandler>) | handler |
Remove the given ISessionHandler from the list of deelegaets that are notified of session events (open, close, etc.)
handler | The ISessionHandler to add |
- (int) sendData: | (CByteArray*) | data |
Send data directly to IDBLUE, not queuing the data. This should be called when space becomes available in the output buffer.
- (int) sendQueuedCommands |
Send any queued commands to IDBLUE, stopping when no space is available in the output buffer
Gets the collection of Session handlers
- (void) setIDBlueDevice: | (NSObject*) | device |
Set the current IDBLUE device
- (int) write: | (CByteArray*) | data |
Send data to an IDBLUE device, or queues the data if there is no space available in the output buffer
data | Byte array to send to IDBLUE |