From 2ffcc61a750a2bf4598662b4612283fdc9d2a4e4 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Thu, 14 Sep 2017 12:14:59 +0200 Subject: Add automatic advertisement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Bollo --- CMakeLists.txt | 2 ++ agl-identity-agent.service.in | 1 + btle-advise.service | 8 ++++++++ btle-advise.timer | 6 ++++++ 4 files changed, 17 insertions(+) create mode 100644 btle-advise.service create mode 100644 btle-advise.timer diff --git a/CMakeLists.txt b/CMakeLists.txt index d0d3989..d9d7bd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,8 @@ configure_file(agl-identity-agent.service.in agl-identity-agent.service @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/agl-identity-agent.service + ${CMAKE_CURRENT_SOURCE_DIR}/btle-advise.service + ${CMAKE_CURRENT_SOURCE_DIR}/btle-advise.timer DESTINATION ${PROJECT_DESTINATION} ) diff --git a/agl-identity-agent.service.in b/agl-identity-agent.service.in index 6fc779b..5381946 100644 --- a/agl-identity-agent.service.in +++ b/agl-identity-agent.service.in @@ -1,5 +1,6 @@ [Unit] Description=AGL identity agent +Requires=btle-advise.service [Service] User=root diff --git a/btle-advise.service b/btle-advise.service new file mode 100644 index 0000000..1a34237 --- /dev/null +++ b/btle-advise.service @@ -0,0 +1,8 @@ +[Unit] +Description=activates advertising of BlueTooth Low-Energy on hci0 + +[Service] +Type=oneshot +ExecStart=/bin/bash -c "rfkill list|sed '/[bB]luetooth/!d;s/:.*//'|xargs -n1 rfkill unblock" +ExecStart=/bin/bash -c "hcitool dev|tail -n+2|cut -f2|xargs -n1 -IX hciconfig X leadv" + diff --git a/btle-advise.timer b/btle-advise.timer new file mode 100644 index 0000000..b02594c --- /dev/null +++ b/btle-advise.timer @@ -0,0 +1,6 @@ +[Unit] +Description=Ensure BLE advise is up + +[Timer] +AccuracySec=1min +OnUnitActiveSec=1min -- cgit 1.2.3-korg