aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-09-14 12:14:59 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-09-14 12:14:59 +0200
commit2ffcc61a750a2bf4598662b4612283fdc9d2a4e4 (patch)
treea729627f5474a4f5c84f3c7bf08bad6f71e44a73
parent0bbf447e05691d6d14bae65bdbcfaef3c668bb1a (diff)
Add automatic advertisement
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--CMakeLists.txt2
-rw-r--r--agl-identity-agent.service.in1
-rw-r--r--btle-advise.service8
-rw-r--r--btle-advise.timer6
4 files changed, 17 insertions, 0 deletions
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