Pedometer


Purpose

Constitutes the object that enables access to data from various sensors to return the number of steps made by the user.

Once data gathering is started using the start method, the API starts sending data objects at set intervals.

You can establish the object by using the following reference:

launchbox.Motion.Pedometer (interval, dataCallback, errorCallback)

Module

This object belongs to the Motion product module.

Parameters

Name Description Type Use
interval Defined to set an expected interval (in miliseconds) at which data is collected from the sensors. integer required
dataCallback

Defined to receive the data JSON object similar to the one presented below the table.

function required
errorCallback

Defined to receive the error JSON object similar to the one presented below the table.

function required

JSON objects received by the callbacks

The data JSON object contains the following values:

{
  "timestamp" = 1455810375223, // Time of the event in milliseconds, counted from the 1 January 1970 (long)
  "count" = 142 // Amount of steps taken from the sensor's registration (int)
}

Integer values returned in this object represent the percentage of probability that the device user's activity is one of the ones listed in the object.

The error JSON object contains one attribute that passes an error message delivered by the device:

{
  "message" = "Sensor 'PEDOMETER' is not available on this device."
}

Methods

Name Return type Description
start undefined

Initiates gathering of data from the Pedometer hardware sensor.

stop undefined

Stops gathering of data from the Pedometer hardware sensor.

Related topics

Public API reference
Legal notice | Copyright © 2019 and Confidential to Pegasystems Inc. All rights reserved
Pega Community | Feedback
Advanced...