Commit 4e0a93da authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Dennis Nienhüser

Remove suport for maemo

Summary:
Mobody uses that anymore. dead code.
Signed-off-by: default avatarTomaz Canabrava <tomaz.canabrava@gmail.com>

Test Plan: compiled fine.

Reviewers: nienhueser

Reviewed By: nienhueser

Subscribers: rahn

Differential Revision: https://phabricator.kde.org/D1903
parent d0977fe0
......@@ -8,14 +8,6 @@ IF(LIBGPS_FOUND)
ADD_SUBDIRECTORY( gpsd )
ENDIF(LIBGPS_FOUND)
macro_optional_find_package(liblocation)
marble_set_package_properties( liblocation PROPERTIES DESCRIPTION "position information on Maemo 5 devices" )
marble_set_package_properties( liblocation PROPERTIES URL "http://maemo.org/" )
marble_set_package_properties( liblocation PROPERTIES TYPE OPTIONAL PURPOSE "position information via GPS/WLAN for the Nokia N900 smartphone" )
IF(liblocation_FOUND)
ADD_SUBDIRECTORY( maemo )
ENDIF(liblocation_FOUND)
macro_optional_find_package(Qt5Location)
macro_optional_find_package(Qt5Positioning)
marble_set_package_properties( Qt5Positioning PROPERTIES DESCRIPTION "a collection of APIs and frameworks" )
......
PROJECT( MaemoPositionProviderPlugin )
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${liblocation_INCLUDE_DIRS}
)
set( maemo_SRCS
MaemoPositionProviderPlugin.cpp
)
set( MaemoPositionProviderPlugin_LIBS ${liblocation_LIBRARIES} )
marble_add_plugin( MaemoPositionProviderPlugin ${maemo_SRCS} )
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Dennis Nienhüser <nienhueser@kde.org>
//
#include "MaemoPositionProviderPlugin.h"
#include <QTimer>
#include <location/location-gps-device.h>
#include <location/location-gpsd-control.h>
namespace Marble {
class MaemoPositionProviderPluginPrivate
{
public:
LocationGPSDControl *m_control;
LocationGPSDevice *m_device;
PositionProviderStatus m_status;
QTimer m_timer;
qreal m_speed;
qreal m_direction;
QDateTime m_timestamp;
MaemoPositionProviderPluginPrivate();
~MaemoPositionProviderPluginPrivate();
};
MaemoPositionProviderPluginPrivate::MaemoPositionProviderPluginPrivate() :
m_control( 0 ), m_device( 0 ), m_status( PositionProviderStatusAcquiring ),
m_speed( 0 ), m_direction( 0 )
{
m_timer.setInterval( 1000 );
}
MaemoPositionProviderPluginPrivate::~MaemoPositionProviderPluginPrivate()
{
g_object_unref( m_device );
g_object_unref( m_control );
}
QString MaemoPositionProviderPlugin::name() const
{
return tr( "Maemo Position Provider Plugin" );
}
QString MaemoPositionProviderPlugin::nameId() const
{
return "MaemoPositionProvider";
}
QString MaemoPositionProviderPlugin::guiString() const
{
return tr( "Maemo" );
}
QString MaemoPositionProviderPlugin::version() const
{
return "1.0";
}
QString MaemoPositionProviderPlugin::description() const
{
return tr( "Reports the GPS position of a Maemo device (e.g. Nokia N900)." );
}
QString MaemoPositionProviderPlugin::copyrightYears() const
{
return "2010";
}
QList<PluginAuthor> MaemoPositionProviderPlugin::pluginAuthors() const
{
return QList<PluginAuthor>()
<< PluginAuthor( QString::fromUtf8( "Dennis Nienhüser" ), "nienhueser@kde.org" );
}
QIcon MaemoPositionProviderPlugin::icon() const
{
return QIcon();
}
PositionProviderPlugin* MaemoPositionProviderPlugin::newInstance() const
{
return new MaemoPositionProviderPlugin;
}
PositionProviderStatus MaemoPositionProviderPlugin::status() const
{
return d->m_status;
}
GeoDataCoordinates MaemoPositionProviderPlugin::position() const
{
if ( status() == PositionProviderStatusAvailable &&
d->m_device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET ) {
qreal alt = 0.0;
if ( d->m_device->fix->fields & LOCATION_GPS_DEVICE_ALTITUDE_SET ) {
alt = d->m_device->fix->altitude;
}
if ( d->m_device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET ) {
d->m_speed = d->m_device->fix->speed;
}
if ( d->m_device->fix->fields & LOCATION_GPS_DEVICE_TRACK_SET ) {
d->m_direction = d->m_device->fix->track;
}
if ( d->m_device->fix->fields & LOCATION_GPS_DEVICE_TIME_SET ) {
d->m_timestamp = QDateTime::fromMSecsSinceEpoch( d->m_device->fix->time * 1000 );
}
return GeoDataCoordinates( d->m_device->fix->longitude,
d->m_device->fix->latitude,
alt, GeoDataCoordinates::Degree );
}
return GeoDataCoordinates();
}
qreal MaemoPositionProviderPlugin::speed() const
{
return d->m_speed * KM2METER / HOUR2SEC;
}
qreal MaemoPositionProviderPlugin::direction() const
{
return d->m_direction;
}
GeoDataAccuracy MaemoPositionProviderPlugin::accuracy() const
{
GeoDataAccuracy result;
if ( status() == PositionProviderStatusAvailable ) {
result.level = GeoDataAccuracy::Detailed;
result.horizontal = d->m_device->fix->eph / 100.0; // cm => meter
result.vertical = d->m_device->fix->epv; // meter
}
else {
result.level = GeoDataAccuracy::none;
result.horizontal = 0;
result.vertical = 0;
}
return result;
}
QDateTime MaemoPositionProviderPlugin::timestamp() const
{
return d->m_timestamp;
}
MaemoPositionProviderPlugin::MaemoPositionProviderPlugin() :
d( new MaemoPositionProviderPluginPrivate )
{
connect( &d->m_timer, SIGNAL(timeout()), this, SLOT(update()) );
}
MaemoPositionProviderPlugin::~MaemoPositionProviderPlugin()
{
delete d;
}
void MaemoPositionProviderPlugin::initialize()
{
// See http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Connectivity_Components/Using_Location_API
d->m_control = location_gpsd_control_get_default();
d->m_device = reinterpret_cast<LocationGPSDevice*>( g_object_new( LOCATION_TYPE_GPS_DEVICE, NULL ) );
g_object_set( G_OBJECT( d->m_control ),
"preferred-method", LOCATION_METHOD_USER_SELECTED,
"preferred-interval", LOCATION_INTERVAL_1S,
NULL);
location_gpsd_control_start( d->m_control );
// Poll and report the GPS position each second.
d->m_timer.start();
}
bool MaemoPositionProviderPlugin::isInitialized() const
{
return d->m_control != 0;
}
void MaemoPositionProviderPlugin::update()
{
PositionProviderStatus newStatus = PositionProviderStatusAcquiring;
if ( d->m_device ) {
if ( d->m_device->status == LOCATION_GPS_DEVICE_STATUS_FIX && d->m_device->fix )
newStatus = PositionProviderStatusAvailable;
else
newStatus = PositionProviderStatusUnavailable;
}
if ( newStatus != d->m_status ) {
d->m_status = newStatus;
emit statusChanged( newStatus );
}
if ( newStatus == PositionProviderStatusAvailable ) {
emit positionChanged( position(), accuracy() );
}
}
} // namespace Marble
Q_EXPORT_PLUGIN2( Marble::MaemoPositionProviderPlugin, Marble::MaemoPositionProviderPlugin )
#include "moc_MaemoPositionProviderPlugin.cpp"
//
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Dennis Nienhüser <nienhueser@kde.org>
//
#ifndef MAEMO_POSITION_PROVIDER_PLUGIN_H
#define MAEMO_POSITION_PROVIDER_PLUGIN_H
#include "PositionProviderPlugin.h"
namespace Marble
{
class MaemoPositionProviderPluginPrivate;
class MaemoPositionProviderPlugin: public PositionProviderPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA( IID "org.kde.edu.marble.MaemoPositionProviderPlugin" )
Q_INTERFACES( Marble::PositionProviderPluginInterface )
public:
MaemoPositionProviderPlugin();
virtual ~MaemoPositionProviderPlugin();
// Implementing PluginInterface
virtual QString name() const;
virtual QString nameId() const;
virtual QString guiString() const;
virtual QString version() const;
virtual QString description() const;
virtual QString copyrightYears() const;
virtual QList<PluginAuthor> pluginAuthors() const;
virtual QIcon icon() const;
virtual void initialize();
virtual bool isInitialized() const;
// Implementing PositionProviderPlugin
virtual PositionProviderPlugin * newInstance() const;
// Implementing PositionProviderPluginInterface
virtual PositionProviderStatus status() const;
virtual GeoDataCoordinates position() const;
virtual qreal speed() const;
virtual qreal direction() const;
virtual GeoDataAccuracy accuracy() const;
virtual QDateTime timestamp() const;
private Q_SLOTS:
/** Regular (each second) position and status update */
void update();
private:
MaemoPositionProviderPluginPrivate* const d;
};
}
#endif // MAEMO_POSITION_PROVIDER_PLUGIN_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment