Skip to content

/AWS1/IF_LOC=>FORECASTGEOFENCEEVENTS()

About ForecastGeofenceEvents

This action forecasts future geofence events that are likely to occur within a specified time horizon if a device continues moving at its current speed. Each forecasted event is associated with a geofence from a provided geofence collection. A forecast event can have one of the following states:

ENTER: The device position is outside the referenced geofence, but the device may cross into the geofence during the forecasting time horizon if it maintains its current speed.

EXIT: The device position is inside the referenced geofence, but the device may leave the geofence during the forecasted time horizon if the device maintains it's current speed.

IDLE:The device is inside the geofence, and it will remain inside the geofence through the end of the time horizon if the device maintains it's current speed.

Heading direction is not considered in the current version. The API takes a conservative approach and includes events that can occur for any heading.

Method Signature

IMPORTING

Required arguments:

iv_collectionname TYPE /AWS1/LOCRESOURCENAME /AWS1/LOCRESOURCENAME

The name of the geofence collection.

io_devicestate TYPE REF TO /AWS1/CL_LOCFCGEOFENCEEVTSDE00 /AWS1/CL_LOCFCGEOFENCEEVTSDE00

Represents the device's state, including its current position and speed. When speed is omitted, this API performs a containment check. The containment check operation returns IDLE events for geofences where the device is currently inside of, but no other events.

Optional arguments:

iv_timehorizonminutes TYPE /AWS1/RT_DOUBLE_AS_STRING /AWS1/RT_DOUBLE_AS_STRING

The forward-looking time window for forecasting, specified in minutes. The API only returns events that are predicted to occur within this time horizon. When no value is specified, this API performs a containment check. The containment check operation returns IDLE events for geofences where the device is currently inside of, but no other events.

iv_distanceunit TYPE /AWS1/LOCDISTANCEUNIT /AWS1/LOCDISTANCEUNIT

The distance unit used for the NearestDistance property returned in a forecasted event. The measurement system must match for DistanceUnit and SpeedUnit; if Kilometers is specified for DistanceUnit, then SpeedUnit must be KilometersPerHour.

Default Value: Kilometers

iv_speedunit TYPE /AWS1/LOCSPEEDUNIT /AWS1/LOCSPEEDUNIT

The speed unit for the device captured by the device state. The measurement system must match for DistanceUnit and SpeedUnit; if Kilometers is specified for DistanceUnit, then SpeedUnit must be KilometersPerHour.

Default Value: KilometersPerHour.

iv_nexttoken TYPE /AWS1/LOCLARGETOKEN /AWS1/LOCLARGETOKEN

The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

Default value: null

iv_maxresults TYPE /AWS1/LOCINTEGER /AWS1/LOCINTEGER

An optional limit for the number of resources returned in a single call.

Default value: 20

RETURNING

oo_output TYPE REF TO /aws1/cl_locfcgeofenceevtsrsp /AWS1/CL_LOCFCGEOFENCEEVTSRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_loc~forecastgeofenceevents(
  io_devicestate = new /aws1/cl_locfcgeofenceevtsde00(
    it_position = VALUE /aws1/cl_locposition_w=>tt_position(
      ( new /aws1/cl_locposition_w( |0.1| ) )
    )
    iv_speed = '0.1'
  )
  iv_collectionname = |string|
  iv_distanceunit = |string|
  iv_maxresults = 123
  iv_nexttoken = |string|
  iv_speedunit = |string|
  iv_timehorizonminutes = |0.1|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_forecastedevents( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_uuid = lo_row_1->get_eventid( ).
      lv_id = lo_row_1->get_geofenceid( ).
      lv_boolean = lo_row_1->get_isdeviceingeofence( ).
      lv_nearestdistance = lo_row_1->get_nearestdistance( ).
      lv_forecastedgeofenceevent = lo_row_1->get_eventtype( ).
      lv_timestamp = lo_row_1->get_forecastedbreachtime( ).
      LOOP AT lo_row_1->get_geofenceproperties( ) into ls_row_2.
        lv_key = ls_row_2-key.
        lo_value = ls_row_2-value.
        IF lo_value IS NOT INITIAL.
          lv_string = lo_value->get_value( ).
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
  lv_largetoken = lo_result->get_nexttoken( ).
  lv_distanceunit = lo_result->get_distanceunit( ).
  lv_speedunit = lo_result->get_speedunit( ).
ENDIF.