~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/dataengines/geolocation/location_gps.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright (C) 2009 Petri Damstén <damu@iki.fi>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or
 
5
 *   modify it under the terms of the GNU General Public License as
 
6
 *   published by the Free Software Foundation; either version 2 of
 
7
 *   the License, or (at your option) any later version.
 
8
 *
 
9
 *   This program 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
 
12
 *   GNU General Public License for more details.
 
13
 *
 
14
 *   You should have received a copy of the GNU General Public License
 
15
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
 */
 
17
 
 
18
#ifndef GPS_H
 
19
#define GPS_H
 
20
 
 
21
#include <gps.h>
 
22
#include <QThread>
 
23
#include <QMutex>
 
24
#include <QWaitCondition>
 
25
 
 
26
#include "geolocationprovider.h"
 
27
 
 
28
class Gpsd : public QThread
 
29
{
 
30
    Q_OBJECT
 
31
public:
 
32
    Gpsd(gps_data_t* gpsdata);
 
33
    virtual ~Gpsd();
 
34
 
 
35
    void update();
 
36
 
 
37
signals:
 
38
    void dataReady(const Plasma::DataEngine::Data& data);
 
39
 
 
40
protected:
 
41
    virtual void run();
 
42
 
 
43
private:
 
44
    gps_data_t* m_gpsdata;
 
45
    QMutex m_mutex;
 
46
    QWaitCondition m_condition;
 
47
    bool m_abort;
 
48
};
 
49
 
 
50
class Gps : public GeolocationProvider
 
51
{
 
52
    Q_OBJECT
 
53
public:
 
54
    explicit Gps(QObject *parent = 0, const QVariantList &args = QVariantList());
 
55
    ~Gps();
 
56
 
 
57
    void update();
 
58
 
 
59
private:
 
60
    Gpsd* m_gpsd;
 
61
#if GPSD_API_MAJOR_VERSION >= 5
 
62
    gps_data_t* m_gpsdata;
 
63
#endif
 
64
};
 
65
 
 
66
#endif