![]() |
00001 00002 // Copyright © 2013 Cathexis Innovations Inc. All rights reserved. 00003 00004 #import <Foundation/Foundation.h> 00005 #import "IDBlue.h" 00006 #import "SessionHandler.h" 00007 #import "IDataHandler.h" 00008 #import "CByteArray.h" 00009 #import "SessionHandlerCollection.h" 00010 #import "ObjectCollection.h" 00011 00016 @interface IDBlueSession : NSObject <ISessionHandler> { 00017 00018 @protected 00019 // Array of handlers that will be notified when incoming data is received 00020 ObjectCollection* _dataHandlers; 00021 00022 // Array of handlers that will be notified of connect / disconnect notifications 00023 SessionHandlerCollection* _sessionHandlers; 00024 00025 // Whether the IDBlueSession is open 00026 BOOL _sessionOpen; 00027 00028 // the current IDBLUE device 00029 NSObject* _idblueDevice; 00030 00031 // Array of pending commands to be sent to IDBLUE 00032 ObjectCollection* _queuedCommands; 00033 } 00034 00039 -(int) sendQueuedCommands; 00040 00045 -(int) sendData: (CByteArray*) data; 00046 00050 -(BOOL) hasSpaceInOutputBuffer; 00051 00055 -(BOOL) outputStreamAvailable; 00056 00061 -(void) onSpaceAvailableInOutputBuffer; 00062 00066 -(NSObject*) idblueDevice; 00067 00071 -(void) setIDBlueDevice: (NSObject*) device; 00072 00078 -(int) write: (CByteArray*) data; 00079 00085 -(BOOL) addSessionHandler: (id<ISessionHandler>) handler; 00086 00093 -(BOOL) removeSessionHandler: (id<ISessionHandler>) handler; 00094 00099 -(int) removeAllSessionHandlers; 00100 00108 -(BOOL) hasSessionHandler: (id<ISessionHandler>) handler; 00109 00113 -(SessionHandlerCollection*) sessionHandlers; 00114 00122 -(BOOL) addDataHandler: (id<IDataHandler>) handler; 00123 00130 -(BOOL) removeDataHandler: (id<IDataHandler>) handler; 00131 00136 -(int) removeAllDataHandlers; 00137 00143 -(BOOL) hasDataHandler: (id<IDataHandler>) handler; 00144 00148 -(ObjectCollection*) dataHandlers; 00149 00158 -(void) onDataReceived: (byte*) data withLen: (size_t) len; 00159 00164 -(BOOL) isOpen; 00165 00173 -(BOOL) open; 00174 00182 -(BOOL) close; 00183 00187 -(void) onOpened; 00188 00192 -(void) onOpening; 00193 00197 -(void) onOpenFailed; 00198 00202 -(void) onClosed; 00203 00207 -(void) onClosing; 00208 00212 -(void) onCloseFailed; 00213 00218 -(void) onIDBlueDeviceAdded: (id) device; 00219 00224 -(void) onIDBlueDeviceRemoved: (id) device; 00225 00226 @end