SmartCradle

Enterprise Browser 3.5

Overview

The SmartCradle API is used to set and retrieve attributes of the MC18 Cradle

Enabling the API

There are two methods of enabling the SmartCradle API:

  • Include all ebapi modules
  • Include only the required API modules

For either of these methods, you'll need to include files from the /Enterprise Browser/JavaScript Files/Enterprise Browser directory on the computer that you installed the Enterprise Browser.

Include all JS API modules

To include all JS APIs, copy the ebapi-modules.js file to a location accessible by the app's files and include a reference to the JavaScript file in the app's HTML. For instance, to include the modules file in the app's index.html, copy the file to the same directory as that index.html and add the following line to the HTML's HEAD section:


<script type="text/javascript" charset="utf-8" src="ebapi-modules.js"></script>

Note: that the pathing for this file is relative to the current page.

This will define the EB class within the page. Any page you need to use the modules will need to have the .js file included in this fashion.

Include only the required modules

To include single APIs, you must first include the ebapi.js in your HTML as well as the API file you want to use. For instance, to use the SmartCradle API, I would add the following code to my HTML file(s), assuming the API files have been copied to the same directory as the HTML.


<script type="text/javascript" charset="utf-8" src="ebapi.js"></script>
<script type="text/javascript" charset="utf-8" src="eb.smartcradle.js"></script>

The ebapi.js file is necessary for all single API inclusions.

Methods

flashLed(HASH propertyMap)

The LED can be flashed to identify device location without unlocking the cradle.

Parameters

  • propertyMap : HASH

    The properties associated with reading card data.

    • ledOnDuration : INTEGER

      During unlock the LEDs will flash, this is the on duration of that flash specified in milliseconds. Set to 0 to prevent flashing and keep the LED off. In Android, this is in mSecs and the range is from 0 mSec(minimum) to 65535 mSec(maximum).

    • ledOffDuration : INTEGER

      During unlock the LEDs will flash, this is the off duration of that flash specified in milliseconds. Set to 0 to prevent flashing. If the on duration is non-zero and this parameter is zero then the LED will remain on when unlocked. In Android, this is in mSecs and the range is from 0 mSec(minimum) to 65535 mSec(maximum).

    • smoothingEffect : BOOLEAN

      Enables or Disables the smoothing effect of LED blinking.

    • ledFlashCount : INTEGER

      ledFlashCount is the no of count it will be flashed. This will take affect for valid values of ledOnDuration and ledOffDuration.

  • callback : CallBackHandler

Returns

Synchronous Return:

  • Void

Platforms

  • Android

Method Access:

  • Class Method: This method can only be accessed via the API class object.
    • EB.SmartCradle.flashLed(HASH propertyMap)

getAllProperties()

This method will return all of object/value pairs for the propertyNames of the API class.

Parameters

  • callback : CallBackHandler

Callback

Async Callback Returning Parameters: HASH

    • : STRING

Returns

Synchronous Return:

  • HASH : Map of all available properties
    • : STRING

Platforms

  • Android
  • Windows CE

Method Access:

  • Class Method: This method can only be accessed via the API class object.
    • EB.SmartCradle.getAllProperties()

getProperties(ARRAY arrayofNames)

This method will return a set of object/value pairs for the list of the propertyName that is passed in. The propertyNames must be a valid property of the API class.

Parameters

  • arrayofNames : ARRAY

    List of properties I want to know about

    • Object : STRING

  • callback : CallBackHandler

Callback

Async Callback Returning Parameters: HASH

    • : STRING

Returns

Synchronous Return:

  • HASH : Map of properties I want to know about
    • : STRING

Platforms

  • Android
  • Windows CE

Method Access:

  • Class Method: This method can only be accessed via the API class object.
    • EB.SmartCradle.getProperties(ARRAY arrayofNames)

getProperty(STRING propertyName)

This method will return the value of the propertyName that is passed in. The propertyName must be a valid property of the API class.

Parameters

  • propertyName : STRING

    The property to return info about.

  • callback : CallBackHandler

Callback

Async Callback Returning Parameters: STRING

    Returns

    Synchronous Return:

    • STRING : The property to return info about.

    Platforms

    • Android
    • Windows CE

    Method Access:

    • Class Method: This method can only be accessed via the API class object.
      • EB.SmartCradle.getProperty(STRING propertyName)

    setProperties(HASH propertyMap)

    This method will set the values of a list of properties for the API class. The propertyName must be a valid property for the class and must also not be read only.

    Parameters

    • propertyMap : HASH

      Map of properties I want to set

      • Object : STRING

    • callback : CallBackHandler

    Returns

    Synchronous Return:

    • Void

    Platforms

    • Android
    • Windows CE

    Method Access:

    • Class Method: This method can only be accessed via the API class object.
      • EB.SmartCradle.setProperties(HASH propertyMap)

    setProperty(STRING propertyName, STRING propertyValue)

    This method will set the value of a property for the API class. The propertyName must be a valid property for the class and must also not be read only.

    Parameters

    • propertyName : STRING

      The one property name that I want to set

    • propertyValue : STRING

      The one property value that I want to set

    • callback : CallBackHandler

    Returns

    Synchronous Return:

    • Void

    Platforms

    • Android
    • Windows CE

    Method Access:

    • Class Method: This method can only be accessed via the API class object.
      • EB.SmartCradle.setProperty(STRING propertyName, STRING propertyValue)

    unlock(INTEGER ledOnDuration, INTEGER ledOffDuration, INTEGER timeout)

    Unlocks the terminal from the cradle for the specified period. For Android, the smoothing effect by default is false.

    Parameters

    • ledOnDuration : INTEGER

      During unlock the LEDs will flash, this is the on duration of that flash specified in milliseconds. Set to 0 to prevent flashing and keep the LED off. In Android, this is in mSecs and the range is from 0 mSec(minimum) to 65535 mSec(maximum).

    • ledOffDuration : INTEGER

      During unlock the LEDs will flash, this is the off duration of that flash specified in milliseconds. Set to 0 to prevent flashing. If the on duration is non-zero and this parameter is zero then the LED will remain on when unlocked. In Android, this is in mSecs and the range is from 0 mSec(minimum) to 65535 mSec(maximum).

    • timeout : INTEGER

      The cradle will remain unlocked for the length of time in seconds specified by this value. Specified in seconds. Range 10 to 30 inclusive.

    • callback : CallBackHandler

    Returns

    Synchronous Return:

    • Void

    Platforms

    • Android
    • Windows CE

    Method Access:

    • Class Method: This method can only be accessed via the API class object.
      • EB.SmartCradle.unlock(INTEGER ledOnDuration, INTEGER ledOffDuration, INTEGER timeout)

    unlockEx(HASH propertyMap)

    Unlocks the terminal from the cradle for the specified period. For Android, the smoothing effect by default is false.

    Parameters

    • propertyMap : HASH

      The properties associated with reading card data.

      • ledOnDuration : INTEGER

        During unlock the LEDs will flash, this is the on duration of that flash specified in milliseconds. Set to 0 to prevent flashing and keep the LED off. In Android, this is in mSecs and the range is from 0 mSec(minimum) to 65535 mSec(maximum).

      • ledOffDuration : INTEGER

        During unlock the LEDs will flash, this is the off duration of that flash specified in milliseconds. Set to 0 to prevent flashing. If the on duration is non-zero and this parameter is zero then the LED will remain on when unlocked. In Android, this is in mSecs and the range is from 0 mSec(minimum) to 65535 mSec(maximum).

      • timeout : INTEGER

        The cradle will remain unlocked for the length of time in seconds specified by this value. Specified in seconds. Range 10 to 30 inclusive.

      • smoothingEffect : BOOLEAN

        Enables or Disables the smoothing effect of LED blinking.

    • callback : CallBackHandler

    Returns

    Synchronous Return:

    • Void

    Platforms

    • Android

    Method Access:

    • Class Method: This method can only be accessed via the API class object.
      • EB.SmartCradle.unlockEx(HASH propertyMap)

    Properties

    cApiVersion

    Type

    STRING Read Only

    Description

    CAPI version of the cradle. Not Applicable for Android.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.cApiVersion

    Platforms

    • Android
    • Windows CE

    chargeState

    Type

    STRING

    Description

    Sets the charge state of the cradle. Values can be either 'Fast' or 'Slow'.

    Values

    Possible Values (STRING):

    • Constant: EB.SmartCradle.SMART_CRADLE_FAST - String: fast The cradle will charge devices quickly.
    • Constant: EB.SmartCradle.SMART_CRADLE_SLOW - String: slow The cradle will charge devices slowly.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.chargeState

    Platforms

    • Android
    • Windows CE

    columnId

    Type

    INTEGER

    Description

    The current Column ID of the cradle in the matrix. In Android, the range of columnId is 0 to 255.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.columnId

    Platforms

    • Android
    • Windows CE

    driverVersion

    Type

    STRING Read Only

    Description

    Driver version of the cradle. Not Applicable for Android.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.driverVersion

    Platforms

    • Android
    • Windows CE

    firmwareVersion

    Type

    STRING Read Only

    Description

    Firmware version of the cradle.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.firmwareVersion

    Platforms

    • Android
    • Windows CE

    hardwareId

    Type

    INTEGER Read Only

    Description

    Hardware ID of the cradle

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.hardwareId

    Platforms

    • Android
    • Windows CE

    mfgDate

    Type

    STRING Read Only

    Description

    Manufacture date of the cradle in DD-MM-YY format. Not Applicable for Android.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.mfgDate

    Platforms

    • Android
    • Windows CE

    partNumber

    Type

    STRING Read Only

    Description

    Part number of the cradle.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.partNumber

    Platforms

    • Android
    • Windows CE

    rowId

    Type

    INTEGER

    Description

    The current Row ID of the cradle in the matrix. In Android, the range of rowId is 0 to 255.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.rowId

    Platforms

    • Android
    • Windows CE

    serialNumber

    Type

    STRING Read Only

    Description

    Serial number of the cradle.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.serialNumber

    Platforms

    • Android
    • Windows CE

    wallId

    Type

    INTEGER

    Description

    The current Wall ID of the cradle in the matrix. In Android, the range of wallId is 0 to 255.

    Access

    • Class: This property can only be accessed via the API class object.
      • EB.SmartCradle.wallId

    Platforms

    • Android
    • Windows CE

    Remarks

    Flashing the Cradle LEDs

    There is a hardware imposed limit to how quickly the cradle LEDs can be flashed for a quickly flashing LED it is recommended to set the on / off duration to 500ms.