# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../kdebase-workspace/0001-kdebase-workspace-gpsd-api.patch # Copyright (C) 2011 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- From: Rafael Fernández López Date: Thu, 28 Apr 2011 11:35:53 +0000 Subject: gpsd api has changed and for GPSD_API_MAJOR_VERSION >=5 there are X-Git-Url: http://quickgit.kde.org/?p=kde-workspace.git&a=commitdiff&h=a3009dd96e8519bcc205d75c29e18bbbb81fce03 --- gpsd api has changed and for GPSD_API_MAJOR_VERSION >=5 there are some calls that are slightly different. Make the dataengine compile against this version and previous one by adding conditional code. REVIEW: 101247 --- --- a/plasma/generic/dataengines/geolocation/location_gps.cpp +++ b/plasma/generic/dataengines/geolocation/location_gps.cpp @@ -51,7 +51,11 @@ void Gpsd::run() while (!m_abort) { Plasma::DataEngine::Data d; +#if GPSD_API_MAJOR_VERSION >= 5 + if (gps_read(m_gpsdata) != -1) { +#else if (gps_poll(m_gpsdata) != -1) { +#endif //kDebug() << "poll ok"; if (m_gpsdata->online) { //kDebug() << "online"; @@ -73,11 +77,19 @@ void Gpsd::run() Gps::Gps(QObject* parent, const QVariantList& args) : GeolocationProvider(parent, args), m_gpsd(0) +#if GPSD_API_MAJOR_VERSION >= 5 + , m_gpsdata(0) +#endif { - gps_data_t* gpsdata = gps_open("localhost", DEFAULT_GPSD_PORT); - if (gpsdata) { +#if GPSD_API_MAJOR_VERSION >= 5 + m_gpsdata = new gps_data_t; + gps_open("localhost", DEFAULT_GPSD_PORT, m_gpsdata); +#else + gps_data_t* m_gpsdata = gps_open("localhost", DEFAULT_GPSD_PORT); +#endif + if (m_gpsdata) { kDebug() << "gpsd found."; - m_gpsd = new Gpsd(gpsdata); + m_gpsd = new Gpsd(m_gpsdata); connect(m_gpsd, SIGNAL(dataReady(const Plasma::DataEngine::Data&)), this, SIGNAL(setData(const Plasma::DataEngine::Data&))); } else { @@ -90,6 +102,9 @@ Gps::Gps(QObject* parent, const QVariant Gps::~Gps() { delete m_gpsd; +#if GPSD_API_MAJOR_VERSION >= 5 + delete m_gpsdata; +#endif } void Gps::update() --- a/plasma/generic/dataengines/geolocation/location_gps.h +++ b/plasma/generic/dataengines/geolocation/location_gps.h @@ -58,6 +58,9 @@ public: private: Gpsd* m_gpsd; +#if GPSD_API_MAJOR_VERSION >= 5 + gps_data_t* m_gpsdata; +#endif }; #endif