diff options
author | Sven Gothel <[email protected]> | 2020-12-04 13:56:48 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-12-04 13:56:48 +0100 |
commit | 045023b1e19bc91d34a08acd3c5efaa842795cbd (patch) | |
tree | b1dbdc9b996d9a420a453e84d2445b7eb4136a66 | |
parent | 73036efb8fd2533e3aab36210d052f513bb030fa (diff) |
OctetTypes: Add put_bytes[_nc](..) as a variation to conveniently memcpy into the buffer w/o TROctets
-rw-r--r-- | api/direct_bt/OctetTypes.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/api/direct_bt/OctetTypes.hpp b/api/direct_bt/OctetTypes.hpp index 9d11fdca..7de03b87 100644 --- a/api/direct_bt/OctetTypes.hpp +++ b/api/direct_bt/OctetTypes.hpp @@ -347,6 +347,14 @@ namespace direct_bt { memcpy(data() + i, v.get_ptr(), v.getSize()); } + void put_bytes(const jau::nsize_t i, const uint8_t *source, const jau::nsize_t byte_count) { + check_range(i, byte_count); + memcpy(data() + i, source, byte_count); + } + void put_bytes_nc(const jau::nsize_t i, const uint8_t *source, const jau::nsize_t byte_count) noexcept { + memcpy(data() + i, source, byte_count); + } + void put_string(const jau::nsize_t i, const std::string & v, const jau::nsize_t max_len, const bool includeEOS) { const jau::nsize_t size1 = v.size() + ( includeEOS ? 1 : 0 ); const jau::nsize_t size = std::min(size1, max_len); |