Like the GetMobileLocation function for the current asset, the GetMobileLocationForDevice function retrieves the locations (as an array) over the specified timespan. The difference is that this function retrieves the locations for ANOTHER asset, not the current asset. Use this function when you want to compare locations or distances with other assets. The elements returned in the array are strings of the form: (lat, lng).
Important!
This function is available only if the Axeda® Platform is configured
to enable historical functions.
Historical functions retrieve data from the Platform, which can slow response
time for rules processing. To ensure optimal response time, Axeda
strongly recommends that you limit the amount of data these functions
retrieve, the frequency that the expression rules that use them run, and
the number of assets associated with expression rules that use them. For
example, do not request historical data more than once per second.
Array GetMobileLocationForDevice(String model, String serialnumber, Number timespan, Number max)
where:
model
- The name of model
for the asset whose locations you want to retrieve.
serialnumber
- The serial number
of the asset.
timespan
- The timespan
during which you want to retrieve mobile locations. You can specify the
timespan in minutes, hours, days, weeks, or months; see how to
define timespan values;
unless defined otherwise, uses minutes as value, by default.
max - Optional; the maximum number of values to be returned. The function does not return more than 100 (lat, lng) pairs.
GetMobileLocationForDevice("model1","device1",5,10)
For the asset, model1, serial number "device1," this expression returns up to 10 locations that were logged to the Platform within the last 5 minutes.