aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjobol <jose.bollo@iot.bzh>2018-03-26 14:24:33 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2018-06-13 17:20:59 +0200
commitc356d38d12c4a71916ff4c7d4f0af61d570b36f0 (patch)
treeac7a0795525dc86d79b8bb08dc1b89bddceebf3a
parentb7096701f473f7d9dbfa3213fdce521b186ea940 (diff)
afm-binding: Improve comment and strings
Change-Id: Ic70e2abf1301d11b0a610cdf5cfd783d21a5674f Signed-off-by: jobol <jose.bollo@iot.bzh>
-rw-r--r--src/afm-binding.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/afm-binding.c b/src/afm-binding.c
index 5aad281..fb9b8a9 100644
--- a/src/afm-binding.c
+++ b/src/afm-binding.c
@@ -34,8 +34,13 @@
#include "wgtpkg-uninstall.h"
#include "wrap-json.h"
+/*
+ * constant strings
+ */
static const char _added_[] = "added";
static const char _a_l_c_[] = "application-list-changed";
+static const char _bad_request_[] = "bad-request";
+static const char _cannot_start_[] = "cannot-start";
static const char _detail_[] = "detail";
static const char _id_[] = "id";
static const char _install_[] = "install";
@@ -52,31 +57,49 @@ static const char _state_[] = "state";
static const char _terminate_[] = "terminate";
static const char _uninstall_[] = "uninstall";
+/*
+ * default root
+ */
static const char *rootdir = FWK_APP_DIR;
-static struct afb_event applist_changed_event;
+
+/*
+ * the internal application database
+ */
static struct afm_udb *afudb;
+
+/*
+ * the event signalling that application list changed
+ */
+static struct afb_event applist_changed_event;
+
+/*
+ * the preallocated true json_object
+ */
static struct json_object *json_true;
+/* enforce daemon reload */
static void do_reloads()
{
- /* enforce daemon reload */
systemd_daemon_reload(0);
systemd_unit_restart_name(0, "sockets.target");
}
+/* common bad request reply */
static void bad_request(struct afb_req req)
{
- afb_req_fail(req, "bad-request", NULL);
+ afb_req_fail(req, _bad_request_, NULL);
}
+/* common not found reply */
static void not_found(struct afb_req req)
{
afb_req_fail(req, _not_found_, NULL);
}
+/* common can't start reply */
static void cant_start(struct afb_req req)
{
- afb_req_fail(req, "cannot-start", NULL);
+ afb_req_fail(req, _cannot_start_, NULL);
}
/*
@@ -416,6 +439,9 @@ static void install(struct afb_req req)
}
}
+/*
+ * On querying uninstallation of widget(s)
+ */
static void uninstall(struct afb_req req)
{
const char *idaver;