GNSS_GEOFENCE_STATE - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// gnssdriver.h

typedef enum {
  GNSS_GeofenceState_Unknown,
  GNSS_GeofenceState_Entered,
  GNSS_GeofenceState_Exited
} GNSS_GEOFENCE_STATE;
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (ne-gnssdriver-gnss_geofence_state)

GNSS_GEOFENCE_STATE enumeration

Description

GNSS_GEOFENCE_STATE enumerates the various states of a single geofence.

Constants

GNSS_GeofenceState_Unknown

The state of the geofence is unknown.

GNSS_GeofenceState_Entered

The geofence has been entered.

GNSS_GeofenceState_Exited

The geofence has been exited.

Remarks

The following bitmasks are used by the HLOS to request state-change alerts for geofences:

#define GNSS_GEOFENCEALERTTYPE_ENTRY  GNSS_GeofenceState_Entered    // Enter Geofence
#define GNSS_GEOFENCEALERTTYPE_EXIT   GNSS_GeofenceState_Exited     // Exit Geofence

An entry alert is raised when the previous state of the geofence was unknown or exited and the device has now entered the geofence.

An exit alert is raised when the previous state of the geofence was entered and the device has now exited the geofence. If the previous state of the geofence was unknown, and the device is currently outside of the geofence, no exit alert will be generated.

The location platform only sends an exit trigger to apps when the previous known state for a fence is inside the fence. This is a design decision to avoid chattiness of exit events on geofence configuration (For example, when not expecting a user configuring an exit fence from home to need to be notified that they are outside of home if they configure the notification when they are already outside of the home). Nevertheless, the location platform could handle where the GNSS driver sends exit events, but it is not recommend because then the interaction between the GNSS adapter and the GNSS driver will become very verbose. Given that the chances of the user entering a geofence are much smaller than the user being outside a geofences, this behavior reduces the required interaction between the GNSS driver and the GNSS adapter. For example, in the case of 100 geofences pushed to the GNSS driver, and a user was outside all of them, without this behavior the will need to send to the GNSS adapter 100 exit notifications. The likelihood of something similar to this happening for entry events is very small.

The geofence state transition and the associated alerts are shown below. For simplicity, the hysteresis and geofence boundary conditions are implied.

GNSS geofence state diagram.

The key aspects of this state diagram are: