Merge lp:~thomas-voss/location-service/ubx-provider-configuration into lp:location-service

Proposed by Thomas Voß
Status: Merged
Approved by: Thomas Voß
Approved revision: 287
Merged at revision: 287
Proposed branch: lp:~thomas-voss/location-service/ubx-provider-configuration
Merge into: lp:location-service
Diff against target: 58 lines (+19/-1)
3 files modified
prebuilt/meta/hooks/configure (+6/-0)
snapcraft.yaml (+3/-0)
src/location/providers/ubx/provider.cpp (+10/-1)
To merge this branch: bzr merge lp:~thomas-voss/location-service/ubx-provider-configuration
Reviewer Review Type Date Requested Status
Thomas Voß Approve
Simon Fels (community) Approve
Review via email: mp+314209@code.launchpad.net

Commit message

Support configuration of ubx::Provider via snap set location ubx::provider::path=.

Description of the change

Support configuration of ubx::Provider via snap set location ubx::provider::path=.

To post a comment you must log in.
Revision history for this message
Simon Fels (morphis) wrote :

LGTM

review: Approve
Revision history for this message
Thomas Voß (thomas-voss) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'prebuilt'
=== added directory 'prebuilt/meta'
=== added directory 'prebuilt/meta/hooks'
=== added file 'prebuilt/meta/hooks/configure'
--- prebuilt/meta/hooks/configure 1970-01-01 00:00:00 +0000
+++ prebuilt/meta/hooks/configure 2017-01-06 09:53:58 +0000
@@ -0,0 +1,6 @@
1#!/bin/sh
2
3if path=$(snapctl get ubx::provider::path); then
4 mkdir -p $SNAP_DATA/ubx/provider
5 echo "$path" > $SNAP_DATA/ubx/provider/path
6fi
07
=== modified file 'snapcraft.yaml'
--- snapcraft.yaml 2016-12-09 10:49:29 +0000
+++ snapcraft.yaml 2017-01-06 09:53:58 +0000
@@ -42,6 +42,9 @@
42 interface: serial-port42 interface: serial-port
4343
44parts:44parts:
45 hooks:
46 plugin: dump
47 source: prebuilt
45 location-service:48 location-service:
46 plugin: cmake49 plugin: cmake
47 configflags:50 configflags:
4851
=== modified file 'src/location/providers/ubx/provider.cpp'
--- src/location/providers/ubx/provider.cpp 2016-12-12 13:01:34 +0000
+++ src/location/providers/ubx/provider.cpp 2017-01-06 09:53:58 +0000
@@ -21,8 +21,12 @@
21#include <location/logging.h>21#include <location/logging.h>
22#include <location/runtime.h>22#include <location/runtime.h>
2323
24#include <core/posix/this_process.h>
25
26#include <fstream>
24#include <thread>27#include <thread>
2528
29namespace env = core::posix::this_process::env;
26namespace ubx = location::providers::ubx;30namespace ubx = location::providers::ubx;
2731
28std::string ubx::Provider::class_name()32std::string ubx::Provider::class_name()
@@ -100,7 +104,12 @@
100104
101location::Provider::Ptr ubx::Provider::create_instance(const location::ProviderFactory::Configuration& config)105location::Provider::Ptr ubx::Provider::create_instance(const location::ProviderFactory::Configuration& config)
102{106{
103 return location::Provider::Ptr{new ubx::Provider{config.get<std::string>("device", "/dev/ttyS4")}};107 std::string device_path;
108 std::ifstream in(env::get("SNAP_DATA") + "/ubx/provider/path");
109
110 in >> device_path;
111
112 return location::Provider::Ptr{new ubx::Provider{config.get<std::string>("device", device_path.empty() ? "/dev/ttyS4" : device_path)}};
104}113}
105114
106ubx::Provider::Provider(const boost::filesystem::path& device)115ubx::Provider::Provider(const boost::filesystem::path& device)

Subscribers

People subscribed via source and target branches

to all changes: