diff options
-rw-r--r-- | api/direct_bt/DBGattServer.hpp | 6 | ||||
-rw-r--r-- | java/org/direct_bt/DBGattValue.java | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/api/direct_bt/DBGattServer.hpp b/api/direct_bt/DBGattServer.hpp index e2fc23a6..d32de77a 100644 --- a/api/direct_bt/DBGattServer.hpp +++ b/api/direct_bt/DBGattServer.hpp @@ -32,6 +32,7 @@ #include <cstdint> #include <mutex> #include <atomic> +#include <initializer_list> #include <jau/java_uplink.hpp> #include <jau/octets.hpp> @@ -529,6 +530,11 @@ namespace direct_bt { return p; } + /** Convenience jau::POctets ctor function to create DBGattChar or DBGattDesc values. */ + inline jau::POctets make_gvalue(std::initializer_list<uint8_t> sourcelist) { + return jau::POctets(sourcelist, jau::endian::little); + } + /** * Representing a Gatt Service object from the ::GATTRole::Server perspective. * diff --git a/java/org/direct_bt/DBGattValue.java b/java/org/direct_bt/DBGattValue.java index 211afe46..b695c5cd 100644 --- a/java/org/direct_bt/DBGattValue.java +++ b/java/org/direct_bt/DBGattValue.java @@ -71,6 +71,11 @@ public class DBGattValue return new DBGattValue(p, capacity, true /* variable_length */); } + /** Convenience {@link DBGattValue} ctor function. */ + public static DBGattValue make(final byte[] p) { + return new DBGattValue(p, p.length); + } + /** * Constructor * @param value the data, which length defines the maximum writable fixed length if variable length is false. |