service/interface.h
Go to the documentation of this file.
/*
* Copyright © 2012-2013 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: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_INTERFACE_H_
#define LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_INTERFACE_H_
#include <com/lomiri/location/service/state.h>
#include <com/lomiri/location/service/session/interface.h>
#include <com/lomiri/location/space_vehicle.h>
#include <core/dbus/service.h>
#include <core/dbus/traits/service.h>
#include <core/dbus/types/object_path.h>
#include <core/dbus/types/stl/vector.h>
#include <chrono>
#include <functional>
namespace dbus = core::dbus;
namespace com
{
namespace lomiri
{
namespace location
{
struct Criteria;
namespace service
{
class Interface
{
protected:
struct Errors
{
struct InsufficientPermissions
{
inline static std::string name()
{
return "com.lomiri.location.Service.Error.InsufficientPermissions";
}
};
struct CreatingSession
{
inline static std::string name()
{
return "com.lomiri.location.Service.Error.CreatingSession";
}
};
};
struct CreateSessionForCriteria
{
typedef com::lomiri::location::service::Interface Interface;
inline static const std::string& name()
{
static const std::string s
{
"CreateSessionForCriteria"
};
return s;
}
typedef dbus::types::ObjectPath ResultType;
inline static const std::chrono::milliseconds default_timeout()
{
return std::chrono::seconds{25};
}
};
struct Properties
{
struct State
{
inline static const std::string& name()
{
static const std::string s
{
"State"
};
return s;
}
typedef com::lomiri::location::service::Interface Interface;
typedef com::lomiri::location::service::State ValueType;
static const bool readable = true;
static const bool writable = true;
};
struct DoesSatelliteBasedPositioning
{
inline static const std::string& name()
{
static const std::string s
{
"DoesSatelliteBasedPositioning"
};
return s;
}
typedef com::lomiri::location::service::Interface Interface;
typedef bool ValueType;
static const bool readable = true;
static const bool writable = true;
};
struct DoesReportCellAndWifiIds
{
inline static const std::string& name()
{
static const std::string s
{
"DoesReportCellAndWifiIds"
};
return s;
}
typedef com::lomiri::location::service::Interface Interface;
typedef bool ValueType;
static const bool readable = true;
static const bool writable = true;
};
struct IsOnline
{
inline static const std::string& name()
{
static const std::string s
{
"IsOnline"
};
return s;
}
typedef com::lomiri::location::service::Interface Interface;
typedef bool ValueType;
static const bool readable = true;
static const bool writable = true;
};
struct VisibleSpaceVehicles
{
inline static const std::string& name()
{
static const std::string s
{
"VisibleSpaceVehicles"
};
return s;
}
typedef com::lomiri::location::service::Interface Interface;
typedef std::map<com::lomiri::location::SpaceVehicle::Key, com::lomiri::location::SpaceVehicle> ValueType;
static const bool readable = true;
static const bool writable = false;
};
struct ClientApplications
{
inline static const std::string& name()
{
static const std::string s
{
"ClientApplications"
};
return s;
}
typedef com::lomiri::location::service::Interface Interface;
typedef std::vector<std::string> ValueType;
static const bool readable = true;
static const bool writable = false;
};
};
Interface() = default;
public:
typedef std::shared_ptr<Interface> Ptr;
inline static const std::string& path()
{
static const std::string s{"/com/lomiri/location/Service"};
return s;
}
Interface(const Interface&) = delete;
Interface& operator=(const Interface&) = delete;
virtual ~Interface() = default;
virtual const core::Property<State>& state() const = 0;
virtual core::Property<bool>& does_satellite_based_positioning() = 0;
virtual core::Property<bool>& is_online() = 0;
virtual core::Property<bool>& does_report_cell_and_wifi_ids() = 0;
virtual core::Property<std::map<SpaceVehicle::Key, SpaceVehicle>>& visible_space_vehicles() = 0;
virtual session::Interface::Ptr create_session_for_criteria(const Criteria& criteria) = 0;
virtual core::Property<std::vector<std::string>>& client_applications() = 0;
};
}
}
}
}
namespace core
{
namespace dbus
{
namespace traits
{
template<>
struct Service<com::lomiri::location::service::Interface>
{
static const std::string& interface_name()
{
static const std::string s
{
"com.lomiri.location.Service"
};
return s;
}
};
}
}
}
#include <com/lomiri/location/codec.h>
#endif // LOCATION_SERVICE_COM_LOMIRI_LOCATION_SERVICE_INTERFACE_H_
com::lomiri::location::service::Interface
The Interface class models the primary interface to the location service.
Definition service/interface.h:49
com::lomiri::location::service::Interface::Interface
Interface(const Interface &)=delete
com::lomiri::location::service::Interface::state
virtual const core::Property< State > & state() const =0
The overall state of the service.
com::lomiri::location::service::Interface::operator=
Interface & operator=(const Interface &)=delete
com::lomiri::location::service::Interface::visible_space_vehicles
virtual core::Property< std::map< SpaceVehicle::Key, SpaceVehicle > > & visible_space_vehicles()=0
All space vehicles currently visible.
com::lomiri::location::service::Interface::Interface
Interface()=default
com::lomiri::location::service::Interface::~Interface
virtual ~Interface()=default
com::lomiri::location::service::Interface::does_satellite_based_positioning
virtual core::Property< bool > & does_satellite_based_positioning()=0
Whether the service uses satellite-based positioning.
com::lomiri::location::service::Interface::path
static const std::string & path()
Queries the path that this object is known under.
Definition service/interface.h:204
com::lomiri::location::service::Interface::client_applications
virtual core::Property< std::vector< std::string > > & client_applications()=0
List of application IDs currently requesting position information.
com::lomiri::location::service::Interface::does_report_cell_and_wifi_ids
virtual core::Property< bool > & does_report_cell_and_wifi_ids()=0
Whether the engine and its providers/reporters do call home to report reference locations together wi...
com::lomiri::location::service::Interface::Ptr
std::shared_ptr< Interface > Ptr
Definition service/interface.h:199
com::lomiri::location::service::Interface::create_session_for_criteria
virtual session::Interface::Ptr create_session_for_criteria(const Criteria &criteria)=0
Starts a new session for the given criteria.
com::lomiri::location::service::Interface::is_online
virtual core::Property< bool > & is_online()=0
Whether the overall service and its positioning engine is online or not.
com::lomiri::location::service::session::Interface::Ptr
std::shared_ptr< Interface > Ptr
Definition service/session/interface.h:105
codec.h
com::lomiri::location::service
Definition service/configuration.h:36
com::lomiri::location::service::State
State
State enumerates the known states of the service.
Definition state.h:27
com::lomiri::location
Definition accuracy.h:28
com::lomiri
Definition accuracy.h:26
com
Definition accuracy.h:24
core::dbus::traits
Definition service/interface.h:272
core::dbus
Definition codec.h:41
core
Definition codec.h:39
interface.h
space_vehicle.h
state.h
com::lomiri::location::Criteria
Summarizes criteria of a client session with respect to functionality and accuracy for position,...
Definition criteria.h:35
com::lomiri::location::service::Interface::CreateSessionForCriteria
Definition service/interface.h:70
com::lomiri::location::service::Interface::CreateSessionForCriteria::name
static const std::string & name()
Definition service/interface.h:73
com::lomiri::location::service::Interface::CreateSessionForCriteria::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:71
com::lomiri::location::service::Interface::CreateSessionForCriteria::ResultType
dbus::types::ObjectPath ResultType
Definition service/interface.h:82
com::lomiri::location::service::Interface::CreateSessionForCriteria::default_timeout
static const std::chrono::milliseconds default_timeout()
Definition service/interface.h:84
com::lomiri::location::service::Interface::Errors::CreatingSession
Definition service/interface.h:61
com::lomiri::location::service::Interface::Errors::CreatingSession::name
static std::string name()
Definition service/interface.h:62
com::lomiri::location::service::Interface::Errors::InsufficientPermissions
Definition service/interface.h:54
com::lomiri::location::service::Interface::Errors::InsufficientPermissions::name
static std::string name()
Definition service/interface.h:55
com::lomiri::location::service::Interface::Errors
Definition service/interface.h:52
com::lomiri::location::service::Interface::Properties::ClientApplications
Definition service/interface.h:179
com::lomiri::location::service::Interface::Properties::ClientApplications::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:189
com::lomiri::location::service::Interface::Properties::ClientApplications::ValueType
std::vector< std::string > ValueType
Definition service/interface.h:190
com::lomiri::location::service::Interface::Properties::ClientApplications::name
static const std::string & name()
Definition service/interface.h:180
com::lomiri::location::service::Interface::Properties::ClientApplications::readable
static const bool readable
Definition service/interface.h:191
com::lomiri::location::service::Interface::Properties::ClientApplications::writable
static const bool writable
Definition service/interface.h:192
com::lomiri::location::service::Interface::Properties::DoesReportCellAndWifiIds
Definition service/interface.h:127
com::lomiri::location::service::Interface::Properties::DoesReportCellAndWifiIds::writable
static const bool writable
Definition service/interface.h:140
com::lomiri::location::service::Interface::Properties::DoesReportCellAndWifiIds::readable
static const bool readable
Definition service/interface.h:139
com::lomiri::location::service::Interface::Properties::DoesReportCellAndWifiIds::name
static const std::string & name()
Definition service/interface.h:128
com::lomiri::location::service::Interface::Properties::DoesReportCellAndWifiIds::ValueType
bool ValueType
Definition service/interface.h:138
com::lomiri::location::service::Interface::Properties::DoesReportCellAndWifiIds::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:137
com::lomiri::location::service::Interface::Properties::DoesSatelliteBasedPositioning
Definition service/interface.h:110
com::lomiri::location::service::Interface::Properties::DoesSatelliteBasedPositioning::name
static const std::string & name()
Definition service/interface.h:111
com::lomiri::location::service::Interface::Properties::DoesSatelliteBasedPositioning::ValueType
bool ValueType
Definition service/interface.h:121
com::lomiri::location::service::Interface::Properties::DoesSatelliteBasedPositioning::readable
static const bool readable
Definition service/interface.h:122
com::lomiri::location::service::Interface::Properties::DoesSatelliteBasedPositioning::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:120
com::lomiri::location::service::Interface::Properties::DoesSatelliteBasedPositioning::writable
static const bool writable
Definition service/interface.h:123
com::lomiri::location::service::Interface::Properties::IsOnline
Definition service/interface.h:144
com::lomiri::location::service::Interface::Properties::IsOnline::readable
static const bool readable
Definition service/interface.h:156
com::lomiri::location::service::Interface::Properties::IsOnline::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:154
com::lomiri::location::service::Interface::Properties::IsOnline::ValueType
bool ValueType
Definition service/interface.h:155
com::lomiri::location::service::Interface::Properties::IsOnline::name
static const std::string & name()
Definition service/interface.h:145
com::lomiri::location::service::Interface::Properties::IsOnline::writable
static const bool writable
Definition service/interface.h:157
com::lomiri::location::service::Interface::Properties::State
Definition service/interface.h:93
com::lomiri::location::service::Interface::Properties::State::name
static const std::string & name()
Definition service/interface.h:94
com::lomiri::location::service::Interface::Properties::State::ValueType
com::lomiri::location::service::State ValueType
Definition service/interface.h:104
com::lomiri::location::service::Interface::Properties::State::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:103
com::lomiri::location::service::Interface::Properties::State::readable
static const bool readable
Definition service/interface.h:105
com::lomiri::location::service::Interface::Properties::State::writable
static const bool writable
Definition service/interface.h:106
com::lomiri::location::service::Interface::Properties::VisibleSpaceVehicles
Definition service/interface.h:161
com::lomiri::location::service::Interface::Properties::VisibleSpaceVehicles::ValueType
std::map< com::lomiri::location::SpaceVehicle::Key, com::lomiri::location::SpaceVehicle > ValueType
Definition service/interface.h:172
com::lomiri::location::service::Interface::Properties::VisibleSpaceVehicles::readable
static const bool readable
Definition service/interface.h:174
com::lomiri::location::service::Interface::Properties::VisibleSpaceVehicles::writable
static const bool writable
Definition service/interface.h:175
com::lomiri::location::service::Interface::Properties::VisibleSpaceVehicles::Interface
com::lomiri::location::service::Interface Interface
Definition service/interface.h:171
com::lomiri::location::service::Interface::Properties::VisibleSpaceVehicles::name
static const std::string & name()
Definition service/interface.h:162
com::lomiri::location::service::Interface::Properties
Definition service/interface.h:91
core::dbus::traits::Service< com::lomiri::location::service::Interface >::interface_name
static const std::string & interface_name()
Definition service/interface.h:276