UgiInventory Class Reference

Overview


An inventory session

Instance Methods

(void) - stopInventoryWithCompletion:
 
Stop running inventory More...
 
(void) - stopInventory
 
Stop running inventory
 
(void) - pauseInventory
 
Stop running inventory temporarily (such as while a dialog box is displayed)
 
(void) - resumeInventory
 
Restart inventory after a temporarily stop
 
(void) - resumeInventoryWithConfiguration:
 
Restart inventory after a temporarily stop, with a changed configuration More...
 
(UgiTag *_Nullable) - getTagByEpc:
 
Get the UgiTag for an EPC. More...
 

Properties

id< UgiInventoryDelegate > delegate
 Delegate (can be changed)
 
UgiRfidConfigurationconfiguration
 Configuration this inventory was run with.
 
NSDate * startTime
 When the inventory started.
 
BOOL isPaused
 Is inventory temporarily stopped.
 
BOOL isScanning
 Is the Grokker actively scanning.
 
int numInventoryRounds
 The number of inventory rounds that the Grokker has run in this inventory.
 
UgiInventoryCompletedReturnValues completedReturnValue
 After inventory has completed, this is the return value.
 

Protected Types

typedef void(^ StopInventoryCompletion) (void)
 
Prototype for completion method for stopnventory
 

Inventory Properties (while running inventory)

enum  UgiTagAccessReturnValues {
  UGI_TAG_ACCESS_OK =0, UGI_TAG_ACCESS_WRONG_PASSWORD =1, UGI_TAG_ACCESS_PASSWORD_REQUIRED =2, UGI_TAG_ACCESS_MEMORY_OVERRUN =3,
  UGI_TAG_ACCESS_TAG_NOT_FOUND =4, UGI_TAG_ACCESS_GENERAL_ERROR =5, UGI_TAG_ACCESS_INVENTORY_STOPPED =6, UGI_TAG_ACCESS_REQUIRES_AUTHENTICATION =7
}
 
Values passed to TagAccessCompletion More...
 
enum  UgiLockUnlockMaskAndAction {
  UGI_ACCESS_KILL_PASSWORD_MASK_BIT_OFFSET = 18, UGI_ACCESS_ACCESS_PASSWORD_MASK_BIT_OFFSET = 16, UGI_ACCESS_EPC_MASK_BIT_OFFSET = 14, UGI_ACCESS_TID_MASK_BIT_OFFSET = 12,
  UGI_ACCESS_USER_MASK_BIT_OFFSET = 10, UGI_ACCESS_KILL_PASSWORD_ACTION_BIT_OFFSET = 8, UGI_ACCESS_ACCESS_PASSWORD_ACTION_BIT_OFFSET = 6, UGI_ACCESS_EPC_ACTION_BIT_OFFSET = 4,
  UGI_ACCESS_TID_ACTION_BIT_OFFSET = 2, UGI_ACCESS_USER_ACTION_BIT_OFFSET = 0, UGI_ACCESS_MASK_CHANGE_NONE = 0, UGI_ACCESS_MASK_CHANGE_PERMALOCK = 1,
  UGI_ACCESS_MASK_CHANGE_WRITABLE = 2, UGI_ACCESS_MASK_CHANGE_WRITABLE_AND_PERMALOCK = 3, UGI_ACCESS_ACTION_WRITABLE = 0, UGI_ACCESS_ACTION_PERMANENTLY_WRITABLE = 1,
  UGI_ACCESS_ACTION_WRITE_RESTRICTED = 2, UGI_ACCESS_ACTION_PERMANENTLY_NOT_WRITABLE = 3
}
 Definitions for value passed to lockUnlockTag choosing what banks to change the locked status for and what to change them to. More...
 
typedef void(^ TagAccessCompletion) (UgiTag *_Nullable tag, UgiTagAccessReturnValues result)
 
Prototype for completion methods for tag access methods More...
 
typedef void(^ TagReadCompletion) (UgiTag *_Nullable tag, NSData *_Nullable data, UgiTagAccessReturnValues result)
 
Prototype for completion methods for tag access methods More...
 
typedef void(^ TagCustomCommandCompletion) (UgiTag *_Nullable tag, BOOL headerBit, NSData *_Nullable response, UgiTagAccessReturnValues result)
 
Prototype for completion method for custom command More...
 
typedef void(^ ChangePowerCompletion) (BOOL success)
 
Prototype for changePowerInitial More...
 
typedef void(^ GetBatteryInfoCompletion) (UgiBatteryInfo *_Nullable info)
 
Prototype for getBatteryInfoWithCompletion More...
 
NSArray< UgiTag * > *_Nonnull tags
 Array of tags that have been found, elements are UgiTag*.
 
(void) - programTag:toEpc:withPassword:whenCompleted:
 
Program a tag (change its EPC) More...
 
(void) - writeTag:memoryBank:offset:data:previousData:withPassword:whenCompleted:
 
Write a tag's memory More...
 
(void) - setTagAccessPassword:currentPassword:newPassword:whenCompleted:
 
Set a tag's access password More...
 
(void) - setTagKillPassword:currentPassword:killPassword:whenCompleted:
 
Set a tag's kill password More...
 
(void) - lockUnlockTag:maskAndAction:withPassword:whenCompleted:
 
Lock/unlock a tag More...
 
(void) - killTag:withPassword:whenCompleted:
 
Kill a tag More...
 
(void) - readTag:memoryBank:offset:minNumBytes:maxNumBytes:withPassword:whenCompleted:
 
Read a tag's memory More...
 
(void) - customCommandToTag:command:commandBits:responseBitLengthNoHeaderBit:responseBitLengthWithHeaderBit:receiveTimeoutUsec:whenCompleted:
 
Do a custom command to a tag More...
 
(void) - changePowerInitial:min:max:whenCompleted:
 
Change power More...
 
(void) - getBatteryInfoWithCompletion:
 
Get battery level while scanning. More...
 

Instance Method Documentation

◆ stopInventoryWithCompletion:()

- (void) stopInventoryWithCompletion: (nullable StopInventoryCompletion completion


Stop running inventory

Parameters
completionBlock to run when inventory is completely finished

◆ resumeInventoryWithConfiguration:()

- (void) resumeInventoryWithConfiguration: (UgiRfidConfiguration *_Nullable)  configuration


Restart inventory after a temporarily stop, with a changed configuration

Parameters
configurationNew RFID confifuration

◆ getTagByEpc:()

- (UgiTag * _Nullable) getTagByEpc: (UgiEpc *_Nonnull)  epc


Get the UgiTag for an EPC.

Parameters
epcEPC to find
Returns
UgiTag object if the tag has been found, nil if the tag has not been found.

◆ programTag:toEpc:withPassword:whenCompleted:()

- (void) programTag: (UgiEpc *_Nonnull)  oldEpc
toEpc: (UgiEpc *_Nonnull)  newEpc
withPassword: (int)  password
whenCompleted: (nonnull TagAccessCompletion completion 


Program a tag (change its EPC)

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished.

Parameters
oldEpcEPC of tag to change
newEpcEPC to write to the tag
passwordPassword to use (UGI_NO_PASSWORD for not password protected)
completionCompletion code after tag is programmed

◆ writeTag:memoryBank:offset:data:previousData:withPassword:whenCompleted:()

- (void) writeTag: (UgiEpc *_Nonnull)  epc
memoryBank: (UgiMemoryBank)  memoryBank
offset: (int)  offset
data: (NSData *_Nonnull)  data
previousData: (NSData *_Nullable)  previousData
withPassword: (int)  password
whenCompleted: (nonnull TagAccessCompletion completion 


Write a tag's memory

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to write to
memoryBankMemory bank to write to
offsetByte offset to write at (must be a multiple of 2)
dataData to write
previousDataPrevious value for this data (nil if unknown or not available)
passwordPassword to use (UGI_NO_PASSWORD for not password protected)
completionCompletion code after tag is written

◆ setTagAccessPassword:currentPassword:newPassword:whenCompleted:()

- (void) setTagAccessPassword: (UgiEpc *_Nonnull)  epc
currentPassword: (int)  currentPassword
newPassword: (int)  newPassword
whenCompleted: (nonnull TagAccessCompletion completion 


Set a tag's access password

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to set the password for
currentPasswordCurrent password (UGI_NO_PASSWORD if not password protected)
newPasswordPassword to set (UGI_NO_PASSWORD for not password protected)
completionCompletion code after password is set

◆ setTagKillPassword:currentPassword:killPassword:whenCompleted:()

- (void) setTagKillPassword: (UgiEpc *_Nonnull)  epc
currentPassword: (int)  currentPassword
killPassword: (int)  killPassword
whenCompleted: (nonnull TagAccessCompletion completion 


Set a tag's kill password

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to set the password for
currentPasswordCurrent password (UGI_NO_PASSWORD if not password protected)
killPasswordPassword to set (UGI_NO_PASSWORD for not password protected)
completionCompletion code after password is set

◆ lockUnlockTag:maskAndAction:withPassword:whenCompleted:()

- (void) lockUnlockTag: (UgiEpc *_Nonnull)  epc
maskAndAction: (UgiLockUnlockMaskAndAction maskAndAction
withPassword: (int)  password
whenCompleted: (nonnull TagAccessCompletion completion 


Lock/unlock a tag

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to lock/unlock
maskAndActionDescription for which protection bits to change and what to change them to (UgiLockUnlockMaskAndAction)
passwordPassword to use (UGI_NO_PASSWORD for not password protected)
completionCompletion code after tag is locked/unlocked

◆ killTag:withPassword:whenCompleted:()

- (void) killTag: (UgiEpc *_Nonnull)  epc
withPassword: (int)  password
whenCompleted: (nonnull TagAccessCompletion completion 


Kill a tag

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to kill
passwordKill password
completionCompletion code after tag is killed

◆ readTag:memoryBank:offset:minNumBytes:maxNumBytes:withPassword:whenCompleted:()

- (void) readTag: (UgiEpc *_Nonnull)  epc
memoryBank: (UgiMemoryBank)  memoryBank
offset: (int)  offset
minNumBytes: (int)  minNumBytes
maxNumBytes: (int)  maxNumBytes
withPassword: (int)  password
whenCompleted: (nonnull TagReadCompletion completion 


Read a tag's memory

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to read
memoryBankMemory bank to read
offsetByte offset to read at (must be a multiple of 2)
minNumBytesMinimum number of bytes to read (must be a multiple of 2)
maxNumBytesMaximum number of bytes to read (must be a multiple of 2)
passwordPassword to use (UGI_NO_PASSWORD for not password protected), only relavant for the ACESS and KILL passwords. Password is only supported in Grokkers with firmware 1.12.2 and above
completionCompletion code after tag is read

◆ customCommandToTag:command:commandBits:responseBitLengthNoHeaderBit:responseBitLengthWithHeaderBit:receiveTimeoutUsec:whenCompleted:()

- (void) customCommandToTag: (UgiEpc *_Nonnull)  epc
command: (NSData *_Nonnull)  command
commandBits: (int)  commandBits
responseBitLengthNoHeaderBit: (int)  responseBitLengthNoHeaderBit
responseBitLengthWithHeaderBit: (int)  responseBitLengthWithHeaderBit
receiveTimeoutUsec: (int)  receiveTimeoutUsec
whenCompleted: (nonnull TagCustomCommandCompletion completion 


Do a custom command to a tag

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
epcEPC of tag to read
commandCommand bytes to send
commandBitsNumber of command bits to send
responseBitLengthNoHeaderBitNumber of response bits to expect, if header bit is not set in the response
responseBitLengthWithHeaderBitNumber of response bits to expect, if header bit is set in the response (if 0 then do not expect a header bit at all)
receiveTimeoutUsecResponse timeout in uSec (some tags require more than the standard for custom commands)
completionCompletion code after the custom command is executed

◆ changePowerInitial:min:max:whenCompleted:()

- (void) changePowerInitial: (double)  initialPowerLevel
min: (double)  minPowerLevel
max: (double)  maxPowerLevel
whenCompleted: (nonnull ChangePowerCompletion completion 


Change power

This must be called while inventory is running. This method call returns immediately, the completion is called when the operation is finished

Parameters
initialPowerLevelInitial power level
minPowerLevelMinimum power level
maxPowerLevelMaximum power level
completionCompletion code after the power change is executed

◆ getBatteryInfoWithCompletion:()

- (void) getBatteryInfoWithCompletion: (nonnull GetBatteryInfoCompletion completion


Get battery level while scanning.

This causing inventory to pause for a short period of time.

Parameters
completionCompletion code called with battery information

Enumeration Documentation

◆ UgiTagAccessReturnValues


Values passed to TagAccessCompletion

Enumerator
UGI_TAG_ACCESS_OK 

Access was successful.

UGI_TAG_ACCESS_WRONG_PASSWORD 

Incorrect password passed.

UGI_TAG_ACCESS_PASSWORD_REQUIRED 

No password passed, but a password is required.

UGI_TAG_ACCESS_MEMORY_OVERRUN 

Read/write to a memory locaion that does not exist on tht tag.

UGI_TAG_ACCESS_TAG_NOT_FOUND 

Tag not found.

UGI_TAG_ACCESS_GENERAL_ERROR 

General error.

UGI_TAG_ACCESS_INVENTORY_STOPPED 

Inventory stopped.

UGI_TAG_ACCESS_REQUIRES_AUTHENTICATION 

Grokker must be authenticated.

◆ UgiLockUnlockMaskAndAction

Definitions for value passed to lockUnlockTag choosing what banks to change the locked status for and what to change them to.

Enumerator
UGI_ACCESS_KILL_PASSWORD_MASK_BIT_OFFSET 

Offset for mask bits for kill password.

UGI_ACCESS_ACCESS_PASSWORD_MASK_BIT_OFFSET 

Offset for mask bits for access password.

UGI_ACCESS_EPC_MASK_BIT_OFFSET 

Offset for mask bits for EPC memory bank.

UGI_ACCESS_TID_MASK_BIT_OFFSET 

Offset for mask bits for TID memory bank.

UGI_ACCESS_USER_MASK_BIT_OFFSET 

Offset for mask bits for USER memory bank.

UGI_ACCESS_KILL_PASSWORD_ACTION_BIT_OFFSET 

Offset for action bits for kill password.

UGI_ACCESS_ACCESS_PASSWORD_ACTION_BIT_OFFSET 

Offset for action bits for access password.

UGI_ACCESS_EPC_ACTION_BIT_OFFSET 

Offset for action bits for EPC memory bank.

UGI_ACCESS_TID_ACTION_BIT_OFFSET 

Offset for action bits for TID memory bank.

UGI_ACCESS_USER_ACTION_BIT_OFFSET 

Offset for action bits for USER memory bank.

UGI_ACCESS_MASK_CHANGE_NONE 

Mask: don't change.

UGI_ACCESS_MASK_CHANGE_PERMALOCK 

Mask: change permlock bit.

UGI_ACCESS_MASK_CHANGE_WRITABLE 

Mask: change writable bit.

UGI_ACCESS_MASK_CHANGE_WRITABLE_AND_PERMALOCK 

Mask: change permlock and writable bits.

UGI_ACCESS_ACTION_WRITABLE 

Action: writable.

UGI_ACCESS_ACTION_PERMANENTLY_WRITABLE 

Action: permanently writable.

UGI_ACCESS_ACTION_WRITE_RESTRICTED 

Action: write restricted (password required)

UGI_ACCESS_ACTION_PERMANENTLY_NOT_WRITABLE 

Action: permanently not writable.

Member Typedef Documentation

◆ TagAccessCompletion

- (typedef void(^ TagAccessCompletion) (UgiTag *_Nullable tag, UgiTagAccessReturnValues result))


Prototype for completion methods for tag access methods

Parameters
tagThe tag accessed (possibly not valid if the access failed)
resultResult of the operation

◆ TagReadCompletion

- (typedef void(^ TagReadCompletion) (UgiTag *_Nullable tag, NSData *_Nullable data, UgiTagAccessReturnValues result))


Prototype for completion methods for tag access methods

Parameters
tagThe tag accessed
resultResult of the operation

◆ TagCustomCommandCompletion

- (typedef void(^ TagCustomCommandCompletion) (UgiTag *_Nullable tag, BOOL headerBit, NSData *_Nullable response, UgiTagAccessReturnValues result))


Prototype for completion method for custom command

Parameters
tagThe tag accessed
headerBitYES if the header bit was set in the response (usually used to indicate an error)
responseTag's response to the custom command
resultResult of the operation

◆ ChangePowerCompletion

- (typedef void(^ ChangePowerCompletion) (BOOL success))


Prototype for changePowerInitial

Parameters
successYES if successful

◆ GetBatteryInfoCompletion

- (typedef void(^ GetBatteryInfoCompletion) (UgiBatteryInfo *_Nullable info))


Prototype for getBatteryInfoWithCompletion

Parameters
infoBattery information