providers/remote/interface.h
Go to the documentation of this file.
/*
* Copyright © 2014 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Manuel de la Pena <manuel.delapena@canonical.com>
*/
#ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
#include <core/dbus/macros.h>
#include <core/dbus/object.h>
#include <core/dbus/property.h>
#include <core/dbus/signal.h>
#include <core/dbus/traits/service.h>
#include <com/lomiri/location/codec.h>
#include <com/lomiri/location/update.h>
#include <com/lomiri/location/heading.h>
#include <com/lomiri/location/position.h>
#include <com/lomiri/location/velocity.h>
namespace com
{
namespace lomiri
{
namespace location
{
namespace providers
{
namespace remote
{
struct Interface
{
static const std::string& name()
{
static const std::string s{"com.lomiri.remote.Service.Provider"};
return s;
}
// Checks if a provider satisfies a set of accuracy criteria.
DBUS_CPP_METHOD_DEF(MatchesCriteria, remote::Interface)
// Checks if the provider has got a specific requirement.
DBUS_CPP_METHOD_DEF(Requires, remote::Interface)
// Checks if the provider supports a specific feature.
DBUS_CPP_METHOD_DEF(Supports, remote::Interface)
// Called by the engine whenever the wifi and cell ID reporting state changes.
DBUS_CPP_METHOD_DEF(OnWifiAndCellIdReportingStateChanged, remote::Interface)
// Called by the engine whenever the reference location changed.
DBUS_CPP_METHOD_DEF(OnReferenceLocationChanged, remote::Interface)
// Called by the engine whenever the reference heading changed.
DBUS_CPP_METHOD_DEF(OnReferenceHeadingChanged, remote::Interface)
// Called by the engine whenever the reference velocity changed.
DBUS_CPP_METHOD_DEF(OnReferenceVelocityChanged, remote::Interface)
DBUS_CPP_METHOD_DEF(StartPositionUpdates, remote::Interface)
DBUS_CPP_METHOD_DEF(StopPositionUpdates, remote::Interface)
DBUS_CPP_METHOD_DEF(StartHeadingUpdates, remote::Interface)
DBUS_CPP_METHOD_DEF(StopHeadingUpdates, remote::Interface)
DBUS_CPP_METHOD_DEF(StartVelocityUpdates, remote::Interface)
DBUS_CPP_METHOD_DEF(StopVelocityUpdates, remote::Interface)
struct Signals
{
DBUS_CPP_SIGNAL_DEF(PositionChanged, remote::Interface, com::lomiri::location::Position)
DBUS_CPP_SIGNAL_DEF(HeadingChanged, remote::Interface, com::lomiri::location::Heading)
DBUS_CPP_SIGNAL_DEF(VelocityChanged, remote::Interface, com::lomiri::location::Velocity)
};
struct Properties
{
DBUS_CPP_READABLE_PROPERTY_DEF(HasPosition, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(HasVelocity, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(HasHeading, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(RequiresSatellites, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(RequiresCellNetwork, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(RequiresDataNetwork, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(RequiresMonetarySpending, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(ArePositionUpdatesRunning, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(AreHeadingUpdatesRunning, remote::Interface, bool)
DBUS_CPP_READABLE_PROPERTY_DEF(AreVelocityUpdatesRunning, remote::Interface, bool)
};
struct Skeleton
{
// Creates a new skeleton instance and installs the interface
// com::lomiri::remote::Interface on it.
Skeleton(const core::dbus::Object::Ptr& object)
: object{object},
properties
{
object->get_property<Properties::HasPosition>(),
object->get_property<Properties::HasVelocity>(),
object->get_property<Properties::HasHeading>(),
object->get_property<Properties::RequiresSatellites>(),
object->get_property<Properties::RequiresCellNetwork>(),
object->get_property<Properties::RequiresDataNetwork>(),
object->get_property<Properties::RequiresMonetarySpending>(),
object->get_property<Properties::ArePositionUpdatesRunning>(),
object->get_property<Properties::AreHeadingUpdatesRunning>(),
object->get_property<Properties::AreVelocityUpdatesRunning>()
},
signals
{
object->get_signal<Signals::PositionChanged>(),
object->get_signal<Signals::HeadingChanged>(),
object->get_signal<Signals::VelocityChanged>()
}
{
}
// The object that the interface is installed on.
core::dbus::Object::Ptr object;
// All known properties.
struct
{
std::shared_ptr<core::dbus::Property<Properties::HasPosition>> has_position;
std::shared_ptr<core::dbus::Property<Properties::HasVelocity>> has_velocity;
std::shared_ptr<core::dbus::Property<Properties::HasHeading>> has_heading;
std::shared_ptr<core::dbus::Property<Properties::RequiresSatellites>> requires_satellites;
std::shared_ptr<core::dbus::Property<Properties::RequiresCellNetwork>> requires_cell_network;
std::shared_ptr<core::dbus::Property<Properties::RequiresDataNetwork>> requires_data_network;
std::shared_ptr<core::dbus::Property<Properties::RequiresMonetarySpending>> requires_monetary_spending;
std::shared_ptr<core::dbus::Property<Properties::ArePositionUpdatesRunning>> are_position_updates_running;
std::shared_ptr<core::dbus::Property<Properties::AreHeadingUpdatesRunning>> are_heading_updates_running;
std::shared_ptr<core::dbus::Property<Properties::AreVelocityUpdatesRunning>> are_velocity_updates_running;
} properties;
// All known signals.
struct
{
std::shared_ptr<core::dbus::Signal<
Signals::PositionChanged,
Signals::PositionChanged::ArgumentType
>> position_changed;
std::shared_ptr<core::dbus::Signal<
Signals::HeadingChanged,
Signals::HeadingChanged::ArgumentType
>> heading_changed;
std::shared_ptr<core::dbus::Signal<
Signals::VelocityChanged,
Signals::VelocityChanged::ArgumentType
>> velocity_changed;
} signals;
};
struct Stub
{
// Creates a new skeleton instance and installs the interface
// com::lomiri::remote::Interface on it.
Stub(const core::dbus::Object::Ptr& object)
: object{object},
properties
{
object->get_property<Properties::HasPosition>(),
object->get_property<Properties::HasVelocity>(),
object->get_property<Properties::HasHeading>(),
object->get_property<Properties::RequiresSatellites>(),
object->get_property<Properties::RequiresCellNetwork>(),
object->get_property<Properties::RequiresDataNetwork>(),
object->get_property<Properties::RequiresMonetarySpending>(),
object->get_property<Properties::ArePositionUpdatesRunning>(),
object->get_property<Properties::AreHeadingUpdatesRunning>(),
object->get_property<Properties::AreVelocityUpdatesRunning>()
},
signals
{
object->get_signal<Signals::PositionChanged>(),
object->get_signal<Signals::HeadingChanged>(),
object->get_signal<Signals::VelocityChanged>()
}
{
}
// The object that the interface is installed on.
core::dbus::Object::Ptr object;
// All known properties.
struct
{
std::shared_ptr<core::dbus::Property<Properties::HasPosition>> has_position;
std::shared_ptr<core::dbus::Property<Properties::HasVelocity>> has_velocity;
std::shared_ptr<core::dbus::Property<Properties::HasHeading>> has_heading;
std::shared_ptr<core::dbus::Property<Properties::RequiresSatellites>> requires_satellites;
std::shared_ptr<core::dbus::Property<Properties::RequiresCellNetwork>> requires_cell_network;
std::shared_ptr<core::dbus::Property<Properties::RequiresDataNetwork>> requires_data_network;
std::shared_ptr<core::dbus::Property<Properties::RequiresMonetarySpending>> requires_monetary_spending;
std::shared_ptr<core::dbus::Property<Properties::ArePositionUpdatesRunning>> are_position_updates_running;
std::shared_ptr<core::dbus::Property<Properties::AreHeadingUpdatesRunning>> are_heading_updates_running;
std::shared_ptr<core::dbus::Property<Properties::AreVelocityUpdatesRunning>> are_velocity_updates_running;
} properties;
// All known signals.
struct
{
std::shared_ptr<core::dbus::Signal<
Signals::PositionChanged,
Signals::PositionChanged::ArgumentType
>> position_changed;
std::shared_ptr<core::dbus::Signal<
Signals::HeadingChanged,
Signals::HeadingChanged::ArgumentType
>> heading_changed;
std::shared_ptr<core::dbus::Signal<
Signals::VelocityChanged,
Signals::VelocityChanged::ArgumentType
>> velocity_changed;
} signals;
};
};
}
}
}
}
}
#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_PROVIDERS_REMOTE_INTERFACE_H_
codec.h
heading.h
com::lomiri::location::providers::remote
Definition providers/remote/interface.h:45
com::lomiri::location::providers
Definition providers/remote/interface.h:43
com::lomiri::location
Definition accuracy.h:28
com::lomiri::location::Heading
units::Quantity< units::PlaneAngle > Heading
Definition heading.h:30
com::lomiri::location::Velocity
units::Quantity< units::Velocity > Velocity
Velocity is measured in m/s.
Definition velocity.h:30
com::lomiri
Definition accuracy.h:26
com
Definition accuracy.h:24
position.h
com::lomiri::location::Position
The Position struct models a position in the wgs84 coordinate system.
Definition position.h:40
com::lomiri::location::providers::remote::Interface::Properties
Definition providers/remote/interface.h:84
com::lomiri::location::providers::remote::Interface::Signals
Definition providers/remote/interface.h:77
com::lomiri::location::providers::remote::Interface::Skeleton::object
core::dbus::Object::Ptr object
Definition providers/remote/interface.h:126
com::lomiri::location::providers::remote::Interface::Skeleton::has_velocity
std::shared_ptr< core::dbus::Property< Properties::HasVelocity > > has_velocity
Definition providers/remote/interface.h:131
com::lomiri::location::providers::remote::Interface::Skeleton::position_changed
std::shared_ptr< core::dbus::Signal< Signals::PositionChanged, Signals::PositionChanged::ArgumentType > > position_changed
Definition providers/remote/interface.h:147
com::lomiri::location::providers::remote::Interface::Skeleton::signals
struct com::lomiri::location::providers::remote::Interface::Skeleton::@247360000211017141200227337170217214153173227274 signals
com::lomiri::location::providers::remote::Interface::Skeleton::requires_cell_network
std::shared_ptr< core::dbus::Property< Properties::RequiresCellNetwork > > requires_cell_network
Definition providers/remote/interface.h:134
com::lomiri::location::providers::remote::Interface::Skeleton::are_position_updates_running
std::shared_ptr< core::dbus::Property< Properties::ArePositionUpdatesRunning > > are_position_updates_running
Definition providers/remote/interface.h:137
com::lomiri::location::providers::remote::Interface::Skeleton::heading_changed
std::shared_ptr< core::dbus::Signal< Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType > > heading_changed
Definition providers/remote/interface.h:152
com::lomiri::location::providers::remote::Interface::Skeleton::requires_monetary_spending
std::shared_ptr< core::dbus::Property< Properties::RequiresMonetarySpending > > requires_monetary_spending
Definition providers/remote/interface.h:136
com::lomiri::location::providers::remote::Interface::Skeleton::are_velocity_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreVelocityUpdatesRunning > > are_velocity_updates_running
Definition providers/remote/interface.h:139
com::lomiri::location::providers::remote::Interface::Skeleton::requires_data_network
std::shared_ptr< core::dbus::Property< Properties::RequiresDataNetwork > > requires_data_network
Definition providers/remote/interface.h:135
com::lomiri::location::providers::remote::Interface::Skeleton::properties
struct com::lomiri::location::providers::remote::Interface::Skeleton::@333210277221367021020356323356126005173204067022 properties
com::lomiri::location::providers::remote::Interface::Skeleton::velocity_changed
std::shared_ptr< core::dbus::Signal< Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType > > velocity_changed
Definition providers/remote/interface.h:157
com::lomiri::location::providers::remote::Interface::Skeleton::are_heading_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreHeadingUpdatesRunning > > are_heading_updates_running
Definition providers/remote/interface.h:138
com::lomiri::location::providers::remote::Interface::Skeleton::has_position
std::shared_ptr< core::dbus::Property< Properties::HasPosition > > has_position
Definition providers/remote/interface.h:130
com::lomiri::location::providers::remote::Interface::Skeleton::requires_satellites
std::shared_ptr< core::dbus::Property< Properties::RequiresSatellites > > requires_satellites
Definition providers/remote/interface.h:133
com::lomiri::location::providers::remote::Interface::Skeleton::has_heading
std::shared_ptr< core::dbus::Property< Properties::HasHeading > > has_heading
Definition providers/remote/interface.h:132
com::lomiri::location::providers::remote::Interface::Skeleton::Skeleton
Skeleton(const core::dbus::Object::Ptr &object)
Definition providers/remote/interface.h:101
com::lomiri::location::providers::remote::Interface::Stub::requires_data_network
std::shared_ptr< core::dbus::Property< Properties::RequiresDataNetwork > > requires_data_network
Definition providers/remote/interface.h:199
com::lomiri::location::providers::remote::Interface::Stub::has_velocity
std::shared_ptr< core::dbus::Property< Properties::HasVelocity > > has_velocity
Definition providers/remote/interface.h:195
com::lomiri::location::providers::remote::Interface::Stub::requires_monetary_spending
std::shared_ptr< core::dbus::Property< Properties::RequiresMonetarySpending > > requires_monetary_spending
Definition providers/remote/interface.h:200
com::lomiri::location::providers::remote::Interface::Stub::heading_changed
std::shared_ptr< core::dbus::Signal< Signals::HeadingChanged, Signals::HeadingChanged::ArgumentType > > heading_changed
Definition providers/remote/interface.h:216
com::lomiri::location::providers::remote::Interface::Stub::signals
struct com::lomiri::location::providers::remote::Interface::Stub::@023010264150265140062261326020012256175260302045 signals
com::lomiri::location::providers::remote::Interface::Stub::has_heading
std::shared_ptr< core::dbus::Property< Properties::HasHeading > > has_heading
Definition providers/remote/interface.h:196
com::lomiri::location::providers::remote::Interface::Stub::properties
struct com::lomiri::location::providers::remote::Interface::Stub::@346220065250227345021117127113242145266031173143 properties
com::lomiri::location::providers::remote::Interface::Stub::object
core::dbus::Object::Ptr object
Definition providers/remote/interface.h:190
com::lomiri::location::providers::remote::Interface::Stub::has_position
std::shared_ptr< core::dbus::Property< Properties::HasPosition > > has_position
Definition providers/remote/interface.h:194
com::lomiri::location::providers::remote::Interface::Stub::position_changed
std::shared_ptr< core::dbus::Signal< Signals::PositionChanged, Signals::PositionChanged::ArgumentType > > position_changed
Definition providers/remote/interface.h:211
com::lomiri::location::providers::remote::Interface::Stub::requires_satellites
std::shared_ptr< core::dbus::Property< Properties::RequiresSatellites > > requires_satellites
Definition providers/remote/interface.h:197
com::lomiri::location::providers::remote::Interface::Stub::are_heading_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreHeadingUpdatesRunning > > are_heading_updates_running
Definition providers/remote/interface.h:202
com::lomiri::location::providers::remote::Interface::Stub::Stub
Stub(const core::dbus::Object::Ptr &object)
Definition providers/remote/interface.h:165
com::lomiri::location::providers::remote::Interface::Stub::are_position_updates_running
std::shared_ptr< core::dbus::Property< Properties::ArePositionUpdatesRunning > > are_position_updates_running
Definition providers/remote/interface.h:201
com::lomiri::location::providers::remote::Interface::Stub::requires_cell_network
std::shared_ptr< core::dbus::Property< Properties::RequiresCellNetwork > > requires_cell_network
Definition providers/remote/interface.h:198
com::lomiri::location::providers::remote::Interface::Stub::are_velocity_updates_running
std::shared_ptr< core::dbus::Property< Properties::AreVelocityUpdatesRunning > > are_velocity_updates_running
Definition providers/remote/interface.h:203
com::lomiri::location::providers::remote::Interface::Stub::velocity_changed
std::shared_ptr< core::dbus::Signal< Signals::VelocityChanged, Signals::VelocityChanged::ArgumentType > > velocity_changed
Definition providers/remote/interface.h:221
com::lomiri::location::providers::remote::Interface
Definition providers/remote/interface.h:47
com::lomiri::location::providers::remote::Interface::name
static const std::string & name()
Definition providers/remote/interface.h:48
update.h
velocity.h