aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-10-13 05:34:08 +0200
committerSven Gothel <[email protected]>2021-10-13 05:34:08 +0200
commit726759140057843ed86fa2fdf212fd176ff38ebe (patch)
tree64268d79c61d14c5b41653af5297a27d4a08ef70 /api/direct_bt
parent28cc0bf0094bc736ea473c2a2906df34319e6346 (diff)
[BT|DB]GattChar::toString(): Add UTF8 user-description if available
Diffstat (limited to 'api/direct_bt')
-rw-r--r--api/direct_bt/DBGattServer.hpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/api/direct_bt/DBGattServer.hpp b/api/direct_bt/DBGattServer.hpp
index 8971e18a..3b737502 100644
--- a/api/direct_bt/DBGattServer.hpp
+++ b/api/direct_bt/DBGattServer.hpp
@@ -37,6 +37,7 @@
#include <jau/java_uplink.hpp>
#include <jau/octets.hpp>
#include <jau/uuid.hpp>
+#include <jau/dfa_utf8_decode.hpp>
#include "BTTypes0.hpp"
#include "ATTPDUTypes.hpp"
@@ -203,13 +204,19 @@ namespace direct_bt {
bool hasProperties(const BTGattChar::PropertyBitVal v) const noexcept { return v == ( properties & v ); }
std::string toString() const noexcept {
- std::string notify_str;
+ std::string char_name, notify_str;
+ {
+ const DBGattDesc* ud = getUserDescription();
+ if( nullptr != ud ) {
+ char_name = ", '" + jau::dfa_utf8_decode( ud->value.get_ptr(), ud->value.size() ) + "'";
+ }
+ }
if( hasProperties(BTGattChar::PropertyBitVal::Notify) || hasProperties(BTGattChar::PropertyBitVal::Indicate) ) {
notify_str = ", enabled[notify "+std::to_string(enabledNotifyState)+", indicate "+std::to_string(enabledIndicateState)+"]";
}
return "Char[handle ["+jau::to_hexstring(handle)+".."+jau::to_hexstring(end_handle)+
"], props "+jau::to_hexstring(properties)+" "+BTGattChar::getPropertiesString(properties)+
- ", value[type 0x"+value_type->toString()+", handle "+jau::to_hexstring(value_handle)+", "+value.toString()+
+ char_name+", value[type 0x"+value_type->toString()+", handle "+jau::to_hexstring(value_handle)+", "+value.toString()+
"], ccd-idx "+std::to_string(clientCharConfigIndex)+notify_str+"]";
}