aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"