aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-event.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-10-25 19:10:56 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:54 +0100
commitaf1069d393d97857a2fd6e5ac6eb55dae1af4716 (patch)
tree140d833a1a7f3eb3ed31c9be0e1327d26ff66c3f /ctl-lib/ctl-event.c
parent6d70dd06ac391b2bcae106121d0ca350eba3d1c4 (diff)
Formating
Change-Id: I2b805a60b67db1a72b429093256999673e2c3964 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-event.c')
-rw-r--r--ctl-lib/ctl-event.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/ctl-lib/ctl-event.c b/ctl-lib/ctl-event.c
index 62632e6..5be8b24 100644
--- a/ctl-lib/ctl-event.c
+++ b/ctl-lib/ctl-event.c
@@ -27,27 +27,27 @@
#ifdef AFB_BINDING_PREV3
PUBLIC void CtrlDispatchApiEvent (AFB_ApiT apiHandle, const char *evtLabel, struct json_object *eventJ) {
AFB_ApiNotice (apiHandle, "Received event=%s, query=%s", evtLabel, json_object_get_string(eventJ));
-
+
// retrieve section config from api handle
CtlConfigT *ctrlConfig = (CtlConfigT*) afb_dynapi_get_userdata(apiHandle);
-
+
CtlActionT* actions = ctrlConfig->sections[CTL_SECTION_EVENT].actions;
-
+
int index= ActionLabelToIndex(actions, evtLabel);
if (index < 0) {
AFB_ApiWarning(apiHandle, "CtlDispatchEvent: fail to find uid=%s in action event section", evtLabel);
return;
}
- // create a dummy source for action
+ // create a dummy source for action
CtlSourceT source;
source.uid = actions[index].uid;
source.api = actions[index].api;
source.request = NULL;
-
- // Best effort ignoring error to exec corresponding action
+
+ // Best effort ignoring error to exec corresponding action
(void) ActionExecOne (&source, &actions[index], eventJ);
-
+
}
#else
// In API-V2 controller config is unique and static
@@ -56,34 +56,34 @@ extern CtlConfigT *ctrlConfig;
// call action attached to even name if any
PUBLIC void CtrlDispatchV2Event(const char *evtLabel, json_object *eventJ) {
CtlActionT* actions = ctrlConfig->sections[CTL_SECTION_EVENT].actions;
-
+
int index= ActionLabelToIndex(actions, evtLabel);
if (index < 0) {
AFB_WARNING ("CtlDispatchEvent: fail to find uid=%s in action event section", evtLabel);
return;
}
-
+
CtlSourceT source;
source.uid = actions[index].uid;
source.api = actions[index].api;
source.request = AFB_ReqNone;
- // Best effort ignoring error to exec corresponding action
+ // Best effort ignoring error to exec corresponding action
(void) ActionExecOne (&source, &actions[index], eventJ);
}
#endif
// onload section receive one action or an array of actions
PUBLIC int EventConfig(AFB_ApiT apiHandle, CtlSectionT *section, json_object *actionsJ) {
-
+
// Load time parse actions in config file
if (actionsJ != NULL) {
section->actions= ActionConfig(apiHandle, actionsJ, 0);
-
+
if (!section->actions) {
AFB_ApiError (apiHandle, "EventLoad config fail processing onload actions");
goto OnErrorExit;
- }
+ }
}
return 0;