![]() |
00001 00002 // Copyright © 2013 Cathexis Innovations Inc. All rights reserved. 00003 00004 #import <Foundation/Foundation.h> 00005 #import "IDBlueSession.h" 00006 #import "SessionHandler.h" 00007 #import "ResponseHandler.h" 00008 #import "IDBlueResponseProcessor.h" 00009 #import "CommandQueue.h" 00010 #import "PacketQueue.h" 00011 #import "ObjectCollection.h" 00012 #import "SessionHandlerCollection.h" 00013 #import "CommandQueue.h" 00014 #import "GetPropertyClassInfo.h" 00015 00017 #define IDBLUE_SDK_VERSION_NUMBER @"0.7" 00018 00022 @interface IDBlueCoreApi : ResponseHandler <ISessionHandler> { 00023 @private 00024 // The IDBlueSession object that can establish a communication channel 00025 // with an IDBLUE device, and send and receive (binary) data. 00026 IDBlueSession* _session; 00027 00028 // The IDBlueResponseProcessor is used to form IDBlueResponses out of data 00029 // received from IDBLUE via the IDBlueSession object. When responses are 00030 // received, the IDBlueResposneProcessor notifies all registered ResponseHandleres 00031 // of the response. 00032 IDBlueResponseProcessor* _processor; 00033 00034 // The list of IDBlueCommands that have been sent to IDBLUE that are awaiting 00035 // responses from IDBLUE. 00036 CommandQueue* _commandQueue; 00037 00038 // The byte array that will receive the incoming data from IDBLUE, that is used 00039 // by the IDBlueResponseProcessor. 00040 PacketQueue* _receiveBuffer; 00041 00042 // Whether the event handlers for the current IDBlueCoreApi have been hooked up or not. 00043 BOOL _enabled; 00044 00045 // Temporary collection of data eeceived handlers that is used during firmware updating 00046 ObjectCollection* _dataHandlers; 00047 00048 // Temporary collection of session delegats that is used during firmware updating 00049 SessionHandlerCollection* _sessionHandlers; 00050 00051 // The asynchronous response callback method 00052 ResponseHandlerCollection* _responseHandlers; 00053 00054 // PropertyGenerator is used to create IDBlueProperty objects from incoming IDBluePackets 00055 PropertyGenerator* _propertyGenerator; 00056 00057 // ResponseFactory is used to create IDBlueResponses from incoming IDBluePackets 00058 ResponseFactory* _responseFactory; 00059 00060 // GetPropertyClassInfo is used to dynamically create IDBlueProperty responses 00061 GetPropertyClassInfo* _supportedProperties; 00062 00063 // The number of commands sent to IDBLUE 00064 int _commandsSent; 00065 } 00066 00071 -(NSString*) sdkVersion; 00072 00077 -(id) initWithSession: (IDBlueSession*) session; 00078 00082 -(IDBlueSession*) session; 00083 00089 -(void) addResponseHandler: (id<IResponseHandler>) handler; 00090 00096 -(void) removeResponseHandler: (id<IResponseHandler>) handler; 00097 00103 -(void) addSessionHandler: (id<ISessionHandler>) handler; 00104 00111 -(void) removeSessionHandler: (id<ISessionHandler>) handler; 00112 00117 -(BOOL) hasResponseHandler: (id<IResponseHandler>) handler; 00118 00123 -(BOOL) isSessionOpen; 00124 00130 -(BOOL) openSession; 00131 00136 -(BOOL) closeSession; 00137 00142 -(BOOL) disable; 00143 00144 00149 -(BOOL) enable; 00150 00155 -(BOOL) enabled; 00156 00161 -(BOOL) addSupportedCommand: (CommandIdentifier) commandIdentifier 00162 withClassInfo: (Class) classInfo; 00163 00168 -(BOOL) addSupportedProperty: (PropertyIdentifier) property 00169 withClassInfo: (Class) classInfo; 00170 00175 -(SendStatus*) getProperty: (PropertyIdentifier) property 00176 withHandler: (id<IResponseHandler>) handler; 00177 00182 -(SendStatus*) setProperty: (id<IResponseHandler>) handler 00183 withProperty: (PropertyIdentifier) property 00184 withArgs: (void*) args; 00185 00203 -(SendStatus*) sendCommand: (IDBlueCommand*) command 00204 withHandler: (id<IResponseHandler>) handler; 00205 00235 -(SendStatus*) noOp: (id<IResponseHandler>) handler; 00236 00264 -(SendStatus*) noOp; 00265 00298 -(SendStatus*) beginCommands: (id<IResponseHandler>) handler; 00299 00329 -(SendStatus*) beginCommands; 00330 00364 -(SendStatus*) endCommands: (BOOL) success 00365 withHandler: (id<IResponseHandler>) handler; 00366 00398 -(SendStatus*) endCommands: (BOOL) success; 00399 00434 -(SendStatus*) beep: (BeepType) bt 00435 withHandler: (id<IResponseHandler>) handler; 00436 00469 -(SendStatus*) beep: (BeepType) bt; 00470 00502 -(SendStatus*) clearEntries: (id<IResponseHandler>) handler; 00503 00532 -(SendStatus*) clearEntries; 00533 00557 -(SendStatus*) factoryReset; 00558 00580 -(SendStatus*) powerDown; 00581 00615 -(SendStatus*) saveProperties: (id<IResponseHandler>) handler; 00616 00647 -(SendStatus*) saveProperties; 00648 00680 -(SendStatus*) loadProperties: (id<IResponseHandler>) handler; 00681 00710 -(SendStatus*) loadProperties; 00711 00734 -(SendStatus*) turnOffBluetooth; 00735 00771 -(SendStatus*) setScanning: (BOOL) enable 00772 withHandler: (id<IResponseHandler>) handler; 00773 00804 -(SendStatus*) setScanning: (BOOL) enable; 00805 00843 -(SendStatus*) getEntry: (int) index 00844 withHandler: (id<IResponseHandler>) handler; 00845 00880 -(SendStatus*) getEntry: (int) index; 00881 00915 -(SendStatus*) getEntryCount: (id<IResponseHandler>) handler; 00916 00947 -(SendStatus*) getEntryCount; 00948 00982 -(SendStatus*) getBluetoothName: (id<IResponseHandler>) handler; 00983 01014 -(SendStatus*) getBluetoothName; 01015 01051 -(SendStatus*) getStatus: (id<IResponseHandler>) handler; 01052 01085 -(SendStatus*) getStatus; 01086 01121 -(SendStatus*) readTagId: (id<IResponseHandler>) handler; 01122 01154 -(SendStatus*) readTagId; 01155 01187 -(SendStatus*) setBluetoothName: (NSString*) btName 01188 withHandler: (id<IResponseHandler>) handler; 01189 01218 -(SendStatus*) setBluetoothName: btName; 01219 01251 -(SendStatus*) setBluetoothPin: (NSString*) pin 01252 withHandler: (id<IResponseHandler>) handler; 01253 01282 -(SendStatus*) setBluetoothPin: (NSString*) pin; 01283 01315 -(SendStatus*) getTimestamp: (id<IResponseHandler>) handler; 01316 01345 -(SendStatus*) getTimestamp; 01346 01379 -(SendStatus*) getDuplicateElimination: (id<IResponseHandler>) handler; 01380 01410 -(SendStatus*) getDuplicateElimination; 01411 01443 -(SendStatus*) getRfidTimeout: (id<IResponseHandler>) handler; 01444 01473 -(SendStatus*) getRfidTimeout; 01474 01506 -(SendStatus*) getBluetoothTimeout: (id<IResponseHandler>) handler; 01507 01537 -(SendStatus*) getBluetoothTimeout; 01538 01571 -(SendStatus*) getConnectToHost: (id<IResponseHandler>) handler; 01572 01602 -(SendStatus*) getConnectToHost; 01603 01636 -(SendStatus*) getActionButtonEnabled: (id<IResponseHandler>) handler; 01637 01668 -(SendStatus*) getActionButtonEnabled; 01669 01702 -(SendStatus*) getContinuousScanTimeout: (id<IResponseHandler>) handler; 01703 01733 -(SendStatus*) getContinuousScanTimeout; 01734 01766 -(SendStatus*) getDeviceTimeout: (id<IResponseHandler>) handler; 01767 01796 -(SendStatus*) getDeviceTimeout; 01797 01829 -(SendStatus*) getHoldToScan: (id<IResponseHandler>) handler; 01830 01859 -(SendStatus*) getHoldToScan; 01860 01892 -(SendStatus*) getBuzzerEnabled: (id<IResponseHandler>) handler; 01893 01922 -(SendStatus*) getBuzzerEnabled; 01923 01956 -(SendStatus*) getContinuousScanEnabled: (id<IResponseHandler>) handler; 01957 01987 -(SendStatus*) getContinuousScanEnabled; 01988 02020 -(SendStatus*) getEnforceTimestamp: (id<IResponseHandler>) handler; 02021 02051 -(SendStatus*) getEnforceTimestamp; 02052 02084 -(SendStatus*) getConnectedMode: (id<IResponseHandler>) handler; 02085 02114 -(SendStatus*) getConnectedMode; 02115 02147 -(SendStatus*) getDisconnectedMode: (id<IResponseHandler>) handler; 02148 02177 -(SendStatus*) getDisconnectedMode; 02178 02210 -(SendStatus*) getRfidProtocol: (id<IResponseHandler>) handler; 02211 02240 -(SendStatus*) getRfidProtocol; 02241 02273 -(SendStatus*) getBootloaderVersion: (id<IResponseHandler>) handler; 02274 02304 -(SendStatus*) getBootloaderVersion; 02305 02337 -(SendStatus*) getVersionInfo: (id<IResponseHandler>) handler; 02338 02367 -(SendStatus*) getVersionInfo; 02368 02405 -(SendStatus*) setTimestamp: (IDBlueTimestamp*) timestamp 02406 withHandler: (id<IResponseHandler>) handler; 02407 02441 -(SendStatus*) setTimestamp: (IDBlueTimestamp*) timestamp; 02442 02475 -(SendStatus*) setDuplicateElimination: (ushort) dupElim 02476 withHandler: (id<IResponseHandler>) handler; 02477 02507 -(SendStatus*) setDuplicateElimination: (ushort) dupElim; 02508 02540 -(SendStatus*) setRfidTimeout: (byte) timeout 02541 withHandler: (id<IResponseHandler>) handler; 02542 02571 -(SendStatus*) setRfidTimeout: (byte) timeout; 02572 02604 -(SendStatus*) setBluetoothTimeout: (byte) timeout 02605 withHandler: (id<IResponseHandler>) handler; 02606 02635 -(SendStatus*) setBluetoothTimeout: (byte) timeout; 02636 02669 -(SendStatus*) setContinuousScanTimeout: (byte) timeout 02670 withHandler: (id<IResponseHandler>) handler; 02671 02701 -(SendStatus*) setContinuousScanTimeout: (byte) timeout; 02702 02734 -(SendStatus*) setDeviceTimeout: (byte) timeout 02735 withHandler: (id<IResponseHandler>) handler; 02736 02765 -(SendStatus*) setDeviceTimeout: (byte) timeout; 02766 02798 -(SendStatus*) setHoldToScan: (BOOL) enabled 02799 withHandler: (id<IResponseHandler>) handler; 02800 02829 -(SendStatus*) setHoldToScan: (BOOL) enabled; 02830 02862 -(SendStatus*) setBuzzerEnabled: (BOOL) enabled 02863 withHandler: (id<IResponseHandler>) handler; 02864 02893 -(SendStatus*) setBuzzerEnabled: (BOOL) enabled; 02894 02926 -(SendStatus*) setConnectToHost: (BOOL) connectToHost 02927 withHandler: (id<IResponseHandler>) handler; 02928 02958 -(SendStatus*) setConnectToHost: (BOOL) connectToHost; 02959 02960 02992 -(SendStatus*) setActionButtonEnabled: (BOOL) actionButtonEnabled 02993 withHandler: (id<IResponseHandler>) handler; 02994 03023 -(SendStatus*) setActionButtonEnabled: (BOOL) actionButtonEnabled; 03024 03025 03057 -(SendStatus*) setContinuousScanEnabled: (BOOL) enabled 03058 withHandler: (id<IResponseHandler>) handler; 03059 03088 -(SendStatus*) setContinuousScanEnabled: (BOOL) enabled; 03089 03125 -(SendStatus*) setEnforceTimestamp: (BOOL) enforce 03126 withHandler: (id<IResponseHandler>) handler; 03127 03160 -(SendStatus*) setEnforceTimestamp: (BOOL) enforce; 03161 03199 -(SendStatus*) setConnectedMode: (ConnectedMode) mode 03200 withHandler: (id<IResponseHandler>) handler; 03201 03236 -(SendStatus*) setConnectedMode: (ConnectedMode) mode; 03237 03274 -(SendStatus*) setDisconnectedMode: (DisconnectedMode) mode 03275 withHandler: (id<IResponseHandler>) handler; 03276 03310 -(SendStatus*) setDisconnectedMode: (DisconnectedMode) mode; 03311 03344 -(SendStatus*) setRfidProtocol: (RfidProtocol) protocol 03345 withHandler: (id<IResponseHandler>) handler; 03346 03376 -(SendStatus*) setRfidProtocol: (RfidProtocol) protocol; 03377 03378 @end