2 * Copyright (C) 2008 Holger Hans Peter Freyther
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.
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.
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.
20 #ifndef GeolocationServiceGtk_h
21 #define GeolocationServiceGtk_h
22 #if ENABLE(GEOLOCATION)
24 #include "GeolocationService.h"
25 #include "Geoposition.h"
26 #include "PositionError.h"
29 #include <geoclue/geoclue-master.h>
30 #include <geoclue/geoclue-position.h>
33 class GeolocationServiceGtk : public GeolocationService {
35 static PassOwnPtr<GeolocationService> create(GeolocationServiceClient*);
36 ~GeolocationServiceGtk();
38 virtual bool startUpdating(PositionOptions*);
39 virtual void stopUpdating();
41 Geoposition* lastPosition() const;
42 PositionError* lastError() const;
45 GeolocationServiceGtk(GeolocationServiceClient*);
47 void setError(PositionError::ErrorCode, const char* message);
48 void updatePosition();
50 static void position_changed(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*, GeolocationServiceGtk*);
51 static void getPositionCallback(GeocluePosition*, GeocluePositionFields, int, double, double, double, GeoclueAccuracy*, GError*, GeolocationServiceGtk*);
54 RefPtr<Geoposition> m_lastPosition;
55 RefPtr<PositionError> m_lastError;
58 GeoclueMasterClient* m_geoclueClient;
59 GeocluePosition* m_geocluePosition;
61 // Error and Position state
66 double m_altitudeAccuracy;
71 #endif // ENABLE(GEOLOCATION)