AppBeaconStatus Method (CLIENT)


PLB Web Only, 9.9A

 

The AppBeaconStatus method retrieves the status of beacon capabilities for a mobile device. The method uses the following format:

 

[label]

{object}.AppBeaconStatus

[GIVING {return}] USING [[*Flag=]{flags}]

 

Where:

label

Optional. A Program Execution Label.

object

Required. A CLIENT object that has been declared.

return

Optional. A Numeric Variable that returns the success or failure of the method.

flags

Optional. A Numeric Variable or decimal number that specifies a bit mask value that controls the operations of this method.

Flags Affected: OVER, ZERO

Note the following:

  1. Beacon support is only available when using a 'PlbWebCli' client for an Android or iOS device.

  2. The beacon support is provided using the Cordova plugin found at the following URL:

  3. https://github.com/petermetz/cordova-plugin-ibeacon

     

    All beacon interactions and generated events are produced directly from this Cordova plugin package.

  4. The requested status information is returned to the PL/B program as a JSON string in the ARG1 result variable for an event named 'AppEventBeaconStatus'. Therefore, EVENTREGISTER instruction must be executed to register the 'AppEventBeaconStatus' event before this method is executed.

  5. The ZERO flag is set if the {return} value is zero indicating that the method execution was successful.

  6. The OVER flag is set if the value returned is too large to be stored into the {return} variable.

  7. The {return} value is zero when the method executes successfully. Otherwise, the {return} value is an error value as follows:

  8.  

    Error

    Value

    Description

    AppErrorNone

    0

    No error.

    AppErrorNoCordovaSupport

    1

    Action not supported by Cordova.

    AppErrorWithExtendedInfo

    2

    Error with extended information. See CLIENT method named 'AppExtendedError'.

     

  9. The {flags} parameter is numeric value reserved for future bit mask values to control the behaviors of this method.

  10. The AppBeaconStatus method operation is performed by the Cordova plugin. The resulting data is returned to the PL/B program as an event named 'AppEventBeaconStatus' which must be registered using an EVENTREGISTER instruction before this method is executed. The resulting data is stored as a JSON string value in the ARG1 result variable. The event number used to register the Beacon status event using EVENTREGISTER is defined as follows:

  11.  

    Event

    Value

    AppEventBeaconStatus

    126

     

    The ARG1 JSON string result fields are defined as follows:

     

    Field Name

    Value

    isBluetoothEnabled

    boolean and valid for Android only

    isRangingAvailable

    boolean (can AppBeaconRangeStart be used)

    getAuthorizationStatus

    object with one field

    authorizationStatus

    string value (e.g., AuthorizationStatusAuthorized)

    Sample Event JSON string data:

     

    {

      "isBluetoothEnabled": true,

      "isRangingAvailable": true,

      "getAuthorizationStatus": {

        "authorizationStatus": "AuthorizationStatusAuthorized"

      }

    }

    Example:

     

        EventReg Client:

                  AppEventBeaconStatus:

                  Event2:

                  ARG1=BeaconEventData

                  Client.AppBeaconStatus

 

 

See Also: CLIENT, Client Methods, Method Syntax



PL/B Language Reference AppBeacon Method (CLIENT) AppCapture Method (CLIENT)