aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-07-29 19:00:25 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-08-09 18:06:47 -0400
commitfc367513b16229cfb3643c5e130f22ab989ef517 (patch)
treec5fea5c47475d75032e3b5bc59216d95aa27ad6e /src
parent3164df0ec2b9e995cb0a0c9123383d8322bab10f (diff)
downloadbluez-fc367513b16229cfb3643c5e130f22ab989ef517.tar.gz
bluez-fc367513b16229cfb3643c5e130f22ab989ef517.tar.xz
bluez-fc367513b16229cfb3643c5e130f22ab989ef517.zip
Add a way to store a device characteristics
This allows for the characteristics of a device to be stored on permanent storage, so they can be restored later on.
Diffstat (limited to 'src')
-rw-r--r--src/storage.c16
-rw-r--r--src/storage.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/storage.c b/src/storage.c
index 4d4607a6..08778bcf 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -1264,3 +1264,19 @@ char *read_device_services(const bdaddr_t *sba, const bdaddr_t *dba)
return textfile_caseget(filename, addr);
}
+
+int write_device_characteristics(const bdaddr_t *sba, const bdaddr_t *dba,
+ uint16_t handle, const char *chars)
+{
+ char filename[PATH_MAX + 1], addr[18], key[23];
+
+ create_filename(filename, PATH_MAX, sba, "characteristic");
+
+ create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+ ba2str(dba, addr);
+
+ snprintf(key, sizeof(key), "%17s#%04X", addr, handle);
+
+ return textfile_put(filename, key, chars);
+}
diff --git a/src/storage.h b/src/storage.h
index 93903a7c..37c6d54a 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -81,6 +81,8 @@ int write_blocked(const bdaddr_t *local, const bdaddr_t *remote,
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);
+int write_device_characteristics(const bdaddr_t *sba, const bdaddr_t *dba,
+ uint16_t handle, const char *chars);
#define PNP_UUID "00001200-0000-1000-8000-00805f9b34fb"