aboutsummaryrefslogtreecommitdiffstats
path: root/binding/bluetooth-conf.c
diff options
context:
space:
mode:
authorRaquel Medina <raquel.medina@konsulko.com>2020-09-17 14:30:56 +0200
committerRaquel Medina <raquel.medina@konsulko.com>2020-09-21 20:45:00 +0200
commitcf647a95213c209ab7214f1c1c16f1771c4bb229 (patch)
tree25fab07c184f45087e1ad8fe9066e6c2c6d7630c /binding/bluetooth-conf.c
parentfa9d1210cdfff25403fb1d234d561444d7d47656 (diff)
create persistence binding entry for default adapter
Add logic to create an entry for 'default_adapter' in the persistence database. This will enable having the stored value available between power up/power down cycles. Bug-AGL: SPEC-3577 Signed-off-by: Raquel Medina <raquel.medina@konsulko.com> Change-Id: I158dcc1d37ccaf8dfe5d53e262f0619ad780c26a
Diffstat (limited to 'binding/bluetooth-conf.c')
-rw-r--r--binding/bluetooth-conf.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/binding/bluetooth-conf.c b/binding/bluetooth-conf.c
index 2f6f475..ff888d6 100644
--- a/binding/bluetooth-conf.c
+++ b/binding/bluetooth-conf.c
@@ -66,7 +66,14 @@ int set_default_adapter(afb_api_t api, const char *adapter)
json_object_object_add(query, "value", json_object_new_string(adapter));
ret = afb_api_call_sync(api, "persistence", "update", query, &response, NULL, NULL);
+ if (ret < 0) {
+ ret = afb_api_call_sync(api, "persistence", "insert", query, &response, NULL, NULL);
+ if (ret < 0)
+ goto out;
+ }
+
json_object_put(response);
+out:
return ret;
}