1/*
2 * Copyright (C) 2012 Igalia S.L.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB.  If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#ifndef GeolocationProviderGeoclue_h
21#define GeolocationProviderGeoclue_h
22
23#if ENABLE(GEOLOCATION)
24
25#include "GeolocationProviderGeoclueClient.h"
26#include <geoclue/geoclue-master.h>
27#include <geoclue/geoclue-position.h>
28#include <wtf/gobject/GRefPtr.h>
29
30namespace WebCore {
31
32class GeolocationProviderGeoclue {
33public:
34    GeolocationProviderGeoclue(GeolocationProviderGeoclueClient*);
35    ~GeolocationProviderGeoclue();
36
37    void startUpdating();
38    void stopUpdating();
39    void setEnableHighAccuracy(bool);
40
41    // To be used from signal callbacks.
42    void initializeGeoclueClient(GeoclueMasterClient*);
43    void initializeGeocluePosition(GeocluePosition*);
44    void updateClientRequirements();
45    void positionChanged(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*);
46    void errorOccurred(const char*);
47
48private:
49    GeolocationProviderGeoclueClient* m_client;
50
51    GRefPtr<GeoclueMasterClient> m_geoclueClient;
52    GRefPtr<GeocluePosition> m_geocluePosition;
53
54    double m_latitude;
55    double m_longitude;
56    double m_altitude;
57    double m_accuracy;
58    double m_altitudeAccuracy;
59    int m_timestamp;
60
61    bool m_enableHighAccuracy;
62    bool m_isUpdating;
63};
64
65} // namespace WebCore
66
67#endif // ENABLE(GEOLOCATION)
68
69#endif // GeolocationProviderGeoclue_h
70