diff options
author | Sven Gothel <[email protected]> | 2020-07-04 01:18:04 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-07-04 01:18:04 +0200 |
commit | 7d028e850913f3ed495ce79a0350e76d5727222b (patch) | |
tree | 0cbabea3715b76bb68e629c5fe4f3b896cb87d27 /examples | |
parent | fb7b8f699e8ab921af3f875ddb285bd502737818 (diff) |
Extract dfa_utf8_decode.[cpp/hpp] added to libtinyb.so, i.e. used for both native libs commonly exposed in Java via BluetoothUtils.cxx JNI
Diffstat (limited to 'examples')
-rw-r--r-- | examples/direct_bt_scanner00/dbt_scanner00.cpp | 4 | ||||
-rw-r--r-- | examples/direct_bt_scanner10/dbt_scanner10.cpp | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/examples/direct_bt_scanner00/dbt_scanner00.cpp b/examples/direct_bt_scanner00/dbt_scanner00.cpp index b9dcc27d..617b52b8 100644 --- a/examples/direct_bt_scanner00/dbt_scanner00.cpp +++ b/examples/direct_bt_scanner00/dbt_scanner00.cpp @@ -26,6 +26,8 @@ #include <direct_bt/DirectBT.hpp> #include <cinttypes> +#include "direct_bt/dfa_utf8_decode.hpp" + extern "C" { #include <unistd.h> } @@ -271,7 +273,7 @@ int main(int argc, char *argv[]) if( serviceChar.hasProperties(GATTCharacteristic::PropertyBitVal::Read) ) { POctets value(GATTHandler::number(GATTHandler::Defaults::MAX_ATT_MTU), 0); if( serviceChar.readValue(value) ) { - std::string sval = decodeUTF8String(value.get_ptr(), value.getSize()); + std::string sval = dfa_utf8_decode(value.get_ptr(), value.getSize()); fprintf(stderr, " [%2.2d.%2.2d] Value: %s ('%s')\n", (int)i, (int)j, value.toString().c_str(), sval.c_str()); } } diff --git a/examples/direct_bt_scanner10/dbt_scanner10.cpp b/examples/direct_bt_scanner10/dbt_scanner10.cpp index 8a1f7087..bde839d8 100644 --- a/examples/direct_bt_scanner10/dbt_scanner10.cpp +++ b/examples/direct_bt_scanner10/dbt_scanner10.cpp @@ -26,6 +26,8 @@ #include <direct_bt/DirectBT.hpp> #include <cinttypes> +#include "direct_bt/dfa_utf8_decode.hpp" + extern "C" { #include <unistd.h> } @@ -299,7 +301,7 @@ static void processConnectedDevice(std::shared_ptr<DBTDevice> device) { if( serviceChar.hasProperties(GATTCharacteristic::PropertyBitVal::Read) ) { POctets value(GATTHandler::number(GATTHandler::Defaults::MAX_ATT_MTU), 0); if( serviceChar.readValue(value) ) { - std::string sval = decodeUTF8String(value.get_ptr(), value.getSize()); + std::string sval = dfa_utf8_decode(value.get_ptr(), value.getSize()); fprintf(stderr, " [%2.2d.%2.2d] Value: %s ('%s')\n", (int)i, (int)j, value.toString().c_str(), sval.c_str()); } } |