IDBLUE logo
Public Member Functions | Protected Attributes
IDBlueSession Class Reference
Inheritance diagram for IDBlueSession:
<ISessionHandler> iOSSession

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

Detailed Description

IDBlueSession is the base class for all sessions to an IDBLUE device (IDBLUE supports Bluetooth and USB sessions).


Member Function Documentation

- (BOOL) addDataHandler: (id<IDataHandler>)  handler

Adds a DataReceivedhandler to be notified when data is received from an IDBLUE device.

Parameters:
handlerThe DataReceivedhandler to receive notifications when data is received.
Returns:
TRUE if the handler was added, FALSE otherwise
- (BOOL) addSessionHandler: (id<ISessionHandler>)  handler

Adds an object that will receive session open / close notifications

Parameters:
handlerThe object implementing ISessionHandler to receive open / close notifications from the current IDBlueSession
- (BOOL) close

Close the session to the attached IDBLUE device

Returns:
TRUE if the close was started, FALSE otherwise.
Remarks:
This method is asynchronous. When the session to the IDBLUE device is fully closed, the closed notification will be invoked on the session handler.

Gets the collection of DataReceivedhandlers

- (BOOL) hasDataHandler: (id<IDataHandler>)  handler

Get whether the given DataReceivedhandler object is registered

Parameters:
handlerThe DataReceivedhandler to check for
Returns:
TRUE if the handler was found, FALSE otherwise
- (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.).

Parameters:
handlerThe handler to check for
Returns:
TRUE if the handler is in the list of IDBLUeSessionDelegaets, FALSE otherwise.

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

Returns:
TRUE if open, FALSE otherwise
- (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.

Parameters:
dataThe byte array containing the data received from IDBLUE
lenThe number of bytes in the data array.
- (void) onIDBlueDeviceAdded: (id)  device

Notifies all ISessionHandlers that an IDBLUE device is available

Parameters:
deviceThe IDBLUE device that was added

Reimplemented from <ISessionHandler>.

- (void) onIDBlueDeviceRemoved: (id)  device

Notifies all ISessionHandlers that an IDBLUE device was removed

Parameters:
deviceThe 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

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

Returns:
TRUE if the session was started, FALSE otherwise.
Remarks:
This method is asynchronous. When the session is fully established to an IDBLUE device, the opened notification will be invoked on the session handler.

Get wheter the output stream is available for writing

Remove all DataReceivedhandlers from receiving notifications

Returns:
The number of handlers removed

Removes all session handlers from receiving notifications

Returns:
The number of handlers removed
- (BOOL) removeDataHandler: (id<IDataHandler>)  handler

Remove the DataReceivedhandler from the list of handlers that are notified when data is received from an IDBLUE device

Parameters:
handlerThe DataReceivedhandler to remove
Returns:
TRUE if the handler was removed, FALSE otherwise
- (BOOL) removeSessionHandler: (id<ISessionHandler>)  handler

Remove the given ISessionHandler from the list of deelegaets that are notified of session events (open, close, etc.)

Parameters:
handlerThe ISessionHandler to add
Returns:
TRUE if the handler was removed, FALSE otherwise
- (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.

Send any queued commands to IDBLUE, stopping when no space is available in the output buffer

Returns:
The number of commands sent to IDBLUE.

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

Parameters:
dataByte array to send to IDBLUE
Returns:
The number of bytes sent

The documentation for this class was generated from the following files:

 

Generated on Mon Jan 19 2015 15:47:40
Copyright © 2015 Cathexis Innovations Inc. All Rights Reserved.