aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-07-27 15:17:08 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-08-09 18:06:47 -0400
commitdb3bf777b85503ab873ac5f057359e1eb912833a (patch)
treefd06f44f45cd993335bd47a04faab8e4ad9d1731 /src
parentdd5279755e9ba6f487e6c03eab621902f767c0bb (diff)
downloadbluez-db3bf777b85503ab873ac5f057359e1eb912833a.tar.gz
bluez-db3bf777b85503ab873ac5f057359e1eb912833a.tar.xz
bluez-db3bf777b85503ab873ac5f057359e1eb912833a.zip
Add support to storing the discoved GATT Services
This adds support to storing the discovered primary services so they can be loaded from storage later.
Diffstat (limited to 'src')
-rw-r--r--src/storage.c14
-rw-r--r--src/storage.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
index e09e2576..f07f6d78 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -1237,3 +1237,17 @@ int write_blocked(const bdaddr_t *local, const bdaddr_t *remote,
return textfile_caseput(filename, addr, "");
}
+
+int write_device_services(const bdaddr_t *sba, const bdaddr_t *dba,
+ const char *services)
+{
+ char filename[PATH_MAX + 1], addr[18];
+
+ create_filename(filename, PATH_MAX, sba, "primary");
+
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ ba2str(dba, addr);
+
+ return textfile_put(filename, addr, services);
+}
diff --git a/src/storage.h b/src/storage.h
index eee71d39..99270c5b 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -78,6 +78,8 @@ int read_device_pairable(bdaddr_t *local, gboolean *mode);
gboolean read_blocked(const bdaddr_t *local, const bdaddr_t *remote);
int write_blocked(const bdaddr_t *local, const bdaddr_t *remote,
gboolean blocked);
+int write_device_services(const bdaddr_t *sba, const bdaddr_t *dba,
+ const char *services);
#define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb"