summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-10-31 10:50:24 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-10-31 10:50:24 +0100
commit2ca7f3a4a03db3e7d7fa15504fa3d69e1c6bd217 (patch)
tree7dc6ff7e6efab4eeca79681efb672ed07061a545
parent2ffcc61a750a2bf4598662b4612283fdc9d2a4e4 (diff)
Split in two: agl-identity-service and uds-ble-id-init-service
The binding is splitted in two parts and packeged as widgets. The two parts are: - uds-ble-id-init-service This service provides a UDS (User Data Service) over BLE. It detects writes to the email of the user to initiate the authentication process. - agl-identity-service This service queries the Forgerock's Edge Controller to fill user data and make it available. The actual code is not fully functionnal. Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules3
-rw-r--r--agl-identity-service/CMakeLists.txt21
-rw-r--r--agl-identity-service/conf.d/cmake/config.cmake202
-rw-r--r--agl-identity-service/conf.d/wgt/config.xml.in19
-rw-r--r--agl-identity-service/src/CMakeLists.txt (renamed from binding/CMakeLists.txt)35
-rw-r--r--agl-identity-service/src/agl-identity-binding.c (renamed from binding/agl-identity-binding.c)75
-rw-r--r--agl-identity-service/src/aia-get.c (renamed from binding/aia-get.c)0
-rw-r--r--agl-identity-service/src/aia-get.h (renamed from binding/aia-get.h)0
-rw-r--r--agl-identity-service/src/authorization.c (renamed from binding/authorization.c)0
-rw-r--r--agl-identity-service/src/authorization.h (renamed from binding/authorization.h)0
-rw-r--r--agl-identity-service/src/base64.c (renamed from binding/base64.c)0
-rw-r--r--agl-identity-service/src/base64.h (renamed from binding/base64.h)0
-rw-r--r--agl-identity-service/src/config.json (renamed from binding/config.json)0
-rw-r--r--agl-identity-service/src/curl-wrap.c (renamed from binding/curl-wrap.c)0
-rw-r--r--agl-identity-service/src/curl-wrap.h (renamed from binding/curl-wrap.h)0
-rw-r--r--agl-identity-service/src/escape.c (renamed from binding/escape.c)0
-rw-r--r--agl-identity-service/src/escape.h (renamed from binding/escape.h)0
-rw-r--r--agl-identity-service/src/export.map (renamed from binding/export.map)0
-rw-r--r--agl-identity-service/src/memo.txt (renamed from binding/memo.txt)0
-rw-r--r--agl-identity-service/src/oidc-agent.c (renamed from binding/oidc-agent.c)0
-rw-r--r--agl-identity-service/src/oidc-agent.h (renamed from binding/oidc-agent.h)0
-rw-r--r--agl-identity-service/src/test-aia-uds-bluez.c (renamed from binding/test-aia-uds-bluez.c)0
m---------conf.d/app-templates0
-rw-r--r--uds-ble-id-init-service/CMakeLists.txt21
-rw-r--r--uds-ble-id-init-service/btle-advise.service (renamed from btle-advise.service)0
-rw-r--r--uds-ble-id-init-service/btle-advise.timer (renamed from btle-advise.timer)0
-rw-r--r--uds-ble-id-init-service/conf.d/cmake/config.cmake201
-rw-r--r--uds-ble-id-init-service/conf.d/wgt/config.xml.in19
-rw-r--r--uds-ble-id-init-service/src/CMakeLists.txt35
-rw-r--r--uds-ble-id-init-service/src/aia-uds-bluez.c (renamed from binding/aia-uds-bluez.c)0
-rw-r--r--uds-ble-id-init-service/src/aia-uds-bluez.h (renamed from binding/aia-uds-bluez.h)0
-rw-r--r--uds-ble-id-init-service/src/uds-ble-id-init-service.c146
33 files changed, 684 insertions, 95 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0ff8467
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+build/
+autobuild/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e07cae1
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "conf.d/app-templates"]
+ path = conf.d/app-templates
+ url = https://gerrit.automotivelinux.org/gerrit/p/apps/app-templates.git
diff --git a/agl-identity-service/CMakeLists.txt b/agl-identity-service/CMakeLists.txt
new file mode 100644
index 0000000..14b6d55
--- /dev/null
+++ b/agl-identity-service/CMakeLists.txt
@@ -0,0 +1,21 @@
+###########################################################################
+# Copyright 2017 IoT.bzh
+#
+# author: Jose Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+cmake_minimum_required(VERSION 3.6)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/)
+include(${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/config.cmake)
diff --git a/agl-identity-service/conf.d/cmake/config.cmake b/agl-identity-service/conf.d/cmake/config.cmake
new file mode 100644
index 0000000..434c410
--- /dev/null
+++ b/agl-identity-service/conf.d/cmake/config.cmake
@@ -0,0 +1,202 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Project Info
+# ------------------
+set(PROJECT_NAME agl-identity-service)
+set(PROJECT_VERSION "0.1")
+set(PROJECT_PRETTY_NAME "AGL identity service")
+set(PROJECT_DESCRIPTION "AGL identity service")
+set(PROJECT_URL "https://github.com/iotbzh/aia-binding")
+set(PROJECT_ICON "icon.png")
+set(PROJECT_AUTHOR "José Bollo")
+set(PROJECT_AUTHOR_MAIL "jose.bollo@iot.bzh")
+set(PROJECT_LICENSE "APL2.0")
+set(PROJECT_LANGUAGES,"C")
+
+# Where are stored default templates files from submodule or subtree app-templates in your project tree
+# relative to the root project directory
+set(PROJECT_APP_TEMPLATES_DIR "../conf.d/app-templates")
+
+# Where are stored your external libraries for your project. This is 3rd party library that you don't maintain
+# but used and must be built and linked.
+# set(PROJECT_LIBDIR "libs")
+
+# Where are stored data for your application. Pictures, static resources must be placed in that folder.
+# set(PROJECT_RESOURCES "data")
+
+# Which directories inspect to find CMakeLists.txt target files
+# set(PROJECT_SRC_DIR_PATTERN "*")
+
+# Compilation Mode (DEBUG, RELEASE)
+# ----------------------------------
+set(CMAKE_BUILD_TYPE "DEBUG")
+set(USE_EFENCE 1)
+
+# Kernel selection if needed. You can choose between a
+# mandatory version to impose a minimal version.
+# Or check Kernel minimal version and just print a Warning
+# about missing features and define a preprocessor variable
+# to be used as preprocessor condition in code to disable
+# incompatibles features. Preprocessor define is named
+# KERNEL_MINIMAL_VERSION_OK.
+#
+# NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and
+# Yocto SDK Kernel version.
+# -----------------------------------------------
+#set (kernel_mandatory_version 4.8)
+#set (kernel_minimal_version 4.8)
+
+# Compiler selection if needed. Impose a minimal version.
+# -----------------------------------------------
+set (gcc_minimal_version 4.9)
+
+# PKG_CONFIG required packages
+# -----------------------------
+set (PKG_REQUIRED_LIST
+ json-c
+ afb-daemon
+)
+
+# Prefix path where will be installed the files
+# Default: /usr/local (need root permission to write in)
+# ------------------------------------------------------
+#set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
+
+# Customize link option
+# -----------------------------
+#list(APPEND link_libraries -an-option)
+
+# Compilation options definition
+# Use CMake generator expressions to specify only for a specific language
+# Values are prefilled with default options that is currently used.
+# Either separate options with ";", or each options must be quoted separately
+# DO NOT PUT ALL OPTION QUOTED AT ONCE , COMPILATION COULD FAILED !
+# ----------------------------------------------------------------------------
+#set(COMPILE_OPTIONS
+# -Wall
+# -Wextra
+# -Wconversion
+# -Wno-unused-parameter
+# -Wno-sign-compare
+# -Wno-sign-conversion
+# -Werror=maybe-uninitialized
+# -Werror=implicit-function-declaration
+# -ffunction-sections
+# -fdata-sections
+# -fPIC
+# CACHE STRING "Compilation flags")
+#set(C_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C language.")
+#set(CXX_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C++ language.")
+#set(PROFILING_COMPILE_OPTIONS
+# -g
+# -O0
+# -pg
+# -Wp,-U_FORTIFY_SOURCE
+# CACHE STRING "Compilation flags for PROFILING build type.")
+#set(DEBUG_COMPILE_OPTIONS
+# -g
+# -ggdb
+# -Wp,-U_FORTIFY_SOURCE
+# CACHE STRING "Compilation flags for DEBUG build type.")
+#set(CCOV_COMPILE_OPTIONS
+# -g
+# -O2
+# --coverage
+# CACHE STRING "Compilation flags for CCOV build type.")
+#set(RELEASE_COMPILE_OPTIONS
+# -g
+# -O2
+# CACHE STRING "Compilation flags for RELEASE build type.")
+
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
+# ---------------------------------------------------------------------
+set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
+
+# Optional location for config.xml.in
+# -----------------------------------
+#set(WIDGET_ICON conf.d/wgt/${PROJECT_ICON} CACHE PATH "Path to the widget icon")
+set(WIDGET_CONFIG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in CACHE PATH "Path to widget config file template (config.xml.in)")
+
+# Mandatory widget Mimetype specification of the main unit
+# --------------------------------------------------------------------------
+# Choose between :
+#- text/html : HTML application,
+# content.src designates the home page of the application
+#
+#- application/vnd.agl.native : AGL compatible native,
+# content.src designates the relative path of the binary.
+#
+# - application/vnd.agl.service: AGL service, content.src is not used.
+#
+#- ***application/x-executable***: Native application,
+# content.src designates the relative path of the binary.
+# For such application, only security setup is made.
+#
+set(WIDGET_TYPE application/vnd.agl.native)
+
+# Mandatory Widget entry point file of the main unit
+# --------------------------------------------------------------
+# This is the file that will be executed, loaded,
+# at launch time by the application framework.
+#
+set(WIDGET_ENTRY_POINT irrelevant)
+
+# Optional dependencies order
+# ---------------------------
+#set(EXTRA_DEPENDENCIES_ORDER)
+
+# Optional Extra global include path
+# -----------------------------------
+#set(EXTRA_INCLUDE_DIRS)
+
+# Optional extra libraries
+# -------------------------
+#set(EXTRA_LINK_LIBRARIES)
+
+# Optional force binding Linking flag
+# ------------------------------------
+# set(BINDINGS_LINK_FLAG LinkOptions )
+
+# Optional force package prefix generation, like widget
+# -----------------------------------------------------
+# set(PKG_PREFIX DestinationPath)
+
+# Optional Application Framework security token
+# and port use for remote debugging.
+#------------------------------------------------------------
+set(AFB_TOKEN "" CACHE PATH "Default binder security token")
+set(AFB_REMPORT "1234" CACHE PATH "Default binder listening port")
+
+# Print a helper message when every thing is finished
+# ----------------------------------------------------
+set(CLOSING_MESSAGE "Typical binding launch: afb-daemon --port=${AFB_REMPORT} --workdir=${CMAKE_BINARY_DIR}/package --ldpaths=lib --roothttp=htdocs --token=\"${AFB_TOKEN}\" --tracereq=common --verbose")
+set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
+
+# Optional schema validator about now only XML, LUA and JSON
+# are supported
+#------------------------------------------------------------
+#set(LUA_CHECKER "luac" "-p" CACHE STRING "LUA compiler")
+#set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
+#set(JSON_CHECKER "json_verify" CACHE STRING "JSON linter")
+
+# This include is mandatory and MUST happens at the end
+# of this file, else you expose you to unexpected behavior
+# -----------------------------------------------------------
+include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake)
diff --git a/agl-identity-service/conf.d/wgt/config.xml.in b/agl-identity-service/conf.d/wgt/config.xml.in
new file mode 100644
index 0000000..9c1cb59
--- /dev/null
+++ b/agl-identity-service/conf.d/wgt/config.xml.in
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="@PROJECT_NAME@" version="@PROJECT_VERSION@">
+ <name>@PROJECT_NAME@</name>
+ <icon src="@PROJECT_ICON@"/>
+ <content src="@WIDGET_ENTRY_POINT@" type="@WIDGET_TYPE@"/>
+ <description>@PROJECT_DESCRIPTION@</description>
+ <author>@PROJECT_AUTHOR@ &lt;@PROJECT_AUTHOR_MAIL@&gt;</author>
+ <license>@PROJECT_LICENSE@</license>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:hidden" value="required" />
+ <param name="urn:AGL:permission::system:run-by-default" value="required" />
+ </feature>
+ <feature name="urn:AGL:widget:provided-api">
+ <param name="identity" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="lib/afb-identity-binding.so" value="local" />
+ </feature>
+</widget>
diff --git a/binding/CMakeLists.txt b/agl-identity-service/src/CMakeLists.txt
index b244009..380c024 100644
--- a/binding/CMakeLists.txt
+++ b/agl-identity-service/src/CMakeLists.txt
@@ -1,5 +1,5 @@
###########################################################################
-# Copyright 2016 IoT.bzh
+# Copyright 2016, 2017 IoT.bzh
#
# author: José Bollo <jose.bollo@iot.bzh>
# author: Stéphane Desneux <stephane.desneux@iot.bzh>
@@ -17,37 +17,26 @@
# limitations under the License.
###########################################################################
-cmake_minimum_required(VERSION 3.3)
+PROJECT_TARGET_ADD(afb-identity-binding)
-###########################################################################
-
-include(FindPkgConfig)
-
-pkg_check_modules(EXTRAS REQUIRED json-c afb-daemon libcurl systemd)
-add_compile_options(${EXTRAS_CFLAGS} -DFOR_AFB_BINDING)
-include_directories(${EXTRAS_INCLUDE_DIRS})
-link_libraries(${EXTRAS_LIBRARIES})
-
-add_library(${PROJECT_NAME} MODULE
+add_library(afb-identity-binding MODULE
agl-identity-binding.c
aia-get.c
- aia-uds-bluez.c
authorization.c
base64.c
curl-wrap.c
escape.c
oidc-agent.c
)
-set_target_properties(${PROJECT_NAME} PROPERTIES
- PREFIX ""
- LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/export.map"
-)
-install(TARGETS ${PROJECT_NAME} DESTINATION ${PROJECT_DESTINATION})
+pkg_check_modules(EXTRAS REQUIRED json-c afb-daemon libcurl)
-INSTALL(FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/config.json
- DESTINATION
- ${PROJECT_DESTINATION}
- )
+set_target_properties(afb-identity-binding PROPERTIES
+ LABELS "BINDING"
+ PREFIX ""
+ COMPILE_FLAGS "${EXTRAS_CFLAGS} -DFOR_AFB_BINDING"
+ LINK_FLAGS "${BINDINGS_LINK_FLAG}"
+ LINK_LIBRARIES "${EXTRAS_LIBRARIES}"
+ OUTPUT_NAME "${TARGET_NAME}"
+)
diff --git a/binding/agl-identity-binding.c b/agl-identity-service/src/agl-identity-binding.c
index 3e3f5b4..1feeeb3 100644
--- a/binding/agl-identity-binding.c
+++ b/agl-identity-service/src/agl-identity-binding.c
@@ -26,23 +26,15 @@
#include <sys/stat.h>
#include <json-c/json.h>
-#include <systemd/sd-bus.h>
#define AFB_BINDING_VERSION 2
#include <afb/afb-binding.h>
#include "oidc-agent.h"
#include "aia-get.h"
-#include "aia-uds-bluez.h"
-
-#if !defined(AUTO_START_ADVISE)
-#define AUTO_START_ADVISE 1
-#endif
static int expiration_delay = 5;
-static int advising;
-
static struct afb_event event;
static struct json_object *current_identity;
@@ -52,7 +44,6 @@ static const char default_vin[] = "4T1BF1FK5GU260429";
static const char *oidc_name;
static char *vin;
static char *endpoint;
-static int autoadvise = AUTO_START_ADVISE;
/***** configuration ********************************************/
@@ -127,7 +118,6 @@ static void setconfig(struct json_object *conf)
confsetstr(conf, "endpoint", &endpoint, endpoint ? : default_endpoint);
confsetstr(conf, "vin", &vin, vin ? : default_vin);
confsetint(conf, "delay", &expiration_delay, expiration_delay);
- confsetint(conf, "autoadvise", &autoadvise, autoadvise);
confsetoidc(conf, "oidc-aia");
}
@@ -252,50 +242,6 @@ static void upload_request(const char *address)
AFB_ERROR("out of memory");
}
-static void on_uds_change(const struct aia_uds *uds)
-{
- AFB_INFO("UDS changed"
- " first-name%s[%.*s]"
- " last-name%s[%.*s]"
- " email%s[%.*s]"
- " language%s[%.*s]",
- uds->first_name.changed ? "*" : "", (int)uds->first_name.length, uds->first_name.data ?:"",
- uds->last_name.changed ? "*" : "", (int)uds->last_name.length, uds->last_name.data ?:"",
- uds->email.changed ? "*" : "", (int)uds->email.length, uds->email.data ?:"",
- uds->language.changed ? "*" : "", (int)uds->language.length, uds->language.data ?:"");
- if (uds->email.changed) {
- upload_request(uds->email.data);
- send_event_object("incoming", uds->email.data, uds->email.data);
- }
-}
-
-static void advise (struct afb_req request)
-{
- int rc;
-
- if (!advising) {
- rc = aia_uds_advise(1, NULL, NULL);
- if (rc < 0) {
-/*
-TODO: solve the issue
- afb_req_fail(request, "failed", "start scan failed");
- return;
-*/
- AFB_ERROR("Ignoring scan start failed, because probably already in progress");
- }
- advising = 1;
- }
- afb_req_success(request, NULL, NULL);
-}
-
-
-static void unadvise (struct afb_req request)
-{
- aia_uds_advise(0, NULL, NULL);
- advising = 0;
- afb_req_success(request, NULL, NULL);
-}
-
static void subscribe (struct afb_req request)
{
int rc;
@@ -336,26 +282,15 @@ static void success (struct afb_req request)
static int service_init()
{
- sd_bus *bus;
int rc;
- bus = afb_daemon_get_system_bus();
- rc = bus ? aia_uds_init(bus) : -ENOTSUP;
- if (rc < 0) {
- errno = -rc;
- return -1;
- }
-
- aia_uds_set_on_change(on_uds_change);
-
event = afb_daemon_make_event("event");
if (!afb_event_is_valid(event))
return -1;
readconfig();
- rc = aia_uds_advise(autoadvise, NULL, NULL);
- return rc < 0 ? rc : 0;
+ return 0;
}
@@ -368,18 +303,14 @@ static const struct afb_verb_v2 verbs[]=
{"login" , login , NULL, "log a user in" , AFB_SESSION_NONE },
{"logout" , logout , NULL, "log the current user out", AFB_SESSION_NONE },
{"get" , get , NULL, "get data" , AFB_SESSION_NONE },
- {"advise" , advise , NULL, "start advising uds" , AFB_SESSION_NONE },
- {"unadvise" , unadvise , NULL, "stop advising uds" , AFB_SESSION_NONE },
- {"scan" , success , NULL, "legacy" , AFB_SESSION_NONE },
- {"unscan" , success , NULL, "legacy" , AFB_SESSION_NONE },
{NULL}
};
const struct afb_binding_v2 afbBindingV2 =
{
- .api = "agl-identity-agent",
+ .api = "identity",
.specification = NULL,
- .info = "AGL identity agent service",
+ .info = "AGL identity service",
.verbs = verbs,
.preinit = NULL,
.init = service_init,
diff --git a/binding/aia-get.c b/agl-identity-service/src/aia-get.c
index 93d9470..93d9470 100644
--- a/binding/aia-get.c
+++ b/agl-identity-service/src/aia-get.c
diff --git a/binding/aia-get.h b/agl-identity-service/src/aia-get.h
index be1a1f8..be1a1f8 100644
--- a/binding/aia-get.h
+++ b/agl-identity-service/src/aia-get.h
diff --git a/binding/authorization.c b/agl-identity-service/src/authorization.c
index ae00923..ae00923 100644
--- a/binding/authorization.c
+++ b/agl-identity-service/src/authorization.c
diff --git a/binding/authorization.h b/agl-identity-service/src/authorization.h
index bd26c1a..bd26c1a 100644
--- a/binding/authorization.h
+++ b/agl-identity-service/src/authorization.h
diff --git a/binding/base64.c b/agl-identity-service/src/base64.c
index 0841aba..0841aba 100644
--- a/binding/base64.c
+++ b/agl-identity-service/src/base64.c
diff --git a/binding/base64.h b/agl-identity-service/src/base64.h
index 5a944df..5a944df 100644
--- a/binding/base64.h
+++ b/agl-identity-service/src/base64.h
diff --git a/binding/config.json b/agl-identity-service/src/config.json
index 613fc7a..613fc7a 100644
--- a/binding/config.json
+++ b/agl-identity-service/src/config.json
diff --git a/binding/curl-wrap.c b/agl-identity-service/src/curl-wrap.c
index 986b69f..986b69f 100644
--- a/binding/curl-wrap.c
+++ b/agl-identity-service/src/curl-wrap.c
diff --git a/binding/curl-wrap.h b/agl-identity-service/src/curl-wrap.h
index 2e44f47..2e44f47 100644
--- a/binding/curl-wrap.h
+++ b/agl-identity-service/src/curl-wrap.h
diff --git a/binding/escape.c b/agl-identity-service/src/escape.c
index 3bb25c2..3bb25c2 100644
--- a/binding/escape.c
+++ b/agl-identity-service/src/escape.c
diff --git a/binding/escape.h b/agl-identity-service/src/escape.h
index 7d548db..7d548db 100644
--- a/binding/escape.h
+++ b/agl-identity-service/src/escape.h
diff --git a/binding/export.map b/agl-identity-service/src/export.map
index ee2f413..ee2f413 100644
--- a/binding/export.map
+++ b/agl-identity-service/src/export.map
diff --git a/binding/memo.txt b/agl-identity-service/src/memo.txt
index 3a6ed50..3a6ed50 100644
--- a/binding/memo.txt
+++ b/agl-identity-service/src/memo.txt
diff --git a/binding/oidc-agent.c b/agl-identity-service/src/oidc-agent.c
index 1f09e7a..1f09e7a 100644
--- a/binding/oidc-agent.c
+++ b/agl-identity-service/src/oidc-agent.c
diff --git a/binding/oidc-agent.h b/agl-identity-service/src/oidc-agent.h
index de5918d..de5918d 100644
--- a/binding/oidc-agent.h
+++ b/agl-identity-service/src/oidc-agent.h
diff --git a/binding/test-aia-uds-bluez.c b/agl-identity-service/src/test-aia-uds-bluez.c
index 4a084a5..4a084a5 100644
--- a/binding/test-aia-uds-bluez.c
+++ b/agl-identity-service/src/test-aia-uds-bluez.c
diff --git a/conf.d/app-templates b/conf.d/app-templates
new file mode 160000
+Subproject c881d86fc8852a2b2215856d3503aba192c0f4e
diff --git a/uds-ble-id-init-service/CMakeLists.txt b/uds-ble-id-init-service/CMakeLists.txt
new file mode 100644
index 0000000..14b6d55
--- /dev/null
+++ b/uds-ble-id-init-service/CMakeLists.txt
@@ -0,0 +1,21 @@
+###########################################################################
+# Copyright 2017 IoT.bzh
+#
+# author: Jose Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+cmake_minimum_required(VERSION 3.6)
+SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/)
+include(${CMAKE_CURRENT_SOURCE_DIR}/conf.d/cmake/config.cmake)
diff --git a/btle-advise.service b/uds-ble-id-init-service/btle-advise.service
index 1a34237..1a34237 100644
--- a/btle-advise.service
+++ b/uds-ble-id-init-service/btle-advise.service
diff --git a/btle-advise.timer b/uds-ble-id-init-service/btle-advise.timer
index b02594c..b02594c 100644
--- a/btle-advise.timer
+++ b/uds-ble-id-init-service/btle-advise.timer
diff --git a/uds-ble-id-init-service/conf.d/cmake/config.cmake b/uds-ble-id-init-service/conf.d/cmake/config.cmake
new file mode 100644
index 0000000..4ea1d79
--- /dev/null
+++ b/uds-ble-id-init-service/conf.d/cmake/config.cmake
@@ -0,0 +1,201 @@
+###########################################################################
+# Copyright 2015, 2016, 2017 IoT.bzh
+#
+# author: Fulup Ar Foll <fulup@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+# Project Info
+# ------------------
+set(PROJECT_NAME uds-ble-id-init)
+set(PROJECT_VERSION "0.1")
+set(PROJECT_PRETTY_NAME "AGL Identitity initiator above BLE's User Data Service")
+set(PROJECT_DESCRIPTION "AGL Identitity initiator above BLE's User Data Service")
+set(PROJECT_URL "https://github.com/iotbzh/aia-binding")
+set(PROJECT_ICON "icon.png")
+set(PROJECT_AUTHOR "José Bollo")
+set(PROJECT_AUTHOR_MAIL "jose.bollo@iot.bzh")
+set(PROJECT_LICENSE "APL2.0")
+set(PROJECT_LANGUAGES,"C")
+
+# Where are stored default templates files from submodule or subtree app-templates in your project tree
+# relative to the root project directory
+set(PROJECT_APP_TEMPLATES_DIR "../conf.d/app-templates")
+
+# Where are stored your external libraries for your project. This is 3rd party library that you don't maintain
+# but used and must be built and linked.
+# set(PROJECT_LIBDIR "libs")
+
+# Where are stored data for your application. Pictures, static resources must be placed in that folder.
+# set(PROJECT_RESOURCES "data")
+
+# Which directories inspect to find CMakeLists.txt target files
+# set(PROJECT_SRC_DIR_PATTERN "*")
+
+# Compilation Mode (DEBUG, RELEASE)
+# ----------------------------------
+
+# Kernel selection if needed. You can choose between a
+# mandatory version to impose a minimal version.
+# Or check Kernel minimal version and just print a Warning
+# about missing features and define a preprocessor variable
+# to be used as preprocessor condition in code to disable
+# incompatibles features. Preprocessor define is named
+# KERNEL_MINIMAL_VERSION_OK.
+#
+# NOTE*** FOR NOW IT CHECKS KERNEL Yocto environment and
+# Yocto SDK Kernel version.
+# -----------------------------------------------
+#set (kernel_mandatory_version 4.8)
+#set (kernel_minimal_version 4.8)
+
+# Compiler selection if needed. Impose a minimal version.
+# -----------------------------------------------
+set (gcc_minimal_version 4.9)
+
+# PKG_CONFIG required packages
+# -----------------------------
+set (PKG_REQUIRED_LIST
+ json-c
+ libsystemd>=222
+ afb-daemon
+)
+
+# Prefix path where will be installed the files
+# Default: /usr/local (need root permission to write in)
+# ------------------------------------------------------
+#set(CMAKE_INSTALL_PREFIX $ENV{HOME}/opt)
+
+# Customize link option
+# -----------------------------
+#list(APPEND link_libraries -an-option)
+
+# Compilation options definition
+# Use CMake generator expressions to specify only for a specific language
+# Values are prefilled with default options that is currently used.
+# Either separate options with ";", or each options must be quoted separately
+# DO NOT PUT ALL OPTION QUOTED AT ONCE , COMPILATION COULD FAILED !
+# ----------------------------------------------------------------------------
+#set(COMPILE_OPTIONS
+# -Wall
+# -Wextra
+# -Wconversion
+# -Wno-unused-parameter
+# -Wno-sign-compare
+# -Wno-sign-conversion
+# -Werror=maybe-uninitialized
+# -Werror=implicit-function-declaration
+# -ffunction-sections
+# -fdata-sections
+# -fPIC
+# CACHE STRING "Compilation flags")
+#set(C_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C language.")
+#set(CXX_COMPILE_OPTIONS "" CACHE STRING "Compilation flags for C++ language.")
+#set(PROFILING_COMPILE_OPTIONS
+# -g
+# -O0
+# -pg
+# -Wp,-U_FORTIFY_SOURCE
+# CACHE STRING "Compilation flags for PROFILING build type.")
+#set(DEBUG_COMPILE_OPTIONS
+# -g
+# -ggdb
+# -Wp,-U_FORTIFY_SOURCE
+# CACHE STRING "Compilation flags for DEBUG build type.")
+#set(CCOV_COMPILE_OPTIONS
+# -g
+# -O2
+# --coverage
+# CACHE STRING "Compilation flags for CCOV build type.")
+#set(RELEASE_COMPILE_OPTIONS
+# -g
+# -O2
+# CACHE STRING "Compilation flags for RELEASE build type.")
+
+# (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable]
+# ---------------------------------------------------------------------
+set(CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}/lib64/pkgconfig ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
+set(LD_LIBRARY_PATH ${CMAKE_INSTALL_PREFIX}/lib64 ${CMAKE_INSTALL_PREFIX}/lib)
+
+# Optional location for config.xml.in
+# -----------------------------------
+#set(WIDGET_ICON conf.d/wgt/${PROJECT_ICON} CACHE PATH "Path to the widget icon")
+set(WIDGET_CONFIG_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/conf.d/wgt/config.xml.in CACHE PATH "Path to widget config file template (config.xml.in)")
+
+# Mandatory widget Mimetype specification of the main unit
+# --------------------------------------------------------------------------
+# Choose between :
+#- text/html : HTML application,
+# content.src designates the home page of the application
+#
+#- application/vnd.agl.native : AGL compatible native,
+# content.src designates the relative path of the binary.
+#
+# - application/vnd.agl.service: AGL service, content.src is not used.
+#
+#- ***application/x-executable***: Native application,
+# content.src designates the relative path of the binary.
+# For such application, only security setup is made.
+#
+set(WIDGET_TYPE application/vnd.agl.service)
+
+# Mandatory Widget entry point file of the main unit
+# --------------------------------------------------------------
+# This is the file that will be executed, loaded,
+# at launch time by the application framework.
+#
+set(WIDGET_ENTRY_POINT irrelevant)
+
+# Optional dependencies order
+# ---------------------------
+#set(EXTRA_DEPENDENCIES_ORDER)
+
+# Optional Extra global include path
+# -----------------------------------
+#set(EXTRA_INCLUDE_DIRS)
+
+# Optional extra libraries
+# -------------------------
+#set(EXTRA_LINK_LIBRARIES)
+
+# Optional force binding Linking flag
+# ------------------------------------
+# set(BINDINGS_LINK_FLAG LinkOptions )
+
+# Optional force package prefix generation, like widget
+# -----------------------------------------------------
+# set(PKG_PREFIX DestinationPath)
+
+# Optional Application Framework security token
+# and port use for remote debugging.
+#------------------------------------------------------------
+set(AFB_TOKEN "" CACHE PATH "Default binder security token")
+set(AFB_REMPORT "1234" CACHE PATH "Default binder listening port")
+
+# Print a helper message when every thing is finished
+# ----------------------------------------------------
+set(CLOSING_MESSAGE "Typical binding launch: afb-daemon --port=${AFB_REMPORT} --workdir=${CMAKE_BINARY_DIR}/package --ldpaths=lib --roothttp=htdocs --token=\"${AFB_TOKEN}\" --tracereq=common --verbose")
+set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt")
+
+# Optional schema validator about now only XML, LUA and JSON
+# are supported
+#------------------------------------------------------------
+#set(LUA_CHECKER "luac" "-p" CACHE STRING "LUA compiler")
+#set(XML_CHECKER "xmllint" CACHE STRING "XML linter")
+#set(JSON_CHECKER "json_verify" CACHE STRING "JSON linter")
+
+# This include is mandatory and MUST happens at the end
+# of this file, else you expose you to unexpected behavior
+# -----------------------------------------------------------
+include(${PROJECT_APP_TEMPLATES_DIR}/cmake/common.cmake)
diff --git a/uds-ble-id-init-service/conf.d/wgt/config.xml.in b/uds-ble-id-init-service/conf.d/wgt/config.xml.in
new file mode 100644
index 0000000..0ccd9b5
--- /dev/null
+++ b/uds-ble-id-init-service/conf.d/wgt/config.xml.in
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="@PROJECT_NAME@" version="@PROJECT_VERSION@">
+ <name>@PROJECT_NAME@</name>
+ <icon src="@PROJECT_ICON@"/>
+ <content src="@WIDGET_ENTRY_POINT@" type="@WIDGET_TYPE@"/>
+ <description>@PROJECT_DESCRIPTION@</description>
+ <author>@PROJECT_AUTHOR@ &lt;@PROJECT_AUTHOR_MAIL@&gt;</author>
+ <license>@PROJECT_LICENSE@</license>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:hidden" value="required" />
+ <param name="urn:AGL:permission::system:run-by-default" value="required" />
+ </feature>
+ <feature name="urn:AGL:widget:provided-api">
+ <param name="windowmanager" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="lib/afb-ll-database-binding.so" value="local" />
+ </feature>
+</widget>
diff --git a/uds-ble-id-init-service/src/CMakeLists.txt b/uds-ble-id-init-service/src/CMakeLists.txt
new file mode 100644
index 0000000..97e229a
--- /dev/null
+++ b/uds-ble-id-init-service/src/CMakeLists.txt
@@ -0,0 +1,35 @@
+###########################################################################
+# Copyright 2017 IoT.bzh
+#
+# author: Jose Bollo <jose.bollo@iot.bzh>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+###########################################################################
+
+PROJECT_TARGET_ADD(afb-uds-ble-id-init-binding)
+
+add_library(afb-uds-ble-id-init-binding MODULE
+ uds-ble-id-init-service.c
+ aia-uds-bluez.c
+)
+
+set_target_properties(afb-uds-ble-id-init-binding PROPERTIES
+ LABELS "BINDING"
+ PREFIX ""
+ COMPILE_FLAGS "${libsystemd_CFLAGS}"
+ INCLUDE_DIRECTORIES "${libsystemd_INCLUDE_DIRS}"
+ LINK_FLAGS "${BINDINGS_LINK_FLAG}"
+ LINK_LIBRARIES "${libsystemd_LIBRARIES}"
+ OUTPUT_NAME "${TARGET_NAME}"
+)
+
diff --git a/binding/aia-uds-bluez.c b/uds-ble-id-init-service/src/aia-uds-bluez.c
index 35ba61d..35ba61d 100644
--- a/binding/aia-uds-bluez.c
+++ b/uds-ble-id-init-service/src/aia-uds-bluez.c
diff --git a/binding/aia-uds-bluez.h b/uds-ble-id-init-service/src/aia-uds-bluez.h
index 856da4e..856da4e 100644
--- a/binding/aia-uds-bluez.h
+++ b/uds-ble-id-init-service/src/aia-uds-bluez.h
diff --git a/uds-ble-id-init-service/src/uds-ble-id-init-service.c b/uds-ble-id-init-service/src/uds-ble-id-init-service.c
new file mode 100644
index 0000000..f887963
--- /dev/null
+++ b/uds-ble-id-init-service/src/uds-ble-id-init-service.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2015, 2016, 2017 "IoT.bzh"
+ * Author: José Bollo <jose.bollo@iot.bzh>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <json-c/json.h>
+#include <systemd/sd-bus.h>
+
+#define AFB_BINDING_VERSION 2
+#include <afb/afb-binding.h>
+
+#include "aia-uds-bluez.h"
+
+#if !defined(AUTO_START_ADVISE)
+#define AUTO_START_ADVISE 1
+#endif
+
+static int advising;
+
+static struct afb_event event;
+
+static int autoadvise = AUTO_START_ADVISE;
+
+/****************************************************************/
+
+static void on_uds_change(const struct aia_uds *uds)
+{
+ struct json_object *object;
+
+ AFB_INFO("UDS changed"
+ " first-name%s[%.*s]"
+ " last-name%s[%.*s]"
+ " email%s[%.*s]"
+ " language%s[%.*s]",
+ uds->first_name.changed ? "*" : "", (int)uds->first_name.length, uds->first_name.data ?:"",
+ uds->last_name.changed ? "*" : "", (int)uds->last_name.length, uds->last_name.data ?:"",
+ uds->email.changed ? "*" : "", (int)uds->email.length, uds->email.data ?:"",
+ uds->language.changed ? "*" : "", (int)uds->language.length, uds->language.data ?:"");
+
+ if (uds->email.changed) {
+ object = json_object_new_object();
+ json_object_object_add(object, "incoming", json_object_new_string(uds->email.data));
+ afb_event_push(event, object);
+ }
+}
+
+static void start (struct afb_req request)
+{
+ int rc;
+
+ if (!advising) {
+ rc = aia_uds_advise(1, NULL, NULL);
+ if (rc < 0) {
+/*
+TODO: solve the issue
+ afb_req_fail(request, "failed", "start scan failed");
+ return;
+*/
+ AFB_ERROR("Ignoring scan start failed, because probably already in progress");
+ }
+ }
+ advising = advising + 1;
+ afb_req_subscribe(request, event);
+ afb_req_success(request, NULL, NULL);
+}
+
+
+static void stop (struct afb_req request)
+{
+ if (advising) {
+ advising = advising - 1;
+ if (!advising)
+ aia_uds_advise(0, NULL, NULL);
+ }
+ afb_req_success(request, NULL, NULL);
+}
+
+static int init()
+{
+ sd_bus *bus;
+ int rc;
+
+ bus = afb_daemon_get_system_bus();
+ rc = bus ? aia_uds_init(bus) : -ENOTSUP;
+ if (rc < 0) {
+ errno = -rc;
+ return -1;
+ }
+
+ aia_uds_set_on_change(on_uds_change);
+
+ event = afb_daemon_make_event("event");
+ if (!afb_event_is_valid(event))
+ return -1;
+
+ rc = aia_uds_advise(autoadvise, NULL, NULL);
+ advising = autoadvise && rc >= 0;
+ return rc < 0 ? rc : 0;
+}
+
+
+// NOTE: this sample does not use session to keep test a basic as possible
+// in real application most APIs should be protected with AFB_SESSION_CHECK
+static const struct afb_verb_v2 verbs[]=
+{
+ {"start" , start, NULL, "start User Data Service", AFB_SESSION_NONE },
+ {"stop" , stop , NULL, "stop User Data Service" , AFB_SESSION_NONE },
+ {NULL}
+};
+
+const struct afb_binding_v2 afbBindingV2 =
+{
+ .api = "uds-ble-init-id",
+ .specification = NULL,
+ .info = "AGL Identitity initiator above BLE's User Data Service",
+ .verbs = verbs,
+ .preinit = NULL,
+ .init = init,
+ .onevent = NULL,
+ .noconcurrency = 1
+};
+
+/* vim: set colorcolumn=80: */
+