aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-07-03 12:35:57 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-10 17:12:14 +0200
commit15d3a0730fd5ab4dc8c5c6d91dcc07de3a93e294 (patch)
tree829cc0179b84b18ea96569bdd0d1b62f605b319f /src
parent0a66e335764af73ff6402ab5d2580899c2e2783b (diff)
Update onload to testVerb
Then tests are executed at verb call instead of at the binding launch Change-Id: I133c203c28f561dd6d4242bf8c78bfcf71f73209 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/test-binding.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/test-binding.c b/src/test-binding.c
index d0fcb3c..aa9fde5 100644
--- a/src/test-binding.c
+++ b/src/test-binding.c
@@ -29,7 +29,7 @@ afb_dynapi *AFB_default;
// Config Section definition
static CtlSectionT ctrlSections[] = {
{.key = "resources", .loadCB = PluginConfig},
- {.key = "onload", .loadCB = OnloadConfig},
+ {.key = "testVerb", .loadCB = ControlConfig},
{.key = "events", .loadCB = EventConfig},
{.key = "mapis", .loadCB = mapisConfig},
{.key = NULL}
@@ -45,9 +45,19 @@ static void ctrlapi_ping(AFB_ReqT request) {
return;
}
+static void ctrlapi_exit(AFB_ReqT request) {
+
+ AFB_ReqNotice(request, "Exiting...");
+ AFB_ReqSuccess(request, NULL, NULL);
+ exit(0);
+
+ return;
+}
+
static AFB_ApiVerbs CtrlApiVerbs[] = {
/* VERB'S NAME FUNCTION TO CALL SHORT DESCRIPTION */
{.verb = "ping", .callback = ctrlapi_ping, .info = "ping test for API"},
+ {.verb = "exit", .callback = ctrlapi_exit, .info = "Exit test"},
{.verb = NULL} /* marker for end of the array */
};