diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2010-07-28 14:56:06 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2010-08-09 18:06:47 -0400 |
commit | 1f07bea585b3f7db1866a3e4af7072adf1906064 (patch) | |
tree | 27a860f27414f10fe14964a2fb072934d2962e47 /src | |
parent | db3bf777b85503ab873ac5f057359e1eb912833a (diff) | |
download | bluez-1f07bea585b3f7db1866a3e4af7072adf1906064.tar.gz bluez-1f07bea585b3f7db1866a3e4af7072adf1906064.tar.xz bluez-1f07bea585b3f7db1866a3e4af7072adf1906064.zip |
Add support for loading previously stored services
This adds support for loading the GATT primary services information
that may exist. This will allow registering the DBus interface of a
service without connecting to the remote device.
Diffstat (limited to 'src')
-rw-r--r-- | src/storage.c | 13 | ||||
-rw-r--r-- | src/storage.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c index f07f6d78..4d4607a6 100644 --- a/src/storage.c +++ b/src/storage.c @@ -1251,3 +1251,16 @@ int write_device_services(const bdaddr_t *sba, const bdaddr_t *dba, return textfile_put(filename, addr, services); } + +char *read_device_services(const bdaddr_t *sba, const bdaddr_t *dba) +{ + 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_caseget(filename, addr); +} diff --git a/src/storage.h b/src/storage.h index 99270c5b..93903a7c 100644 --- a/src/storage.h +++ b/src/storage.h @@ -80,6 +80,7 @@ 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); +char *read_device_services(const bdaddr_t *sba, const bdaddr_t *dba); #define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb" |