~thomas-voss/location-service/introduce-locationd

« back to all changes in this revision

Viewing changes to src/location/dbus/skeleton/service.cpp

  • Committer: Thomas Voß
  • Date: 2016-06-30 09:13:21 UTC
  • Revision ID: thomas.voss@canonical.com-20160630091321-knaomq5ktqdtztsq
Introduce locationd, featuring the following cmds:
 - list: list all known provider implementations
 - provider: run a known provider implementation out of process.
 - run: execute locationd.
 - status: query the status of a locationd instance.
 - test: execute runtime tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
{
43
43
}
44
44
 
45
 
location::service::Credentials
 
45
location::Credentials
46
46
location::dbus::skeleton::Service::DBusDaemonCredentialsResolver::resolve_credentials_for_incoming_message(const core::dbus::Message::Ptr& msg)
47
47
{
48
 
    return location::service::Credentials
 
48
    return location::Credentials
49
49
    {
50
50
        static_cast<pid_t>(daemon.get_connection_unix_process_id(msg->sender())),
51
51
        static_cast<uid_t>(daemon.get_connection_unix_user(msg->sender()))
52
52
    };
53
53
}
54
54
 
55
 
core::dbus::types::ObjectPath location::dbus::skeleton::Service::ObjectPathGenerator::object_path_for_caller_credentials(const location::service::Credentials&)
 
55
core::dbus::types::ObjectPath location::dbus::skeleton::Service::ObjectPathGenerator::object_path_for_caller_credentials(const location::Credentials&)
56
56
{
57
57
    static std::uint32_t index{0};
58
58
    std::stringstream ss; ss << "/sessions/" << index++;
76
76
      },
77
77
      connections
78
78
      {
79
 
          properties.state->changed().connect([this](State state)
80
 
          {
81
 
              on_state_changed(state);
82
 
          }),
83
 
          properties.does_satellite_based_positioning->changed().connect([this](bool value)
84
 
          {
85
 
              on_does_satellite_based_positioning_changed(value);
86
 
          }),
87
 
          properties.does_report_cell_and_wifi_ids->changed().connect([this](bool value)
88
 
          {
89
 
              on_does_report_cell_and_wifi_ids_changed(value);
90
 
          }),
91
 
          properties.is_online->changed().connect([this](bool value)
92
 
          {
93
 
              on_is_online_changed(value);
94
 
          })
 
79
          {
 
80
              properties.state->changed().connect([this](State state)
 
81
              {
 
82
                  on_state_changed(state);
 
83
              }),
 
84
              properties.does_satellite_based_positioning->changed().connect([this](bool value) mutable
 
85
              {
 
86
                  on_does_satellite_based_positioning_changed(value); Service::configuration.impl->does_satellite_based_positioning() = value;
 
87
              }),
 
88
              properties.does_report_cell_and_wifi_ids->changed().connect([this](bool value) mutable
 
89
              {
 
90
                  on_does_report_cell_and_wifi_ids_changed(value); Service::configuration.impl->does_report_cell_and_wifi_ids() = value;
 
91
              }),
 
92
              properties.is_online->changed().connect([this](bool value) mutable
 
93
              {
 
94
                  on_is_online_changed(value); Service::configuration.impl->is_online() = value;
 
95
              })
 
96
          },
 
97
          {
 
98
              Service::configuration.impl->state().changed().connect([this](State state) mutable
 
99
              {
 
100
                  properties.state->set(state);
 
101
              }),
 
102
              Service::configuration.impl->does_satellite_based_positioning().changed().connect([this](bool value) mutable
 
103
              {
 
104
                  properties.does_satellite_based_positioning->set(value);
 
105
              }),
 
106
              Service::configuration.impl->does_report_cell_and_wifi_ids().changed().connect([this](bool value) mutable
 
107
              {
 
108
                  properties.does_report_cell_and_wifi_ids->set(value);
 
109
              }),
 
110
              Service::configuration.impl->is_online().changed().connect([this](bool value) mutable
 
111
              {
 
112
                  properties.is_online->set(value);
 
113
              })
 
114
          }
95
115
      }
96
116
{
97
117
    object->install_method_handler<location::dbus::Service::CreateSessionForCriteria>([this](const core::dbus::Message::Ptr& msg)
129
149
        auto result =
130
150
            configuration.permission_manager->check_permission_for_credentials(criteria, credentials);
131
151
 
132
 
        if (service::PermissionManager::Result::rejected == result) throw std::runtime_error
 
152
        if (PermissionManager::Result::rejected == result) throw std::runtime_error
133
153
        {
134
154
            "Client lacks permissions to access the service with the given criteria"
135
155
        };
306
326
{
307
327
    return *properties.visible_space_vehicles;
308
328
}
 
329
 
 
330
location::Service::Session::Ptr location::dbus::skeleton::Service::create_session_for_criteria(const Criteria& criteria)
 
331
{
 
332
    return configuration.impl->create_session_for_criteria(criteria);
 
333
}