diff --git a/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.cpp b/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.cpp index 08f92961e7..776b9de9a2 100644 --- a/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.cpp +++ b/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.cpp @@ -20,7 +20,8 @@ #include "IndoorsLocationDataSourceCreator.h" #include "ShowDeviceLocationUsingIndoorPositioning.h" -#include "IndoorsLocationDataSource.h" +#include "IndoorsLocationDataSourceConfiguration.h" +#include "IpsInfoMessage.h" #include "Map.h" #include "MapQuickView.h" #include "MapViewTypes.h" @@ -89,6 +90,17 @@ void ShowDeviceLocationUsingIndoorPositioning::setupIndoorsLocationDataSource() connect(indoorsLocationDataSourceCreator, &IndoorsLocationDataSourceCreator::createIndoorsLocationDataSourceCompleted, this, [this](IndoorsLocationDataSource* indoorsLDS) { connect(m_mapView->locationDisplay(), &LocationDisplay::locationChanged, this, &ShowDeviceLocationUsingIndoorPositioning::locationChangedHandler); + m_indoorsLocationDataSource.reset(indoorsLDS); + IndoorsLocationDataSourceConfiguration* conf = m_indoorsLocationDataSource->configuration(); + conf->setInfoMessagesEnabled(true); + m_indoorsLocationDataSource->setConfiguration(conf); + connect(m_indoorsLocationDataSource.get(), &IndoorsLocationDataSource::messageReceived, this, [this](IpsInfoMessage* ipsInfoMsg) + { + qDebug() << "IPS info Message Received - "<< ipsInfoMsg->message(); + m_ipsInfoMessage = ipsInfoMsg->message(); + emit ipsInfoMessageChanged(); + delete ipsInfoMsg; + }); m_mapView->locationDisplay()->setDataSource(indoorsLDS); m_mapView->locationDisplay()->setAutoPanMode(LocationDisplayAutoPanMode::Navigation); @@ -127,7 +139,12 @@ void ShowDeviceLocationUsingIndoorPositioning::changeFloorDisplay() } } - QVariantMap ShowDeviceLocationUsingIndoorPositioning::locationProperties() const - { - return m_locationProperties; - } +QVariantMap ShowDeviceLocationUsingIndoorPositioning::locationProperties() const +{ + return m_locationProperties; +} + +QString ShowDeviceLocationUsingIndoorPositioning::getIpsInfoMessage() const +{ + return m_ipsInfoMessage; +} diff --git a/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.h b/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.h index 963f611309..b13a5be85c 100644 --- a/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.h +++ b/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.h @@ -26,6 +26,7 @@ class MapQuickView; } #include "Location.h" +#include "IndoorsLocationDataSource.h" #include #include @@ -38,6 +39,7 @@ class ShowDeviceLocationUsingIndoorPositioning : public QObject Q_PROPERTY(Esri::ArcGISRuntime::MapQuickView* mapView READ mapView WRITE setMapView NOTIFY mapViewChanged) Q_PROPERTY(QVariantMap locationProperties READ locationProperties NOTIFY locationPropertiesChanged) + Q_PROPERTY(QString ipsInfoMessage READ getIpsInfoMessage NOTIFY ipsInfoMessageChanged) public: explicit ShowDeviceLocationUsingIndoorPositioning(QObject* parent = nullptr); @@ -50,10 +52,12 @@ class ShowDeviceLocationUsingIndoorPositioning : public QObject signals: void mapViewChanged(); void locationPropertiesChanged(); + void ipsInfoMessageChanged(); private: Esri::ArcGISRuntime::MapQuickView* mapView() const; QVariantMap locationProperties() const; + QString getIpsInfoMessage() const; void setMapView(Esri::ArcGISRuntime::MapQuickView* mapView); void setupIndoorsLocationDataSource(); @@ -64,8 +68,10 @@ class ShowDeviceLocationUsingIndoorPositioning : public QObject Esri::ArcGISRuntime::MapQuickView* m_mapView = nullptr; Esri::ArcGISRuntime::FeatureTable* m_positioningTable = nullptr; Esri::ArcGISRuntime::ArcGISFeatureTable* m_pathwaysTable = nullptr; + std::unique_ptr m_indoorsLocationDataSource = nullptr; QVariantMap m_locationProperties; int m_currentFloor; + QString m_ipsInfoMessage = "No message!"; }; #endif // SHOWDEVICELOCATIONUSINGINDOORPOSITIONING_H diff --git a/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.qml b/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.qml index aae678a2e5..c79523121f 100644 --- a/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.qml +++ b/CppSamples/Maps/ShowDeviceLocationUsingIndoorPositioning/ShowDeviceLocationUsingIndoorPositioning.qml @@ -72,6 +72,10 @@ Item { text: "Horizontal accuracy: " + (model.locationProperties.horizontalAccuracy ? model.locationProperties.horizontalAccuracy.toFixed(2) + " m" : "undefined") visible: model.locationProperties.horizontalAccuracy !== undefined } + Text { + text: "IPS Info Messages: " + model.ipsInfoMessage + visible: true + } } }