IDBLUE logo
IDBlue.h
00001 
00002 // Copyright © 2013 Cathexis Innovations Inc. All rights reserved.
00003 
00004 
00005 #import <Foundation/Foundation.h>
00006 
00007 void DebugLog(NSString* format, ...);
00008 
00009 typedef unsigned char byte;
00010 
00011 typedef enum _Endianness {
00012     MSB,
00013     LSB
00014 } Endianness;
00015 
00020 typedef enum _CommandIdentifier {
00021         CI_NO_OP                        = 0x00,
00022         CI_GET_TAG_ID                   = 0x01,
00023         CI_BEEP = 0x03,
00024         
00025         CI_SET_PROPERTY = 0x08,
00026         CI_GET_PROPERTY = 0x09,
00027         
00028         CI_SAVE_PROPERTIES = 0x10,
00029         CI_LOAD_PROPERTIES = 0x11,
00030         
00031         CI_READ_BLOCK           = 0x12,
00032         CI_READ_BLOCKS          = 0x13,
00033         CI_WRITE_BLOCK          = 0x15,
00034         CI_WRITE_BLOCKS = 0x16,
00035         CI_GET_TAG_INFO = 0x18,
00036         CI_LOCK_BLOCK           = 0x19,
00037         
00038         //UHF
00039         CI_WRITE_UHF       = 0x36,
00040         CI_READ_UHF        = 0x37,
00041         CI_LOCK_UHF        = 0x38,
00042         CI_SET_KILL_PWD    = 0x39,
00043         CI_KILL            = 0x3A,
00044         
00045         
00046         CI_GET_STATUS           = 0x23,
00047         
00048         CI_SET_SCANNING = 0x32,
00049         
00050         CI_BOOTLOADER_MODE = 0x3c,
00051         
00052         CI_SET_BT_PIN      = 0x40,
00053         CI_GET_BT_PIN           = 0x41,
00054         
00055         CI_SET_BT_NAME          = 0x42,
00056         CI_GET_BT_NAME          = 0x43,
00057         
00058         CI_BOOTLOADER_ACTIVE = 0x5e,
00059         
00060         CI_GET_ENTRY_COUNT = 0x60,
00061         CI_GET_ENTRY = 0x61,
00062         CI_CLEAR_ENTRIES = 0x62,
00063         
00064         CI_ASYNC_PACKET = 0x70,
00065         
00066         CI_FACTORY_RESET = 0x74,
00067         
00068         CI_BEGIN_COMMANDS               = 0x80,
00069         CI_END_COMMANDS         = 0x88,
00070         
00071         CI_POWER_DOWN           = 0x91,
00072         CI_TURN_OFF_BT          = 0x92,
00073         CI_TURN_ON_BT     = 0x93,
00074         
00075         CI_HEARTBEAT = 0x96,
00076         CI_ENABLE_CHANNEL = 0x97,
00077         
00078         CI_NACK                 = 0x1F,
00079         CI_BUTTON                       = 0xFF
00080 } CommandIdentifier;
00081 
00086 typedef enum _CommandStatus {
00087         
00089         CS_Ok = 0x00,
00090         
00092         CS_Failed = 0x01,
00093         
00095         CS_Error = 0x02,
00096         
00098         CS_NotImplemented = 0x03,
00099         
00101         CS_Timeout = 0x04,
00102         
00104         CS_InvalidCommandIdentifier = 0x05,
00105         
00107         CS_NotPermitted = 0x06,
00108         
00110         CS_ChecksumFailed = 0x07,
00111         
00113         CS_Deprecated = 0x08,
00114         
00116         CS_InvalidProperty = 0x51,
00117         
00119         CS_InvalidValue = 0x52,
00120         
00122         CS_InvalidIndex = 0x53,
00123         
00128         CS_TagBlockCountExceeded = 0x54,
00129         
00131         CS_BufferOverflow = 0x55,
00132         
00134         CS_IncompleteOperation = 0x56,
00135         
00140         CS_Muted = 0x57,
00141         
00143         CS_NoData = 0x1000,
00144         
00146         CS_Bootloader = 0x1002,
00147         
00149         CS_IDBlueDriverDisposing = 0x1003,
00150         
00152         CS_IDBlueDriverNotReady = 0x1004,
00153         
00155         CS_NoResponseRequired = 0x1005,
00156         
00158         CS_InvalidData = 0x1007
00159 } CommandStatus;
00160 
00162 typedef enum _BeepType {
00163         BT_Low = 0,
00164         BT_High = 1,
00165         BT_High2Low = 2,
00166         BT_Low2High = 3,
00167         BT_LowLow = 4,
00168         BT_HighHigh = 5 
00169 } BeepType;
00170 
00172 typedef enum _PropertyIdentifier {
00173         PI_ContinuousScanEnabled = 0x00,
00174         PI_RequireTimestamp = 0x01,
00175         PI_DuplicateElimination = 0x02,
00176         PI_Timestamp = 0x03,
00177         PI_DisconnectedMode = 0x04,
00178         PI_ConnectedMode = 0x05,
00179         PI_RfidProtocol = 0x06,
00180         PI_BuzzerEnabled = 0x07,
00181         PI_DeviceTimeout = 0x08,
00182         PI_RfidTimeout = 0x09,
00183         PI_BluetoothTimeout = 0x0A,
00184         PI_ContinuousScanTimeout = 0x0B,
00185         PI_BlockIndex = 0x0C,
00186         PI_BlockData = 0x0D,
00187         PI_BlockCount = 0x0E,
00188         PI_VersionInfo = 0x17,
00189         PI_BootloaderVersion = 0x18,
00190         PI_HoldToScan = 0x19,
00191         PI_ConnectToHost = 0x20,
00192         PI_ActionButtonEnabled = 0x21
00193 } PropertyIdentifier;
00194 
00196 typedef enum _PropertyType {
00197     PT_Get,
00198     PT_Set
00199 } PropertyType;
00200 
00206 typedef enum _ConnectedMode {
00211         CM_REACTIVE = 0x01,
00212         
00219         CM_TAGID = 0x03,
00220         
00228         CM_READ_BLOCK = 0x04,
00229         
00239         CM_WRITE_BLOCK = 0x05,
00240         
00249         CM_READ_BLOCKS = 0x06
00250 } ConnectedMode;
00251 
00256 typedef enum _DisconnectedMode {
00258         DM_TAG_VERIFY = 0x00,
00259         
00261         DM_TAG_STORE = 0x01,
00262 } DisconnectedMode;
00263 
00268 typedef enum _RfidProtocol {
00269         RP_ISO15693 = 0x01,
00270     RP_TAGIT = 0x02,
00271         RP_EPC_GEN2 = 0x20
00272 } RfidProtocol;
00273 
00278 #define MAX_PACKET_SIZE 256
00279 
00284 #define MIN_PACKET_SIZE 4
00285 
00291 #define MAX_PAYLOAD_SIZE (MAX_PACKET_SIZE - MIN_PACKET_SIZE)
00292 
00293 
00297 @interface IDBlue : NSObject {
00298 }
00299 
00304 +(void) enableDebugLog: (BOOL) enabled;
00305 
00309 +(BOOL) debugLogEnabled;
00310 
00319 +(int) toAsciiByteArray: (NSString*) s withData: (byte*) data withMaxLen: (int) maxLen;
00320 
00328 +(NSString*) getStringFromAscii: (byte*) data withLen: (int) len;
00329 
00337 +(NSString*) getHexString: (byte*) data withDataLen: (int) dataLen;
00338 
00348 +(NSString*) getHexStringReversed: (byte*) data withDataLen: (int) dataLen;
00349 
00362 +(NSString*) getHexStringReversed: (byte*) data withDataLen: (int) dataLen withIndex: (int) index withCount: (int)count;
00363 
00373 +(int) getTagIdBytes: (NSString*) tagId withDest: (byte*) dest withLen: (int) len;
00374 
00375 +(void) reverseByteArray: (byte*) data withLen: (int) len;
00376 
00383 +(BOOL) isNumeric: (NSString*) s;
00384 
00394 +(BOOL) compareArrays: (byte*) array1 withLen1: (int) len1 withArray2: (byte*) array2 withLen2: (int) len2;
00395 
00401 +(ushort) makeWord: (byte*) highAndLow;
00402 
00409 +(ushort) makeWord: (byte) high withLow: (byte) low;
00410 
00418 +(void) getWord: (ushort) word withHigh: (byte*) high withLow: (byte*) low;
00419 
00420 +(void) getDoubleWord: (uint) dword withDest: (byte*) dest;
00421 +(uint) makeDoubleWord: (byte*) src;
00422 
00423 
00431 +(byte) computeChecksum: (byte*) data withCount: (int) count;
00432 
00439 +(BOOL) isValidCommand: (int) cmd;
00440 
00447 +(NSString*) convertCommandToString: (CommandIdentifier) cmd;
00448 
00455 +(NSString*) convertPropertyToString: (PropertyIdentifier) property;
00456 
00463 +(NSString*) convertCommandStatusToString: (CommandStatus) status;
00464 
00470 +(NSString*) convertConnectedModeToString: (ConnectedMode) mode;
00471 
00477 +(NSString*) convertDisconnectedModeToString: (DisconnectedMode) mode;
00478 
00479 @end
00480 

 

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