Class: Ugi

Ugi()

Core class for U Grok It access. This class is accessed via the "ugi" single object in the global scope (the window object).

Constructor

new Ugi()

Source:

Members

(readonly) activeInventory :UgiInventory

Active inventory
Type:
Source:

(readonly) batteryCapacity :Number

Battery capacity in minutes
Type:
  • Number
Source:

(readonly) batteryCapacity_mAh :Number

Battery capacity in mAh
Type:
  • Number
Source:

(readonly) checkServerForUnknownDevices :Boolean

true if the server should be checked if the Android device is not recognized (default = true) To change, use setCheckServerForUnknownDevices()
Type:
  • Boolean
Source:

(readonly) connectionState :ugi.ConnectionStates

The current connection state
Type:
  • ugi.ConnectionStates
Source:

(readonly) ConnectionStates :Number

Connection states sent to connect state callbacks and stored in the connectionState property.
Type:
  • Number
Properties:
Name Type Description
NOT_CONNECTED Number Nothing connected to audio port
CONNECTING Number Something connected to audio port, trying to connect
INCOMPATIBLE_READER Number Connected to an reader with incompatible firmware
CONNECTED Number Connected to reader
Source:

(readonly) doAutomaticFirmwareUpdate :Boolean

true if the Grokker firmware should be automatically updated (default = true) To change, use setDoAutomaticFirmwareUpdate()
Type:
  • Boolean
Source:

(readonly) firmwareVersion :String

Firmware version in the reader, major
Type:
  • String
Source:

(readonly) grokkerAuthenticationRequired :Boolean

true if the Grokker requires authentication
Type:
  • Boolean
Source:

(readonly) grokkerPasswordExists :Boolean

true if the Grokker has a password
Type:
  • Boolean
Source:

(readonly) GrokkerPasswordReturnValues :Number

Values returned by setGrokkerPassword and authenticateGrokker
Type:
  • Number
Properties:
Name Type Description
SUCCESS Number
NOT_AUTHENTICATED Number
WRONG_PASSWORD Number
NO_PASSWORD_SET Number
NOT_CONNECTED Number
OTHER_ERROR Number
Source:

(readonly) isAnythingPluggedIntoAudioJack :Boolean

Is anything is plugged into the audio jack (as best we can determine)
Type:
  • Boolean
Source:

(readonly) isConnected :Boolean

Whether the reader is connected
Type:
  • Boolean
Source:

(readonly) isInOpenConnection :Boolean

Has openConnection has been called (without a corresponding call to closeConnecion)
Type:
  • Boolean
Source:

(readonly) LoggingTypes :Number

Types of logging passed to setLogging()
Type:
  • Number
Properties:
Name Type Description
INTERNAL_BYTE_PROTOCOL Number
INTERNAL_CONNECTION_ERRORS Number
INTERNAL_CONNECTION_STATE Number
INTERNAL_PACKET_PROTOCOL Number
INTERNAL_COMMAND Number
INTERNAL_INVENTORY Number
INTERNAL_FIRMWARE_UPDATE Number
INTERNAL_BATTERY_STATUS Number
INTERNAL_PLATFORM_SPECIFIC Number
STATE Number Connection and inventory state
INVENTORY Number Inventory activity
INVENTORY_DETAIL Number Inventory details
BATTERY_STATUS Number
Source:

(readonly) MemoryBanks :Number

Memory banks passed to writeTag()
Type:
  • Number
Properties:
Name Type Description
RESERVED Number
EPC Number
TID Number
USER Number
Source:

(readonly) nativeSdkVersion :String

U Grok It Native SDK Version
Type:
  • String
Source:

(readonly) nativeSdkVersionDateTime :Date

SDK Version, date/time
Type:
  • Date
Source:

(readonly) numVolumeLevels :Number

Maximum number of volume levels
Type:
  • Number
Source:

(readonly) OngoingOperations :Number

Operation used by ReportConnectionStateAndBatteryInfoCallback.
Type:
  • Number
Properties:
Name Type Description
INACTIVE Number No operation active
INVENTORY Number Running inventory
FIRMWARE_UPDATE Number Firmware update in progress
OTHER Number Other operation in progress
BARCODE_SCAN Number
Source:

(readonly) platform :String

Platform: ios or android
Type:
  • String
Source:

(readonly) pluginVersion :String

U Grok It Cordova plugin version Version 1.4.1 - September 10, 2014 - Reader protocol 17
RFID configuration changes
Bug fixes
Version 1.5.2 - November 12, 2014 - Reader protocol 19
Bug fixes and performance improvement
Version 1.6.1 - December 18, 2014 - Reader protocol 19
EU Grokker support (region setting)
Version 1.6.2 - January 13, 2015 - Reader protocol 19
Properly close connection when changing pages
Version 1.7.2 - February 5, 2015 - Reader protocol 19
Streamlined UI for housekeeping tasks (set region and firmware update)
Version 1.7.3 - February 11, 2015 - Reader protocol 19
Bug fix for app inactive/active while inventory is running
Version 1.7.4 - February 19, 2015 - Reader protocol 19
Bug fix for inventory.isScanning
Version 1.7.5 - March 9, 2015 - Reader protocol 19
Bug fix for passing both a select mask and EPCs to startInventory
Version 1.7.6 - March 26, 2015 - Reader protocol 19
Better handling of protocol errors while starting/stopping inventory
Version 1.7.7 - April 8, 2015 - Reader protocol 19
Minor bug fixes with setting region
Version 1.7.8 - April 25, 2015 - Reader protocol 19
Bug fix for intermittent issue with pausing/resuming connection
Bug fix with pausing/resuming inventory
Version 1.7.9 - May 13, 2015 - Reader protocol 19
Bug fix for setting "handle screen rotation" in Android
Version 1.7.10 - May 14, 2015 - Reader protocol 19
Expanded Android device support
Version 1.7.11 - May 26, 2015 - Reader protocol 20
Expanded Android device support (in conjunction with firmware 1.9.5)
Version 1.7.13 - July 9, 2015 - Reader protocol 20
Do not allow getting battery level during firmware update
Android: Change directory structure to be plugman compatible
Android: SDK 1.7.13 with bug fix
Version 1.7.14 - July 14, 2015 - Reader protocol 20
Fix bug in writeTag parameter checking
Version 1.7.15 - July 27, 2015 - Reader protocol 20
Android: fix bug with low-level filters and large numbers of tags
Version 1.7.16 - August 15, 2015 - Reader protocol 20
Fix crashing bug with setting region
Version 1.7.17 - August 26, 2015 - Reader protocol 20
Fix "result" from programTag, readTag, writeTag, lockUnlockTag, customCommandToTag to be correct
Fix plugin.xml to have proper schema for Android
Demo app improvements
Version 1.7.18 - September 19, 2015 - Reader protocol 20
XCode 7 support
Android device compatibility
Version 1.7.19 - September 24, 2015 - Reader protocol 20
iOS9 bug fix
Android 6.0 (Marshmallow) support
Version 1.8.1 - October 5, 2015 - Reader protocol 20
API for controlling the SDK's Internet use
iOS: Fix problem with archive builds and bitcode
Version 1.8.2 - October 7, 2015 - Reader protocol 20
Android: Fix bug with 1.8.1 changes for a few specific devices
Version 1.8.3 - October 20, 2015 - Reader protocol 20
Remove minimum EPC length
iOS: Fix for iOS6 and initializing new Grokkers
Android: Android 6.0 (Marshmallow) compatibility
Version 1.8.4 - October 26, 2015 - Reader protocol 20
Android: Android 6.0 (Marshmallow) compatibility
Version 1.8.5 - October 28, 2015 - Reader protocol 20
iOS: Fix for accidentally hitting the dictation key while Grokker is connected
Android: Fix for crash on device with illegal audio properties
Version 1.8.6 - November 24, 2015 - Reader protocol 20
Android: Better Android compatibility for devices with issues setting the volume
Version 1.9.1 - January 13, 2016 - Reader protocol 21
Protocol 22: force-tari-25 flag, delay-after-select flag
API for reading RF Micron Magnus sensor tags
Fix DetailedPerReadData readData1 and readData2 to not be byte-swizzled
Added Ugi requiresFirmwareVersion method
Version 1.9.2 - February 4, 2016 - Reader protocol 21
Android device compatibility
Version 1.9.3 - February 11, 2016 - Reader protocol 21
Android device compatibility
Version 1.9.5 - March 5, 2016 - Reader protocol 21
Added reportConnectionStateAndBatteryInfoPeriodically()
Version 1.9.6 - March 14, 2016 - Reader protocol 21
Bug fix in reportConnectionStateAndBatteryInfoPeriodically()
Version 1.10.1 - April 2, 2016 - Reader protocol 21
UI rework, added UgiUiUtil
Version 1.11.1 - May 20, 2016 - Reader protocol 21
More work on UI building blocks
Fix problem with multi-page apps
Version 1.11.2 - May 31, 2016 - Reader protocol 21
Fix Android issue with multiple calls to Ugi.createSingleton()
Version 1.12.1 - July 11, 2016 - Reader protocol 22
Removed support for protocol levels before 17
Protocol 22: battery info while scanning, temperature in reportConnectionStateAndBatteryInfoPeriodically
Version 1.12.2 - July 29, 2016 - Reader protocol 22
Battery status images incorporating warning about Grokker being too hot
Version 1.12.3 - August 11, 2016 - Reader protocol 22
Audio protocol fix to better handle an obscure error condition
Version 1.13.1 - September 8, 2016 - Reader protocol 23
Add localization support
Fix UgiTitleView to center the title better
Version 1.13.2 - September 28, 2016 - Reader protocol 23
Option for UI alerts to be in the U Grok It style
Small bug fixes
Version 1.13.3 - October 28, 2016 - Reader protocol 23
Check battery level before doing firmware update
Small bug fixes
Small change to battery status images
Version 1.13.4 - November 23, 2016 - Reader protocol 23
Small bug fixes
Version 1.14.1 - December 15, 2016, 2016 - Reader protocol 23
Support a password in readTag (requires firmware 1.12.3)
Support for killTag (requires firmware 1.12.3)
Version 1.15.1 - January 25, 2017 - Reader protocol 26
Support for authentication (requires firmware 1.12.4)
Version 1.15.2 - January 31, 2017 - Reader protocol 26
Android: fix bug with a few Android models that caused ntermittent crashes
Android: fix bug with closeConnection()
Version 1.15.3 - February 8, 2017 - Reader protocol 26
iOS: Fix bug with 64-bit devices and per-read data
Version 1.15.4 - February 15, 2017 - Reader protocol 26
Small localization changes
Version 1.15.5 - March 13, 2017 - Reader protocol 26
Android: add setDoAutoRotationCheck()
Version 1.15.6 - March 31, 2017 - Reader protocol 26
Updated iOS and Android SDKs
Version 1.16.1 - July 14, 2017 - Reader protocol 26
Set Region removed (will be done in the factory)
Use Turck part number/model
Version 1.16.2 - September 27, 2017 - Reader protocol 26
Fix minor memory leak
Minor region table changes
Minor region table changes
Support for China's frequencies
Version 1.16.4 - October 13, 2017 - Reader protocol 26
Fix SINGLE_FIND mode, broken in previous SDK
Version 1.16.5 - January 11, 2018 - Reader protocol 27
Fix to work with very old firmware (1.6.2) still in a few Grokkers
Compatibility work
Minor bug fixes
Version 1.16.6 - March 9, 2018 - Reader protocol 27
Fix bug writing more than 200 bytes to memory when previous memory contents are unknown
Android - Fix bug passing over 500 EPCs to ignore
Version 1.16.7 - May 4, 2018 - Reader protocol 27
Change "Grokker" references to "PD20"
Version 1.16.8 - May 29, 2018 - Reader protocol 27
Fix bug with SINGLE_FIND mode when passing EPCs to ignore
Version 1.16.9 - June 6, 2018 - Reader protocol 27
Add parameter checking to catch illegal combinations in UgiRfidConfiguration
Version 1.16.12 - July 23, 2018 - Reader protocol 27
Updated French translations
Android: Fix crash when an unrelated USB device is detached
Version 1.16.13 - October 25, 2018 - Reader protocol 27
UI tweaks and cleanups
Type:
  • String
Source:

(readonly) readerDescription :String

Description of the reader, generally used for debugging
Type:
  • String
Source:

(readonly) readerHardwareModel :String

Reader's hardware model
Type:
  • String
Source:

(readonly) readerProtocolVersion :String

Reader protocol version
Type:
  • String
Source:

(readonly) readerSerialNumber :String

Reader's serial number
Type:
  • String
Source:

(readonly) requiredProtocolVersion :String

Protocol version that the host requires
Type:
  • String
Source:

(readonly) sendFirstConnectionAndAutomaticConfigurationReports :Boolean

true if first connection and automatic configuration reports should be sent (default = true) To change, use setSendFirstConnectionAndAutomaticConfigurationReports()
Type:
  • Boolean
Source:

(readonly) sendGrokkerSerialNumber :Boolean

true if the Grokker serial number should ever be sent to the U Grok It server (default = true) To change, use setSendGrokkerSerialNumber()
Type:
  • Boolean
Source:

(readonly) SingleFindRampPowerModes :Number

Values for singleFindRampPowerMode
Type:
  • Number
Properties:
Name Type Description
NO_RAMP Number
SLOW Number
MEDIUM Number
FAST Number
Source:

(readonly) supportedProtocolVersion :String

Protocol version that the host supports
Type:
  • String
Source:

(readonly) unlocalizedRegionName :String

Reader's region name (unlocalized)
Type:
  • String
Source:

Methods

addConnectionStateCallback(callback)

Add a callback for connection state changes.
Parameters:
Name Type Description
callback Callback to add. The callback is called with one argument, the new connection state
Source:
Returns:
the callback function (to be passed to removeConnectionStateCallback if needed)

authenticateGrokker(password, completion)

Authenticate the Grokker.
Parameters:
Name Type Description
password Password to authenticate with
completion Code to run when operation is completed
Source:

automaticCheckForFirmwareUpdate(callback)

Check for firmware update automatically
Parameters:
Name Type Description
callback Called with (required, name, notes)
Source:

bytesToString(bytes)

Convert an array of bytes to a hex string
Parameters:
Name Type Description
bytes array of bytes
Source:
Returns:
hex string

closeConnection()

Close the connection to the Grokker. Connections are automatically closed when a page is unloaded.
Source:

debug_setBatteryPercentageAdjustment(adjustment, completion)

Set an adjustment to the battery percentage (the adjustment value is added to or subtracted from the real battery percentage). This is useful for development for testing displaying of different battery levels.
Parameters:
Name Type Description
adjustment adjustment value
completion Code to run afterwards
Source:

debug_setTemperatureAdjustment(adjustment, completion)

Set an adjustment to the battery temperature (the adjustment value is added to the real temperature). This is useful for development for testing hanlding of warnings when the Grokker is used in very hot environments.
Parameters:
Name Type Description
adjustment adjustment value (must be positive or zero)
completion Code to run afterwards
Source:

endReportConnectionStateAndBatteryInfoPeriodically(obj)

End periodic connection state and battery info reports.
Parameters:
Name Type Description
obj object returned from reportConnectionStateAndBatteryInfoPeriodically
Source:

getBatteryInfo(callback)

Get battery information. This cannot be called while scanning.
Parameters:
Name Type Description
callback Called with one parameter of type UgiBatteryInfo
Source:

invokeAudioJackLocation()

Invoke the "set audio jack location" sequence (Android only)
Source:

invokeAudioReconfiguration()

Invoke the "audio reconfiguration" sequence (Android only)
Source:

log(argumentsopt)

Log to the device's native log
Parameters:
Name Type Attributes Description
arguments <optional>
Objects to log
Source:

openConnection()

Try to open a connection to the reader.

openConnection returns immediately, it does not wait for a connection to the reader to actually be established. If a reader is connected, the connection takes 400-500ms (just under half a second) for the connection sequence. Your app can get notification of connection state changes via addConnectionStateCallback()
Source:

removeConnectionStateCallback(callback)

Remove a callback for connection state changes
Parameters:
Name Type Description
callback Callback to remove
Source:

reportConnectionStateAndBatteryInfoPeriodically(callback)

Periodically report connection state and battery information to the callback
Parameters:
Name Type Description
callback Called with (ConnectionStates connectionState, OngoingOperations ongoingOperation, boolean batteryInformationIsValid, boolean externalPowerIsConnected, boolean isCharging, boolean canScan, boolean canGetBatteryWhileScanning, boolean temperatureAtOrAboveThreshold, boolean temperatureWithin5DegreesOfThreshold, boolean temperatureWithin10DegreesOfThreshold, boolean temperatureWithin20DegreesOfThreshold, int averagedBatteryPercentage, String statusDescription)
Source:
Returns:
object to pass to endReportConnectionStateAndBatteryInfoPeriodically

requiresFirmwareVersion(firmwareVersion)

Set that this app requires a minimum firmware version on the Grokker
Parameters:
Name Type Description
firmwareVersion The minimum firmware version
Source:

setCheckServerForUnknownDevices(b)

Set whether the U Grok It server should be checked if the Android device is not recognized
Parameters:
Name Type Description
b true if the server should be checked
Source:

setDoAutomaticFirmwareUpdate(b)

Set whether the Grokker firmware should be automatically updated via checking the U Grok It server
Parameters:
Name Type Description
b true if the Grokker firmware should be automatically updated
Source:

setDoAutoRotationCheck(doAutoRotationCheck)

Set whether to do the auto-rotation check
Parameters:
Name Type Description
doAutoRotationCheck true to do the auto-rotation check
Source:

setGrokkerPassword(password, completion)

Set the Grokker's password. if a password is set, then the Grokker must be authenticated before any operation that changes tag data.
Parameters:
Name Type Description
password Password to set
completion Code to run when operation is completed
Source:

setHandleScreenRotation(handleScreenRotation)

Set whether screen rotation should be handled
Parameters:
Name Type Description
handleScreenRotation true to handle screen rotation
Source:

setLogging(logging)

Set logging (to native log)
Parameters:
Name Type Description
logging ugi.LoggingTypes.XXX
Source:

setSendFirstConnectionAndAutomaticConfigurationReports(b)

Set whether first connection and automatic configuration reports should be sent
Parameters:
Name Type Description
b true if first connection and automatic configuration reports should be sent
Source:

setSendGrokkerSerialNumber(b)

Set whether the Grokker serial number should ever be sent to the U Grok It server
Parameters:
Name Type Description
b true to allow the Grokker serial number to be sent to the U Grok It server
Source:

startInventory(delegate, config, epcs)

Start running inventory (if a reader is connected). If one or more EPCs are passed in, only they will be reported back to the delegate If no EPCs are passed then all EPCs will be reported back to the delegate.

If a small number of EPCs are passed (<=maxEpcsSentToReader), filtering is done on the reader and the reader plays sounds immediately (with no host interaction). Otherwise filtering is done on the host, and the host tells the reader when to play sounds which is slower.

The inventory code keeps a history for each tag. This history is the number of finds for each time interval. The default is to store history for 20 intervals of 500ms each. This default can be modified via properties: historyIntervalMSec and historyDepth.

The inventoryType allows using a preset mode based on the type of operation being performed, or using the manually configured values.
Parameters:
Name Type Description
delegate Object Delegate object to report back to
config Object UgiRfidConfiguration object
epcs Array EPCs to find, all other EPCs are ignored (or null to find all EPCs) @ @param {Boolean} epcsAreIgnoreList TRUE to ingore all the EPCs passed, FALSE to search for them only
Source:
Returns:
UgiInventory object

stringToBytes(s)

Convert a hex string to an array of bytes
Parameters:
Name Type Description
s hex string to convert
Source:
Returns:
array of bytes