summaryrefslogtreecommitdiffstats
path: root/src/plugins/sensors/ios/ioscompass.h
blob: 3ebcb4ad1ed018464ae6d9bf1f397a13bd7f38c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef IOSCompass_H
#define IOSCompass_H

#import <CoreLocation/CLLocationManager.h>

#include <qsensorbackend.h>
#include <qcompass.h>

QT_BEGIN_NAMESPACE

class IOSCompass : public QSensorBackend
{
public:
    static char const * const id;

    explicit IOSCompass(QSensor *sensor);
    ~IOSCompass();

    void start() override;
    void stop() override;

    void headingChanged(qreal heading, quint64 timestamp, qreal calibrationLevel);

private:
    CLLocationManager *m_locationManager;
    QCompassReading m_reading;
};
QT_END_NAMESPACE

#endif // IOSCompass_H