GeotriggerMonitor Class

  • GeotriggerMonitor
  • class Esri::ArcGISRuntime::GeotriggerMonitor

    A GeotriggerMonitor monitors a Geotrigger condition and, when it is met, results in a GeotriggerNotificationInfo. More...

    Header: #include <GeotriggerMonitor.h>
    Since: Esri::ArcGISRuntime 100.12
    Inherits: Esri::ArcGISRuntime::Object

    This class was introduced in Esri::ArcGISRuntime 100.12.

    Public Functions

    GeotriggerMonitor(Esri::ArcGISRuntime::Geotrigger *geotrigger, QObject *parent = nullptr)
    virtual ~GeotriggerMonitor() override
    Esri::ArcGISRuntime::Geotrigger *geotrigger() const
    Esri::ArcGISRuntime::TaskWatcher start()
    Esri::ArcGISRuntime::GeotriggerMonitorStatus status() const
    void stop()
    Esri::ArcGISRuntime::Error warning() const

    Signals

    void geotriggerNotification(Esri::ArcGISRuntime::GeotriggerNotificationInfo *geotriggerNotificationInfo)
    void startCompleted(QUuid taskId)
    void statusChanged(Esri::ArcGISRuntime::GeotriggerMonitorStatus status)
    void warningChanged(Esri::ArcGISRuntime::Error warning)

    Detailed Description

    A Geotrigger defines a query that is evaluated against GIS data as it changes in real time. For example, "Notify me when my device location enters one of my target areas" or "Notify me when my device location is within 50 meters of my destination". The process of monitoring a Geotrigger is also known as "Geofencing".

    A GeotriggerMonitor is created with a Geotrigger that it continually checks to determine whether the condition has been met.

    Once a GeotriggerMonitor is created, you begin checking the condition by calling start. Once you are finished, call stop. When a Geotrigger evaluates to true, a geotriggerNotification is sent. You can subscribe to the notification info to receive details of where the Geotrigger was activated and the condition that was met.

    Member Function Documentation

    GeotriggerMonitor::GeotriggerMonitor(Esri::ArcGISRuntime::Geotrigger *geotrigger, QObject *parent = nullptr)

    Constructs a GeotriggerMonitor with a Geotrigger condition.

    • geotrigger - The Geotrigger which will be monitored.
    • parent - The optional parent QObject.

    [signal] void GeotriggerMonitor::geotriggerNotification(Esri::ArcGISRuntime::GeotriggerNotificationInfo *geotriggerNotificationInfo)

    Indicates that the GeotriggerMonitor condition has been meet.

    To handle notifications, connect to this signal and inspect the geotriggerNotificationInfo.

    The returned GeotriggerNotificationInfo object has the GeotriggerMonitor as its parent.

    connect(m_monitor, &GeotriggerMonitor::geotriggerNotification, this, [this](GeotriggerNotificationInfo* notification)
    {
      // Ensure the notification object is cleaned up once it has been inspected.
      QScopedPointer<GeotriggerNotificationInfo> scopedGeotriggerNotification(notification);
    
      qDebug() << notification->message();
    }

    See also Returned QObjects Parenting.

    [signal] void GeotriggerMonitor::startCompleted(QUuid taskId)

    Signal emitted when the start operation completes.

    • taskId - The task ID of the asynchronous operation.

    [signal] void GeotriggerMonitor::statusChanged(Esri::ArcGISRuntime::GeotriggerMonitorStatus status)

    Indicates that the status property has changed.

    [signal] void GeotriggerMonitor::warningChanged(Esri::ArcGISRuntime::Error warning)

    Indicates that the warning property has changed.

    • warning - The Error of the geotrigger monitor.

    [override virtual] GeotriggerMonitor::~GeotriggerMonitor()

    Destructor.

    Esri::ArcGISRuntime::Geotrigger *GeotriggerMonitor::geotrigger() const

    Returns the Geotrigger that will be monitored.

    Esri::ArcGISRuntime::TaskWatcher GeotriggerMonitor::start()

    Returns starts evaluating the GeotriggerMonitor.

    When the GeotriggerMonitor is successfully performing checks, the status will be GeotriggerMonitorStatus::Started.

    Returns a string representing the task ID of the asynchronous task.

    Esri::ArcGISRuntime::GeotriggerMonitorStatus GeotriggerMonitor::status() const

    Returns the current monitoring status of the GeotriggerMonitor.

    A GeotriggerMonitor begins with a monitoring status of GeotriggerMonitorStatus::Stopped and changes to GeotriggerMonitorStatus::Started when you call start. When you call stop, the monitoring status changes to GeotriggerMonitorStatus::Stopped.

    void GeotriggerMonitor::stop()

    Returns stops evaluating the GeotriggerMonitor.

    Stopping the GeotriggerMonitor prevents the condition from being evaluated and notifications from being sent. If you are using a LocationGeotriggerFeed created from a AbstractLocationDataSource, the data source must also be stopped to turn off GPS receivers etc.

    When the GeotriggerMonitor is stopped, the status will be GeotriggerMonitorStatus::Stopped.

    Esri::ArcGISRuntime::Error GeotriggerMonitor::warning() const

    Returns an error that describes a problem encountered while monitoring the Geotrigger.

    A warning can occur at various stages of monitoring a Geotrigger:

    If the problem is resolved, this property will be cleared.

    Problems that occur when starting the GeotriggerMonitor result in a status of GeotriggerMonitorStatus::FailedToStart. These issues must be fixed and start called again before you will receive any notifications. For example, if the Geotrigger::messageExpression is an invalid ArcadeExpression, monitoring cannot be carried out.

    Problems that occur when accessing the components of the Geotrigger will not prevent the GeotriggerMonitor from starting. However, until the problem is resolved, you will not receive any notifications. For example, if a LocationGeotriggerFeed uses a AbstractLocationDataSource that is not started, you will not receive any notifications. After the AbstractLocationDataSource is successfully started, monitoring will resume. If a FenceParameters has no valid data for a fence, you will not receive any notifications.

    Problems that occur during ongoing monitoring relate to issues with individual objects, such as the graphics that make up the fences for a GraphicFenceParameters. These warnings do not prevent notifications from being sent for other valid fences. For example, a fence is considered invalid if it has:

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.