aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer-binding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'signal-composer-binding/signal-composer-binding.cpp')
-rw-r--r--signal-composer-binding/signal-composer-binding.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/signal-composer-binding/signal-composer-binding.cpp b/signal-composer-binding/signal-composer-binding.cpp
index 3ce60b8..c70941a 100644
--- a/signal-composer-binding/signal-composer-binding.cpp
+++ b/signal-composer-binding/signal-composer-binding.cpp
@@ -73,13 +73,19 @@ void loadConf(afb_req request)
/// @brief entry point to list available signals
void list(afb_req request)
{
- if(true)
+ struct json_object *allSignalsJ = json_object_new_array();
+
+ std::vector<std::shared_ptr<Signal>> allSignals = bindingApp::instance().getAllSignals();
+ for(auto& sig: allSignals)
+ {json_object_array_add(allSignalsJ, sig->toJSON());}
+
+ if(json_object_array_length(allSignalsJ))
{
- afb_req_success(request, NULL, NULL);
+ afb_req_success(request, allSignalsJ, NULL);
}
else
{
- afb_req_fail(request, "error", NULL);
+ afb_req_fail(request, "error", "No Signals recorded so far");
}
}