diff options
31 files changed, 147 insertions, 147 deletions
diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index e971596a..ff686cdf 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="197244231955084801" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="192916875957881685" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider> @@ -16,7 +16,7 @@ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="163195398642602173" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="121093181328885785" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider> @@ -27,7 +27,7 @@ <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/> <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/> <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/> - <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="197244231955084801" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> + <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="192916875957881685" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true"> <language-scope id="org.eclipse.cdt.core.gcc"/> <language-scope id="org.eclipse.cdt.core.g++"/> </provider> diff --git a/api/direct_bt/ATTPDUTypes.hpp b/api/direct_bt/ATTPDUTypes.hpp index 24424506..91c10dd1 100644 --- a/api/direct_bt/ATTPDUTypes.hpp +++ b/api/direct_bt/ATTPDUTypes.hpp @@ -542,13 +542,13 @@ namespace direct_bt { /** Persistent memory, w/ ownership ..*/ AttPDUMsg(const uint8_t* source, const jau::nsize_t size) - : pdu(source, std::max<jau::nsize_t>(1, size), jau::endian::little), + : pdu(source, std::max<jau::nsize_t>(1, size), jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) { } /** Persistent memory, w/ ownership ..*/ AttPDUMsg(const Opcode opc, const jau::nsize_t size) - : pdu(std::max<jau::nsize_t>(1, size), jau::endian::little), + : pdu(std::max<jau::nsize_t>(1, size), jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) { pdu.put_uint8_nc(0, number(opc)); @@ -1730,7 +1730,7 @@ namespace direct_bt { } void setElementValueUUID(const jau::nsize_t elementIdx, const jau::uuid_t& v) { uint8_t * b = getElementValuePtr(elementIdx); - v.put(b, 0, true /* littleEndian */); + v.put(b + 0, jau::lb_endian::little); } std::string getName() const noexcept override { @@ -1924,7 +1924,7 @@ namespace direct_bt { } void setElementValueUUID(const jau::nsize_t elementIdx, const jau::uuid_t& v) { uint8_t * b = pdu.get_wptr() + getElementPDUOffset(elementIdx) + 2 /* handle size */; - v.put(b, 0, true /* littleEndian */); + v.put(b + 0, jau::lb_endian::little); } std::string getName() const noexcept override { diff --git a/api/direct_bt/BTGattCmd.hpp b/api/direct_bt/BTGattCmd.hpp index 860b3a88..28f4cc2b 100644 --- a/api/direct_bt/BTGattCmd.hpp +++ b/api/direct_bt/BTGattCmd.hpp @@ -151,7 +151,7 @@ namespace direct_bt { cmd_uuid(&cmd_uuid_), rsp_uuid(&rsp_uuid_), dev(dev_), - rsp_data(rsp_capacity, 0 /* size */, jau::endian::little), + rsp_data(rsp_capacity, 0 /* size */, jau::lb_endian::little), cmdCharRef(nullptr), rspCharRef(nullptr), rspMinSize(0), @@ -181,7 +181,7 @@ namespace direct_bt { cmd_uuid(&cmd_uuid_), rsp_uuid(&rsp_uuid_), dev(dev_), - rsp_data(rsp_capacity, 0 /* size */, jau::endian::little), + rsp_data(rsp_capacity, 0 /* size */, jau::lb_endian::little), cmdCharRef(nullptr), rspCharRef(nullptr), rspMinSize(0), @@ -207,7 +207,7 @@ namespace direct_bt { cmd_uuid(&cmd_uuid_), rsp_uuid(nullptr), dev(dev_), - rsp_data(jau::endian::little), + rsp_data(jau::lb_endian::little), cmdCharRef(nullptr), rspCharRef(nullptr), rspMinSize(0), @@ -233,7 +233,7 @@ namespace direct_bt { cmd_uuid(&cmd_uuid_), rsp_uuid(nullptr), dev(dev_), - rsp_data(jau::endian::little), + rsp_data(jau::lb_endian::little), cmdCharRef(nullptr), rspCharRef(nullptr), rspMinSize(0), diff --git a/api/direct_bt/BTGattDesc.hpp b/api/direct_bt/BTGattDesc.hpp index 17234479..74b90c97 100644 --- a/api/direct_bt/BTGattDesc.hpp +++ b/api/direct_bt/BTGattDesc.hpp @@ -123,7 +123,7 @@ namespace direct_bt { BTGattDesc(const BTGattCharRef & characteristic, std::unique_ptr<const jau::uuid_t> && type_, const uint16_t handle_) noexcept : wbr_char(characteristic), type(std::move(type_)), handle(handle_), - value(jau::endian::little /* intentional zero sized */) + value(jau::lb_endian::little /* intentional zero sized */) { } std::string get_java_class() const noexcept override { diff --git a/api/direct_bt/BTSecurityRegistry.hpp b/api/direct_bt/BTSecurityRegistry.hpp index 12375ac0..609189c2 100644 --- a/api/direct_bt/BTSecurityRegistry.hpp +++ b/api/direct_bt/BTSecurityRegistry.hpp @@ -162,7 +162,7 @@ namespace direct_bt { */ inline Entry* getStartOf(const EUI48& addr, const std::string& name) noexcept { return get(addr, name, [](const EUI48& a, const std::string& n, const Entry& e)->bool { - return ( e.addrSub.length > 0 && 0 == a.indexOf(e.addrSub, jau::endian::big) ) || + return ( e.addrSub.length > 0 && 0 == a.indexOf(e.addrSub, jau::lb_endian::big) ) || ( e.nameSub.length() > 0 && 0 == n.find(e.nameSub) ); }); } @@ -175,7 +175,7 @@ namespace direct_bt { */ inline Entry* getStartOf(const EUI48Sub& addrSub, const std::string& name) noexcept { return get(addrSub, name, [](const EUI48Sub& as, const std::string& n, const Entry& e)->bool { - return ( e.addrSub.length > 0 && 0 == as.indexOf(e.addrSub, jau::endian::big) ) || + return ( e.addrSub.length > 0 && 0 == as.indexOf(e.addrSub, jau::lb_endian::big) ) || ( e.nameSub.length() > 0 && 0 == n.find(e.nameSub) ); }); } diff --git a/api/direct_bt/BTTypes0.hpp b/api/direct_bt/BTTypes0.hpp index e82c6fda..9dd8052d 100644 --- a/api/direct_bt/BTTypes0.hpp +++ b/api/direct_bt/BTTypes0.hpp @@ -962,7 +962,7 @@ namespace direct_bt { uint8_t const * data, int offset, int const size) noexcept; public: - EInfoReport() noexcept : hash(16, 0, jau::endian::little), randomizer(16, 0, jau::endian::little) {} + EInfoReport() noexcept : hash(16, 0, jau::lb_endian::little), randomizer(16, 0, jau::lb_endian::little) {} EInfoReport(const EInfoReport&) = default; EInfoReport& operator=(const EInfoReport &o) = default; diff --git a/api/direct_bt/DBGattServer.hpp b/api/direct_bt/DBGattServer.hpp index d24f34df..a4e4b974 100644 --- a/api/direct_bt/DBGattServer.hpp +++ b/api/direct_bt/DBGattServer.hpp @@ -206,7 +206,7 @@ namespace direct_bt { * @see isClientCharConfig() */ static std::shared_ptr<DBGattDesc> createClientCharConfig() { - jau::POctets p( 2, jau::endian::little); + jau::POctets p( 2, jau::lb_endian::little); p.put_uint16_nc(0, 0); return std::make_shared<DBGattDesc>( BTGattDesc::TYPE_CCC_DESC, std::move(p), false /* variable_length */ ); } @@ -504,13 +504,13 @@ namespace direct_bt { /** Convenience jau::POctets ctor function to create DBGattChar or DBGattDesc values. */ inline jau::POctets make_gvalue(const char* name) { - return jau::POctets( (const uint8_t*)name, (jau::nsize_t)strlen(name), jau::endian::little ); + return jau::POctets( (const uint8_t*)name, (jau::nsize_t)strlen(name), jau::lb_endian::little ); } /** Convenience jau::POctets ctor function to create DBGattChar or DBGattDesc values. */ inline jau::POctets make_gvalue(const char* name, const jau::nsize_t capacity) { const jau::nsize_t name_len = (jau::nsize_t)strlen(name); - jau::POctets p( std::max<jau::nsize_t>(capacity, name_len), name_len, jau::endian::little ); + jau::POctets p( std::max<jau::nsize_t>(capacity, name_len), name_len, jau::lb_endian::little ); p.bzero(); p.put_bytes_nc(0, reinterpret_cast<const uint8_t*>(name), name_len); return p; @@ -518,26 +518,26 @@ namespace direct_bt { /** Convenience jau::POctets ctor function to create DBGattChar or DBGattDesc values. */ inline jau::POctets make_gvalue(const uint16_t v) { - jau::POctets p(2, jau::endian::little); + jau::POctets p(2, jau::lb_endian::little); p.put_uint16_nc(0, v); return p; } /** Convenience jau::POctets ctor function to create DBGattChar or DBGattDesc values. */ inline jau::POctets make_gvalue(const jau::nsize_t capacity, const jau::nsize_t size) { - jau::POctets p(capacity, size, jau::endian::little); + jau::POctets p(capacity, size, jau::lb_endian::little); p.bzero(); 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); + return jau::POctets(sourcelist, jau::lb_endian::little); } /** Convenience jau::POctets ctor function to create DBGattChar or DBGattDesc values. */ inline jau::POctets make_gvalue(const jau::nsize_t capacity, const jau::nsize_t size, std::initializer_list<uint8_t> sourcelist) { - jau::POctets p(capacity, size, jau::endian::little); + jau::POctets p(capacity, size, jau::lb_endian::little); p.bzero(); const jau::nsize_t max_size = std::min(size, sourcelist.size()); if( 0 < max_size ) { diff --git a/api/direct_bt/GattNumbers.hpp b/api/direct_bt/GattNumbers.hpp index c6ba3888..67d8a183 100644 --- a/api/direct_bt/GattNumbers.hpp +++ b/api/direct_bt/GattNumbers.hpp @@ -405,7 +405,7 @@ class GattTemperatureMeasurement { static std::shared_ptr<GattTemperatureMeasurement> get(const jau::TROOctets &source) noexcept; static std::shared_ptr<GattTemperatureMeasurement> get(const jau::TOctetSlice &source) noexcept { - const jau::TROOctets o(source.get_ptr(0), source.size(), jau::endian::little); + const jau::TROOctets o(source.get_ptr(0), source.size(), jau::lb_endian::little); return get(o); } diff --git a/api/direct_bt/HCITypes.hpp b/api/direct_bt/HCITypes.hpp index dd42a388..5972afc0 100644 --- a/api/direct_bt/HCITypes.hpp +++ b/api/direct_bt/HCITypes.hpp @@ -558,7 +558,7 @@ namespace direct_bt { public: HCIPacket(const HCIPacketType type, const jau::nsize_t total_packet_size) - : pdu(total_packet_size, jau::endian::little) + : pdu(total_packet_size, jau::lb_endian::little) { if( 0 == total_packet_size ) { throw jau::IndexOutOfBoundsException(1, total_packet_size, E_FILE_LINE); @@ -568,7 +568,7 @@ namespace direct_bt { /** Persistent memory, w/ ownership ..*/ HCIPacket(const uint8_t *packet_data, const jau::nsize_t total_packet_size) - : pdu(packet_data, total_packet_size, jau::endian::little) + : pdu(packet_data, total_packet_size, jau::lb_endian::little) { if( 0 == total_packet_size ) { throw jau::IndexOutOfBoundsException(1, total_packet_size, E_FILE_LINE); diff --git a/api/direct_bt/MgmtTypes.hpp b/api/direct_bt/MgmtTypes.hpp index b563a824..ce98f0d4 100644 --- a/api/direct_bt/MgmtTypes.hpp +++ b/api/direct_bt/MgmtTypes.hpp @@ -358,14 +358,14 @@ namespace direct_bt { public: static uint16_t getIntOpcode(const uint8_t * buffer) { - return jau::get_uint16(buffer, 0, true /* littleEndian */); + return jau::get_uint16(buffer + 0, jau::lb_endian::little); } static uint16_t getDevID(const uint8_t *data) { - return jau::get_uint16(data, 2, true /* littleEndian */); + return jau::get_uint16(data + 2, jau::lb_endian::little); } MgmtMsg(const uint16_t opc, const uint16_t dev_id, const uint16_t param_size) - : pdu(MGMT_HEADER_SIZE+param_size, jau::endian::little), + : pdu(MGMT_HEADER_SIZE+param_size, jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) { pdu.put_uint16_nc(0, opc); @@ -374,7 +374,7 @@ namespace direct_bt { } MgmtMsg(const uint8_t* buffer, const jau::nsize_t buffer_len) - : pdu(buffer, buffer_len, jau::endian::little), + : pdu(buffer, buffer_len, jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) {} @@ -968,7 +968,7 @@ namespace direct_bt { const EUI48& getAddress() const noexcept { return *reinterpret_cast<const EUI48 *>( pdu.get_ptr_nc(MGMT_HEADER_SIZE + 0) ); } // mgmt_addr_info BDAddressType getAddressType() const noexcept { return static_cast<BDAddressType>(pdu.get_uint8_nc(MGMT_HEADER_SIZE+6)); } // mgmt_addr_info uint8_t getPinLength() const noexcept { return pdu.get_uint8_nc(MGMT_HEADER_SIZE+6+1); } - jau::TROOctets getPinCode() const noexcept { return jau::POctets(pdu.get_ptr_nc(MGMT_HEADER_SIZE+6+1+1), getPinLength(), jau::endian::little); } + jau::TROOctets getPinCode() const noexcept { return jau::POctets(pdu.get_ptr_nc(MGMT_HEADER_SIZE+6+1+1), getPinLength(), jau::lb_endian::little); } }; /** @@ -1286,13 +1286,13 @@ namespace direct_bt { static MgmtDefaultParam read(const uint8_t* data, const jau::nsize_t length) noexcept; MgmtDefaultParam() noexcept - : type(Type::NONE), value(0, jau::endian::little) {} + : type(Type::NONE), value(0, jau::lb_endian::little) {} MgmtDefaultParam(const Type type_) noexcept - : type(type_), value(0, jau::endian::little) {} + : type(type_), value(0, jau::lb_endian::little) {} MgmtDefaultParam(const Type type_, const uint16_t value_) noexcept - : type(type_), value( to_size(type_) == 2 ? 2 : 0, jau::endian::little) { + : type(type_), value( to_size(type_) == 2 ? 2 : 0, jau::lb_endian::little) { if( 2 == value.size() ) { value.put_uint16_nc(0, value_); } @@ -1489,7 +1489,7 @@ namespace direct_bt { public: static MgmtEvent::Opcode getOpcode(const uint8_t * buffer) { - return static_cast<MgmtEvent::Opcode>( jau::get_uint16(buffer, 0, true /* littleEndian */) ); + return static_cast<MgmtEvent::Opcode>( jau::get_uint16(buffer + 0, jau::lb_endian::little) ); } /** @@ -1590,10 +1590,10 @@ namespace direct_bt { public: static MgmtCommand::Opcode getCmdOpcode(const uint8_t *data) { - return static_cast<MgmtCommand::Opcode>( jau::get_uint16(data, MGMT_HEADER_SIZE, true /* littleEndian */) ); + return static_cast<MgmtCommand::Opcode>( jau::get_uint16(data + MGMT_HEADER_SIZE, jau::lb_endian::little) ); } static MgmtStatus getStatus(const uint8_t *data) { - return static_cast<MgmtStatus>( jau::get_uint8(data, MGMT_HEADER_SIZE+2) ); + return static_cast<MgmtStatus>( jau::get_uint8(data + MGMT_HEADER_SIZE+2) ); } MgmtEvtCmdComplete(const uint8_t* buffer, const jau::nsize_t buffer_len) @@ -2416,7 +2416,7 @@ namespace direct_bt { (void)buffer_len; const MgmtStatus status = MgmtEvtCmdComplete::getStatus(buffer); const EUI48& address = *reinterpret_cast<const EUI48 *>( buffer + MGMT_HEADER_SIZE + 3 + 0 ); // mgmt_addr_info - const BDAddressType addressType = static_cast<BDAddressType>( jau::get_uint8(buffer, MGMT_HEADER_SIZE + 3 + 6) ); // mgmt_addr_info + const BDAddressType addressType = static_cast<BDAddressType>( jau::get_uint8(buffer + MGMT_HEADER_SIZE + 3 + 6) ); // mgmt_addr_info pdu.put_eui48_nc(MGMT_HEADER_SIZE, address); pdu.put_uint8_nc(MGMT_HEADER_SIZE+6, direct_bt::number(addressType)); diff --git a/api/direct_bt/SMPTypes.hpp b/api/direct_bt/SMPTypes.hpp index ac3f5b4e..8cb99bb0 100644 --- a/api/direct_bt/SMPTypes.hpp +++ b/api/direct_bt/SMPTypes.hpp @@ -918,13 +918,13 @@ namespace direct_bt { /** Persistent memory, w/ ownership ..*/ SMPPDUMsg(const uint8_t* source, const jau::nsize_t size) - : pdu(source, std::max<jau::nsize_t>(1, size), jau::endian::little), + : pdu(source, std::max<jau::nsize_t>(1, size), jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) { } /** Persistent memory, w/ ownership ..*/ SMPPDUMsg(const uint8_t* source, const jau::nsize_t size, const jau::nsize_t min_size) - : pdu(source, std::max<jau::nsize_t>(1, size), jau::endian::little), + : pdu(source, std::max<jau::nsize_t>(1, size), jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) { pdu.check_range(0, std::max<jau::nsize_t>(1, min_size), E_FILE_LINE); @@ -932,7 +932,7 @@ namespace direct_bt { /** Persistent memory, w/ ownership ..*/ SMPPDUMsg(const Opcode opc, const jau::nsize_t size) - : pdu(std::max<jau::nsize_t>(1, size), jau::endian::little), + : pdu(std::max<jau::nsize_t>(1, size), jau::lb_endian::little), ts_creation(jau::getCurrentMilliseconds()) { pdu.put_uint8_nc(0, number(opc)); @@ -1256,7 +1256,7 @@ namespace direct_bt { SMPPairConfirmMsg(const jau::uint128dp_t & confirm_value) : SMPEncKeyByteStream(Opcode::PAIRING_CONFIRM, 1+16) { - jau::put_uint128(pdu.get_wptr(), 1, confirm_value); + jau::put_uint128(pdu.get_wptr() + 1, confirm_value); check_range(); } @@ -1277,7 +1277,7 @@ namespace direct_bt { * See Vol 3, Part H, 2.3.5.6 SM - Pairing algo - LE Secure Connections pairing phase 2. * </p> */ - constexpr jau::uint128dp_t getConfirmValue() const noexcept { return jau::get_uint128(pdu.get_ptr(), 1); } + constexpr jau::uint128dp_t getConfirmValue() const noexcept { return jau::get_uint128(pdu.get_ptr() + 1); } std::string getName() const noexcept override { return "SMPPairConfirm"; @@ -1353,7 +1353,7 @@ namespace direct_bt { SMPPairRandMsg(const jau::uint128dp_t & random_value) : SMPEncKeyByteStream(Opcode::PAIRING_RANDOM, 1+16) { - jau::put_uint128(pdu.get_wptr(), 1, random_value); + jau::put_uint128(pdu.get_wptr() + 1, random_value); check_range(); } @@ -1373,7 +1373,7 @@ namespace direct_bt { * the initiating device sends Na and the responding device sends Nb. * </p> */ - constexpr jau::uint128dp_t getRand() const noexcept { return jau::get_uint128(pdu.get_ptr(), 1); } + constexpr jau::uint128dp_t getRand() const noexcept { return jau::get_uint128(pdu.get_ptr() + 1); } std::string getName() const noexcept override { return "SMPPairRand"; @@ -1493,8 +1493,8 @@ namespace direct_bt { SMPPairPubKeyMsg(const jau::uint256dp_t & pub_key_x, const jau::uint256dp_t & pub_key_y) : SMPEncKeyByteStream(Opcode::PAIRING_PUBLIC_KEY, 1+32+32) { - jau::put_uint256(pdu.get_wptr(), 1, pub_key_x); - jau::put_uint256(pdu.get_wptr(), 1+32, pub_key_y); + jau::put_uint256(pdu.get_wptr() + 1, pub_key_x); + jau::put_uint256(pdu.get_wptr() + 1+32, pub_key_y); check_range(); } @@ -1505,12 +1505,12 @@ namespace direct_bt { /** * Returns the 256-bit Public Key X value (32 octets) */ - constexpr jau::uint256dp_t getPubKeyX() const noexcept { return jau::get_uint256(pdu.get_ptr(), 1); } + constexpr jau::uint256dp_t getPubKeyX() const noexcept { return jau::get_uint256(pdu.get_ptr() + 1); } /** * Returns the 256-bit Public Key Y value (32 octets) */ - constexpr jau::uint256dp_t getPubKeyY() const noexcept { return jau::get_uint256(pdu.get_ptr(), 1+32); } + constexpr jau::uint256dp_t getPubKeyY() const noexcept { return jau::get_uint256(pdu.get_ptr() + 1+32); } std::string getName() const noexcept override { return "SMPPairPubKey"; @@ -1559,7 +1559,7 @@ namespace direct_bt { SMPPairDHKeyCheckMsg(const jau::uint128dp_t & dhkey_check_values) : SMPEncKeyByteStream(Opcode::PAIRING_DHKEY_CHECK, 1+16) { - jau::put_uint128(pdu.get_wptr(), 1, dhkey_check_values); + jau::put_uint128(pdu.get_wptr() + 1, dhkey_check_values); check_range(); } @@ -1570,7 +1570,7 @@ namespace direct_bt { /** * Returns the 128-bit DHKey Check value (16 octets) */ - constexpr jau::uint128dp_t getDHKeyCheck() const noexcept { return jau::get_uint128(pdu.get_ptr(), 1); } + constexpr jau::uint128dp_t getDHKeyCheck() const noexcept { return jau::get_uint128(pdu.get_ptr() + 1); } std::string getName() const noexcept override { return "SMPPairDHKeyCheck"; @@ -1688,7 +1688,7 @@ namespace direct_bt { SMPEncInfoMsg(const jau::uint128dp_t & long_term_key) : SMPEncKeyByteStream(Opcode::ENCRYPTION_INFORMATION, 1+16) { - jau::put_uint128(pdu.get_wptr(), 1, long_term_key); + jau::put_uint128(pdu.get_wptr() + 1, long_term_key); check_range(); } @@ -1703,7 +1703,7 @@ namespace direct_bt { * see Vol 3, Part H, 2.4.2.3 SM - LE legacy pairing - generation of LTK, EDIV and Rand. * </p> */ - constexpr jau::uint128dp_t getLTK() const noexcept { return jau::get_uint128(pdu.get_ptr(), 1); } + constexpr jau::uint128dp_t getLTK() const noexcept { return jau::get_uint128(pdu.get_ptr() + 1); } std::string getName() const noexcept override { return "SMPEncInfo"; @@ -1759,8 +1759,8 @@ namespace direct_bt { SMPMasterIdentMsg(const uint16_t ediv, const uint64_t & rand) : SMPEncKeyByteStream(Opcode::MASTER_IDENTIFICATION, 1+2+8) { - jau::put_uint16(pdu.get_wptr(), 1, ediv); - jau::put_uint64(pdu.get_wptr(), 1+2, rand); + jau::put_uint16(pdu.get_wptr() + 1, ediv); + jau::put_uint64(pdu.get_wptr() + 1+2, rand); check_range(); } @@ -1774,7 +1774,7 @@ namespace direct_bt { * See Vol 3, Part H, 2.4.2.3 SM - Generation of CSRK - LE legacy pairing - generation of LTK, EDIV and Rand. * </p> */ - constexpr uint16_t getEDIV() const noexcept { return jau::get_uint16(pdu.get_ptr(), 1); } + constexpr uint16_t getEDIV() const noexcept { return jau::get_uint16(pdu.get_ptr() + 1); } /** * Returns the 64-bit Rand value (8 octets) being distributed @@ -1782,7 +1782,7 @@ namespace direct_bt { * See Vol 3, Part H, 2.4.2.3 SM - Generation of CSRK - LE legacy pairing - generation of LTK, EDIV and Rand. * </p> */ - constexpr uint64_t getRand() const noexcept { return jau::get_uint64(pdu.get_ptr(), 1+2); } + constexpr uint64_t getRand() const noexcept { return jau::get_uint64(pdu.get_ptr() + 1+2); } std::string getName() const noexcept override { return "SMPMasterIdent"; @@ -1839,7 +1839,7 @@ namespace direct_bt { SMPIdentInfoMsg(const jau::uint128dp_t & identity_resolving_key) : SMPEncKeyByteStream(Opcode::IDENTITY_INFORMATION, 1+16) { - jau::put_uint128(pdu.get_wptr(), 1, identity_resolving_key); + jau::put_uint128(pdu.get_wptr() + 1, identity_resolving_key); check_range(); } @@ -1854,7 +1854,7 @@ namespace direct_bt { * see Vol 3, Part H, 2.4.2.1 SM - Definition of keys and values - Generation of IRK. * </p> */ - constexpr jau::uint128dp_t getIRK() const noexcept { return jau::get_uint128(pdu.get_ptr(), 1); } + constexpr jau::uint128dp_t getIRK() const noexcept { return jau::get_uint128(pdu.get_ptr() + 1); } std::string getName() const noexcept override { return "SMPIdentInfo"; @@ -1979,7 +1979,7 @@ namespace direct_bt { SMPSignInfoMsg(const jau::uint128dp_t & signature_key) : SMPEncKeyByteStream(Opcode::SIGNING_INFORMATION, 1+16) { - jau::put_uint128(pdu.get_wptr(), 1, signature_key); + jau::put_uint128(pdu.get_wptr() + 1, signature_key); check_range(); } @@ -1994,7 +1994,7 @@ namespace direct_bt { * see Vol 3, Part H, 2.4.2.2 SM - Definition of keys and values - Generation of CSRK. * </p> */ - constexpr jau::uint128dp_t getCSRK() const noexcept { return jau::get_uint128(pdu.get_ptr(), 1); } + constexpr jau::uint128dp_t getCSRK() const noexcept { return jau::get_uint128(pdu.get_ptr() + 1); } std::string getName() const noexcept override { return "SMPSignInfo"; diff --git a/examples/dbt_labpadclient01.cpp b/examples/dbt_labpadclient01.cpp index f051e61a..aaacae9e 100644 --- a/examples/dbt_labpadclient01.cpp +++ b/examples/dbt_labpadclient01.cpp @@ -99,16 +99,16 @@ static std::unique_ptr<uuid_t> cmd_rsp_uuid = jau::uuid_t::create(std::string("2 static const POctets cmd_data1( { 0x00 /* cmd-idx-0 */, 0x14, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x5E, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, - 0x9B, 0x23, 0x84 }, endian::little); + 0x9B, 0x23, 0x84 }, lb_endian::little); static const POctets cmd_data2( { 0x01 /* cmd-idx-1 */, - 0xB8 }, endian::little); + 0xB8 }, lb_endian::little); static const POctets resp_exp( { 0x00 /* rsp-idx-0 */, 0x14, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x01, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0x64, 0x17, - 0x01 /* rsp-idx-1 */, 0xed }, endian::little ); + 0x01 /* rsp-idx-1 */, 0xed }, lb_endian::little ); static bool SHOW_UPDATE_EVENTS = false; static bool QUIET = false; @@ -562,7 +562,7 @@ static void processReadyDevice(const BTDeviceRef& device) { fprintf_td(stderr, " [%2.2d.%2.2d] %s\n", i, j, serviceChar->toString().c_str()); } if( serviceChar->hasProperties(BTGattChar::PropertyBitVal::Read) ) { - POctets value(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::endian::little); + POctets value(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::lb_endian::little); if( serviceChar->readValue(value) ) { std::string sval = dfa_utf8_decode(value.get_ptr(), value.size()); { diff --git a/examples/dbt_peripheral00.cpp b/examples/dbt_peripheral00.cpp index 6740ab3a..a2d18305 100644 --- a/examples/dbt_peripheral00.cpp +++ b/examples/dbt_peripheral00.cpp @@ -366,7 +366,7 @@ class MyGATTServerListener : public DBGattServer::Listener { if( nullptr != connectedDevice_ && connectedDevice_->getConnected() ) { if( 0 != handlePulseDataNotify || 0 != handlePulseDataIndicate ) { std::string data( "Dynamic Data Example. Elapsed Milliseconds: "+jau::to_decstring(environment::getElapsedMillisecond(), ',', 9) ); - jau::POctets v(data.size()+1, jau::endian::little); + jau::POctets v(data.size()+1, jau::lb_endian::little); v.put_string_nc(0, data, v.size(), true /* includeEOS */); if( 0 != handlePulseDataNotify ) { const bool res = connectedDevice_->sendNotification(handlePulseDataNotify, v); diff --git a/examples/dbt_scanner10.cpp b/examples/dbt_scanner10.cpp index 298e7e1b..9d80c261 100644 --- a/examples/dbt_scanner10.cpp +++ b/examples/dbt_scanner10.cpp @@ -471,7 +471,7 @@ static void processReadyDevice(const BTDeviceRef& device) { cmd.setVerbose(true); const bool cmd_resolved = cmd.isResolved(); fprintf_td(stderr, "Command test: %s, resolved %d\n", cmd.toString().c_str(), cmd_resolved); - POctets cmd_data(1, endian::little); + POctets cmd_data(1, lb_endian::little); cmd_data.put_uint8_nc(0, cmd_arg); const HCIStatusCode cmd_res = cmd.send(true /* prefNoAck */, cmd_data, 3_s); if( HCIStatusCode::SUCCESS == cmd_res ) { @@ -523,7 +523,7 @@ static void processReadyDevice(const BTDeviceRef& device) { fprintf_td(stderr, " [%2.2d.%2.2d] %s\n", i, j, serviceChar->toString().c_str()); } if( serviceChar->hasProperties(BTGattChar::PropertyBitVal::Read) ) { - POctets value(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::endian::little); + POctets value(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::lb_endian::little); if( serviceChar->readValue(value) ) { std::string sval = dfa_utf8_decode(value.get_ptr(), value.size()); { diff --git a/jaulib b/jaulib -Subproject d658b6059d7e7513b60c5c67019b76c9cd3f809 +Subproject 30efb270f1fcc3841adaf9cfca7333ad41a6465 diff --git a/java/jni/direct_bt/DBGattServer.cxx b/java/jni/direct_bt/DBGattServer.cxx index d3824c7e..8fcd66d4 100644 --- a/java/jni/direct_bt/DBGattServer.cxx +++ b/java/jni/direct_bt/DBGattServer.cxx @@ -140,7 +140,7 @@ jlong Java_org_direct_1bt_DBGattDesc_ctorImpl(JNIEnv *env, jobject obj, JNIGlobalRef global_obj(obj); // lock instance first (global reference), inserted below // POctets value - jau::POctets value(jcapacity_, env->GetArrayLength(jvalue_), jau::endian::little); + jau::POctets value(jcapacity_, env->GetArrayLength(jvalue_), jau::lb_endian::little); if( 0 < value.size() ) { JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release const uint8_t * value_ptr = criticalArray.get(jvalue_, criticalArray.Mode::NO_UPDATE_AND_RELEASE); @@ -283,7 +283,7 @@ jlong Java_org_direct_1bt_DBGattChar_ctorImpl(JNIEnv *env, jobject obj, JNIGlobalRef global_obj(obj); // lock instance first (global reference), inserted below // POctets value - jau::POctets value(jcapacity_, env->GetArrayLength(jvalue_), jau::endian::little); + jau::POctets value(jcapacity_, env->GetArrayLength(jvalue_), jau::lb_endian::little); if( 0 < value.size() ) { JNICriticalArray<uint8_t, jbyteArray> criticalArray(env); // RAII - release const uint8_t * value_ptr = criticalArray.get(jvalue_, criticalArray.Mode::NO_UPDATE_AND_RELEASE); diff --git a/java/jni/direct_bt/DBTDevice.cxx b/java/jni/direct_bt/DBTDevice.cxx index 353b534f..b3b74d63 100644 --- a/java/jni/direct_bt/DBTDevice.cxx +++ b/java/jni/direct_bt/DBTDevice.cxx @@ -1009,7 +1009,7 @@ jboolean Java_jau_direct_1bt_DBTDevice_sendNotification(JNIEnv *env, jobject obj if( nullptr == value_ptr ) { throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE); } - const jau::TROOctets value(value_ptr, value_size, jau::endian::little); + const jau::TROOctets value(value_ptr, value_size, jau::lb_endian::little); return device->sendNotification(char_value_handle, value) ? JNI_TRUE : JNI_FALSE; } catch(...) { rethrow_and_raise_java_exception(env); @@ -1035,7 +1035,7 @@ jboolean Java_jau_direct_1bt_DBTDevice_sendIndication(JNIEnv *env, jobject obj, if( nullptr == value_ptr ) { throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE); } - const jau::TROOctets value(value_ptr, value_size, jau::endian::little); + const jau::TROOctets value(value_ptr, value_size, jau::lb_endian::little); return device->sendIndication(char_value_handle, value) ? JNI_TRUE : JNI_FALSE; } catch(...) { rethrow_and_raise_java_exception(env); diff --git a/java/jni/direct_bt/DBTGattChar.cxx b/java/jni/direct_bt/DBTGattChar.cxx index eb216c05..5471ed5e 100644 --- a/java/jni/direct_bt/DBTGattChar.cxx +++ b/java/jni/direct_bt/DBTGattChar.cxx @@ -122,7 +122,7 @@ jbyteArray Java_jau_direct_1bt_DBTGattChar_readValueImpl(JNIEnv *env, jobject ob JavaAnonRef characteristic_java = characteristic->getJavaObject(); // hold until done! JavaGlobalObj::check(characteristic_java, E_FILE_LINE); - jau::POctets res(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::endian::little); + jau::POctets res(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::lb_endian::little); if( !characteristic->readValue(res) ) { ERR_PRINT("Characteristic readValue failed: %s", characteristic->toString().c_str()); return env->NewByteArray((jsize)0); @@ -159,7 +159,7 @@ jboolean Java_jau_direct_1bt_DBTGattChar_writeValueImpl(JNIEnv *env, jobject obj if( nullptr == value_ptr ) { throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE); } - jau::TROOctets value(value_ptr, value_size, jau::endian::little); + jau::TROOctets value(value_ptr, value_size, jau::lb_endian::little); bool res; if( withResponse ) { res = characteristic->writeValue(value); diff --git a/java/jni/direct_bt/DBTGattDesc.cxx b/java/jni/direct_bt/DBTGattDesc.cxx index 48aee220..996bd246 100644 --- a/java/jni/direct_bt/DBTGattDesc.cxx +++ b/java/jni/direct_bt/DBTGattDesc.cxx @@ -103,7 +103,7 @@ jboolean Java_jau_direct_1bt_DBTGattDesc_writeValueImpl(JNIEnv *env, jobject obj if( nullptr == value_ptr ) { throw jau::InternalError("GetPrimitiveArrayCritical(byte array) is null", E_FILE_LINE); } - jau::TROOctets value(value_ptr, value_size, jau::endian::little); + jau::TROOctets value(value_ptr, value_size, jau::lb_endian::little); descriptor->value = value; // copy data if( !descriptor->writeValue() ) { diff --git a/src/direct_bt/BTGattHandler.cpp b/src/direct_bt/BTGattHandler.cpp index 9ebf5445..e7eeb90a 100644 --- a/src/direct_bt/BTGattHandler.cpp +++ b/src/direct_bt/BTGattHandler.cpp @@ -600,7 +600,7 @@ BTGattHandler::BTGattHandler(const BTDeviceRef &device, L2CAPClient& l2cap_att, role(device->getLocalGATTRole()), l2cap(l2cap_att), deviceString(device->getAddressAndType().address.toString()), - rbuffer(number(Defaults::MAX_ATT_MTU), jau::endian::little), + rbuffer(number(Defaults::MAX_ATT_MTU), jau::lb_endian::little), is_connected(l2cap.is_open()), has_ioerror(false), l2cap_reader_service("GATTHandler::reader_"+deviceString, THREAD_SHUTDOWN_TIMEOUT_MS, jau::bind_member(this, &BTGattHandler::l2capReaderWork), @@ -1430,7 +1430,7 @@ static const jau::uuid16_t _PNP_ID(GattCharacteristicType::PNP_ID); std::shared_ptr<GattGenericAccessSvc> BTGattHandler::getGenericAccess(jau::darray<BTGattCharRef> & genericAccessCharDeclList) noexcept { std::shared_ptr<GattGenericAccessSvc> res = nullptr; - jau::POctets value(number(Defaults::MAX_ATT_MTU), 0, jau::endian::little); + jau::POctets value(number(Defaults::MAX_ATT_MTU), 0, jau::lb_endian::little); std::string deviceName = ""; AppearanceCat appearance = AppearanceCat::UNKNOWN; std::shared_ptr<GattPeriphalPreferredConnectionParameters> prefConnParam = nullptr; @@ -1479,7 +1479,7 @@ bool BTGattHandler::ping() noexcept { for(size_t i=0; readOK && i<services.size(); i++) { jau::darray<BTGattCharRef> & genericAccessCharDeclList = services.at(i)->characteristicList; - jau::POctets value(32, 0, jau::endian::little); + jau::POctets value(32, 0, jau::lb_endian::little); for(size_t j=0; readOK && j<genericAccessCharDeclList.size(); j++) { const BTGattChar & charDecl = *genericAccessCharDeclList.at(j); @@ -1507,16 +1507,16 @@ bool BTGattHandler::ping() noexcept { std::shared_ptr<GattDeviceInformationSvc> BTGattHandler::getDeviceInformation(jau::darray<BTGattCharRef> & characteristicDeclList) noexcept { std::shared_ptr<GattDeviceInformationSvc> res = nullptr; - jau::POctets value(number(Defaults::MAX_ATT_MTU), 0, jau::endian::little); + jau::POctets value(number(Defaults::MAX_ATT_MTU), 0, jau::lb_endian::little); - jau::POctets systemID(8, 0, jau::endian::little); + jau::POctets systemID(8, 0, jau::lb_endian::little); std::string modelNumber; std::string serialNumber; std::string firmwareRevision; std::string hardwareRevision; std::string softwareRevision; std::string manufacturer; - jau::POctets regulatoryCertDataList(128, 0, jau::endian::little); + jau::POctets regulatoryCertDataList(128, 0, jau::lb_endian::little); std::shared_ptr<GattPnP_ID> pnpID = nullptr; bool found = false; diff --git a/src/direct_bt/BTGattServerHandler.cpp b/src/direct_bt/BTGattServerHandler.cpp index c4a65b9b..2d3bb776 100644 --- a/src/direct_bt/BTGattServerHandler.cpp +++ b/src/direct_bt/BTGattServerHandler.cpp @@ -835,7 +835,7 @@ class DBGattServerHandler : public BTGattHandler::GattServerHandler { ePDUOffset += 1; rsp.pdu.put_uint16_nc(ePDUOffset, c->getValueHandle()); // Characteristics Value Handle ePDUOffset += 2; - c->getValueType()->put(rsp.pdu.get_wptr_nc(ePDUOffset), 0, true /* littleEndian */); // Characteristics Value Type UUID + c->getValueType()->put(rsp.pdu.get_wptr_nc(ePDUOffset) + 0, jau::lb_endian::little); // Characteristics Value Type UUID ePDUOffset += c->getValueType()->getTypeSizeInt(); rspSize += size; ++rspCount; @@ -1070,7 +1070,7 @@ class FwdGattServerHandler : public BTGattHandler::GattServerHandler { const AttExeWriteReq * req = static_cast<const AttExeWriteReq*>(pdu); if( 0x01 == req->getFlags() ) { // immediately write all pending prepared values for( auto iter_handle = writeDataQueueHandles.cbegin(); iter_handle < writeDataQueueHandles.cend(); ++iter_handle ) { - const jau::endian byte_order = writeDataQueue.size() > 0 ? writeDataQueue[0].getValue().byte_order() : jau::endian::little; + const jau::lb_endian byte_order = writeDataQueue.size() > 0 ? writeDataQueue[0].getValue().byte_order() : jau::lb_endian::little; jau::POctets data(256, 0, byte_order); // same byte order across all requests BTGattHandler::NativeGattCharSections_t sections; for( auto iter_prep_write = writeDataQueue.cbegin(); iter_prep_write < writeDataQueue.cend(); ++iter_prep_write ) { diff --git a/src/direct_bt/BTManager.cpp b/src/direct_bt/BTManager.cpp index a04269d0..1c8ae585 100644 --- a/src/direct_bt/BTManager.cpp +++ b/src/direct_bt/BTManager.cpp @@ -92,7 +92,7 @@ void BTManager::mgmtReaderWork(jau::service_runner& sr) noexcept { const jau::nsize_t len2 = static_cast<jau::nsize_t>(len); const jau::nsize_t paramSize = len2 >= MGMT_HEADER_SIZE ? rbuffer.get_uint16_nc(4) : 0; if( len2 < MGMT_HEADER_SIZE + paramSize ) { - WARN_PRINT("BTManager::reader: length mismatch %zu < MGMT_HEADER_SIZE(%u) + %u", len2, MGMT_HEADER_SIZE, paramSize); + WARN_PRINT("BTManager::reader: length mismatch %zu < MGMT_HEADER_SIZE(%u) + %u, %s", len2, MGMT_HEADER_SIZE, paramSize, rbuffer.toString().c_str()); return; // discard data } std::unique_ptr<MgmtEvent> event = MgmtEvent::getSpecialized(rbuffer.get_ptr(), len2); @@ -378,7 +378,7 @@ fail: BTManager::BTManager() noexcept : env(MgmtEnv::get()), - rbuffer(ClientMaxMTU, jau::endian::little), comm(HCI_DEV_NONE, HCI_CHANNEL_CONTROL), + rbuffer(ClientMaxMTU, jau::lb_endian::little), comm(HCI_DEV_NONE, HCI_CHANNEL_CONTROL), mgmt_reader_service("HCIHandler::reader", THREAD_SHUTDOWN_TIMEOUT_MS, jau::bind_member(this, &BTManager::mgmtReaderWork), jau::service_runner::Callback() /* init */, @@ -415,7 +415,7 @@ bool BTManager::initialize(const std::shared_ptr<BTManager>& self) noexcept { } const uint8_t *data = res->getData(); const uint8_t version = data[0]; - const uint16_t revision = jau::get_uint16(data, 1, true /* littleEndian */); + const uint16_t revision = jau::get_uint16(data + 1, jau::lb_endian::little); WORDY_PRINT("Bluetooth version %d.%d", version, revision); if( version < 1 ) { ERR_PRINT("Bluetooth version >= 1.0 required"); @@ -431,14 +431,14 @@ bool BTManager::initialize(const std::shared_ptr<BTManager>& self) noexcept { } if( MgmtEvent::Opcode::CMD_COMPLETE == res->getOpcode() && res->getDataSize() >= 4) { const uint8_t *data = res->getData(); - const uint16_t num_commands = jau::get_uint16(data, 0, true /* littleEndian */); - const uint16_t num_events = jau::get_uint16(data, 2, true /* littleEndian */); + const uint16_t num_commands = jau::get_uint16(data + 0, jau::lb_endian::little); + const uint16_t num_events = jau::get_uint16(data + 2, jau::lb_endian::little); WORDY_PRINT("Bluetooth %d commands, %d events", num_commands, num_events); #ifdef VERBOSE_ON const int expDataSize = 4 + num_commands * 2 + num_events * 2; if( res->getDataSize() >= expDataSize ) { for(int i=0; i< num_commands; i++) { - const MgmtCommand::Opcode op = static_cast<MgmtCommand::Opcode>( get_uint16(data, 4+i*2, true /* littleEndian */) ); + const MgmtCommand::Opcode op = static_cast<MgmtCommand::Opcode>( get_uint16(data, 4+i*2, jau::lb_endian::little) ); DBG_PRINT("kernel op %d: %s", i, toString(op).c_str()); } } @@ -459,7 +459,7 @@ next1: goto fail; } const uint8_t *data = res->getData(); - const uint16_t num_adapter = jau::get_uint16(data, 0, true /* littleEndian */); + const uint16_t num_adapter = jau::get_uint16(data + 0, jau::lb_endian::little); WORDY_PRINT("Bluetooth %d adapter", num_adapter); const jau::nsize_t expDataSize = 2 + num_adapter * 2; @@ -468,7 +468,7 @@ next1: goto fail; } for(int i=0; i < num_adapter; i++) { - const uint16_t dev_id = jau::get_uint16(data, 2+i*2, true /* littleEndian */); + const uint16_t dev_id = jau::get_uint16(data + 2+i*2, jau::lb_endian::little); std::unique_ptr<AdapterInfo> adapterInfo = readAdapterInfo(dev_id); if( nullptr != adapterInfo ) { std::shared_ptr<BTAdapter> adapter = BTAdapter::make_shared(self, *adapterInfo); diff --git a/src/direct_bt/BTTypes0.cpp b/src/direct_bt/BTTypes0.cpp index 00b0fe36..41d75f6d 100644 --- a/src/direct_bt/BTTypes0.cpp +++ b/src/direct_bt/BTTypes0.cpp @@ -545,12 +545,12 @@ static std::string bt_compidtostr(const uint16_t companyid) noexcept { ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_) : company(company_), companyName(std::string(bt_compidtostr(company_))), - data(jau::endian::little /* intentional zero sized */) + data(jau::lb_endian::little /* intentional zero sized */) { } ManufactureSpecificData::ManufactureSpecificData(uint16_t const company_, uint8_t const * const data_, jau::nsize_t const data_len) : company(company_), companyName(std::string(bt_compidtostr(company_))), - data(data_, data_len, jau::endian::little) + data(data_, data_len, jau::lb_endian::little) { } std::string ManufactureSpecificData::toString() const noexcept { @@ -1023,7 +1023,7 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex case GAP_T::UUID16_COMPLETE: setServicesComplete( GAP_T::UUID32_COMPLETE == static_cast<GAP_T>(elem_type) ); for(int j=0; j<elem_len/2; j++) { - const std::shared_ptr<const jau::uuid_t> uuid( std::make_shared<const jau::uuid16_t>(elem_data, j*2, true) ); + const std::shared_ptr<const jau::uuid_t> uuid( std::make_shared<const jau::uuid16_t>(elem_data + j*2, jau::lb_endian::little) ); addService( uuid ); } break; @@ -1033,7 +1033,7 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex case GAP_T::UUID32_COMPLETE: setServicesComplete( GAP_T::UUID32_COMPLETE == static_cast<GAP_T>(elem_type) ); for(int j=0; j<elem_len/4; j++) { - const std::shared_ptr<const jau::uuid_t> uuid( std::make_shared<const jau::uuid32_t>(elem_data, j*4, true) ); + const std::shared_ptr<const jau::uuid_t> uuid( std::make_shared<const jau::uuid32_t>(elem_data + j*4, jau::lb_endian::little) ); addService( uuid ); } break; @@ -1043,7 +1043,7 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex case GAP_T::UUID128_COMPLETE: setServicesComplete( GAP_T::UUID32_COMPLETE == static_cast<GAP_T>(elem_type) ); for(int j=0; j<elem_len/16; j++) { - const std::shared_ptr<const jau::uuid_t> uuid( std::make_shared<const jau::uuid128_t>(elem_data, j*16, true) ); + const std::shared_ptr<const jau::uuid_t> uuid( std::make_shared<const jau::uuid128_t>(elem_data + j*16, jau::lb_endian::little) ); addService( uuid ); } break; @@ -1084,8 +1084,8 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex case GAP_T::SLAVE_CONN_IVAL_RANGE: if( 4 <= elem_len ) { - const uint16_t min = jau::get_uint16(elem_data, 0, true /* littleEndian */); - const uint16_t max = jau::get_uint16(elem_data, 2, true /* littleEndian */); + const uint16_t min = jau::get_uint16(elem_data + 0, jau::lb_endian::little); + const uint16_t max = jau::get_uint16(elem_data + 2, jau::lb_endian::little); setConnInterval(min, max); } break; @@ -1103,7 +1103,7 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex case GAP_T::GAP_APPEARANCE: if( 2 <= elem_len ) { - setAppearance(static_cast<AppearanceCat>( jau::get_uint16(elem_data, 0, true /* littleEndian */) )); + setAppearance(static_cast<AppearanceCat>( jau::get_uint16(elem_data + 0, jau::lb_endian::little) )); } break; @@ -1128,7 +1128,7 @@ int EInfoReport::read_data(uint8_t const * data, uint8_t const data_length) noex case GAP_T::MANUFACTURE_SPECIFIC: if( 2 <= elem_len ) { - const uint16_t company = jau::get_uint16(elem_data, 0, true /* littleEndian */); + const uint16_t company = jau::get_uint16(elem_data + 0, jau::lb_endian::little); const int data_size = elem_len-2; setManufactureSpecificData(company, data_size > 0 ? elem_data+2 : nullptr, data_size); } @@ -1195,7 +1195,7 @@ jau::nsize_t EInfoReport::write_data(EIRDataType write_mask, uint8_t * data, jau count += ad_sz + 1; *data_i++ = ad_sz; *data_i++ = direct_bt::number( GAP_T::MANUFACTURE_SPECIFIC ); - jau::put_uint16(data_i, 0, msd->getCompany(), true /* littleEndian */); + jau::put_uint16(data_i + 0, msd->getCompany(), jau::lb_endian::little); data_i += 2; if( 0 < msd_data_sz ) { memcpy(data_i, msd->getData().get_ptr(), msd_data_sz); @@ -1229,7 +1229,7 @@ jau::nsize_t EInfoReport::write_data(EIRDataType write_mask, uint8_t * data, jau *data_i++ = ad_sz; *data_i++ = direct_bt::number(services_complete ? GAP_T::UUID16_COMPLETE : GAP_T::UUID16_INCOMPLETE); for(const auto& p : uuid16s) { - data_i += p->put(data_i, 0, true /* le */); + data_i += p->put(data_i + 0, jau::lb_endian::little); } } if( uuid32s.size() > 0 ) { @@ -1242,7 +1242,7 @@ jau::nsize_t EInfoReport::write_data(EIRDataType write_mask, uint8_t * data, jau *data_i++ = ad_sz; *data_i++ = direct_bt::number(services_complete ? GAP_T::UUID32_COMPLETE : GAP_T::UUID32_INCOMPLETE); for(const auto& p : uuid32s) { - data_i += p->put(data_i, 0, true /* le */); + data_i += p->put(data_i + 0, jau::lb_endian::little); } } if( uuid128s.size() > 0 ) { @@ -1255,7 +1255,7 @@ jau::nsize_t EInfoReport::write_data(EIRDataType write_mask, uint8_t * data, jau *data_i++ = ad_sz; *data_i++ = direct_bt::number(services_complete ? GAP_T::UUID128_COMPLETE : GAP_T::UUID128_INCOMPLETE); for(const auto& p : uuid128s) { - data_i += p->put(data_i, 0, true /* le */); + data_i += p->put(data_i + 0, jau::lb_endian::little); } } } @@ -1268,8 +1268,8 @@ jau::nsize_t EInfoReport::write_data(EIRDataType write_mask, uint8_t * data, jau count += ad_sz + 1; *data_i++ = ad_sz; *data_i++ = direct_bt::number( GAP_T::SLAVE_CONN_IVAL_RANGE ); - jau::put_uint16(data_i, 0, conn_interval_min, true /* littleEndian */); - jau::put_uint16(data_i, 2, conn_interval_max, true /* littleEndian */); + jau::put_uint16(data_i + 0, conn_interval_min, jau::lb_endian::little); + jau::put_uint16(data_i + 2, conn_interval_max, jau::lb_endian::little); data_i += 4; } if( is_set(mask, EIRDataType::TX_POWER) ) { @@ -1463,7 +1463,7 @@ jau::darray<std::unique_ptr<EInfoReport>> EInfoReport::read_ext_ad_reports(uint8 // seg 1: 2 { - const EAD_Event_Type ead_type = static_cast<EAD_Event_Type>(jau::get_uint16(i_octets, 0, true /* littleEndian */)); + const EAD_Event_Type ead_type = static_cast<EAD_Event_Type>(jau::get_uint16(i_octets + 0, jau::lb_endian::little)); ad_reports[i]->setExtEvtType(ead_type); i_octets+=2; if( is_set(ead_type, EAD_Event_Type::LEGACY_PDU) ) { diff --git a/src/direct_bt/GATTNumbers.cpp b/src/direct_bt/GATTNumbers.cpp index 0528f7ba..e581f82e 100644 --- a/src/direct_bt/GATTNumbers.cpp +++ b/src/direct_bt/GATTNumbers.cpp @@ -383,12 +383,12 @@ std::string direct_bt::GattNameToString(const jau::TROOctets &v) noexcept { if( 0 == str_len ) { return std::string(); // empty } - jau::POctets s(str_len+1, jau::endian::little); // dtor releases chunk + jau::POctets s(str_len+1, jau::lb_endian::little); // dtor releases chunk { // Prelim checking to avoid g++ 8.3 showing a warning: pointer overflow between offset 0 and size uint8_t const * const v_p = v.get_ptr(); if( nullptr == v_p ) { - return std::string(); // empty + return std::string(); // emptylb_lb_lb_ } uint8_t * const s_p = s.get_wptr(); if( nullptr == s_p ) { diff --git a/src/direct_bt/HCIHandler.cpp b/src/direct_bt/HCIHandler.cpp index d9498a7f..97b3df19 100644 --- a/src/direct_bt/HCIHandler.cpp +++ b/src/direct_bt/HCIHandler.cpp @@ -270,7 +270,7 @@ std::unique_ptr<MgmtEvent> HCIHandler::translate(HCIEvent& ev) noexcept { return nullptr; } const uint16_t handle = jau::le_to_cpu(ev_cc->handle); - const LE_Features features = static_cast<LE_Features>(jau::get_uint64(ev_cc->features, 0, true /* littleEndian */)); + const LE_Features features = static_cast<LE_Features>(jau::get_uint64(ev_cc->features + 0, jau::lb_endian::little)); const HCIConnectionRef conn = findTrackerConnection(handle); if( nullptr == conn ) { WARN_PRINT("dev_id %u:: LE_REMOTE_FEAT_COMPLETE: Not tracked conn_handle %s of %s", @@ -686,7 +686,7 @@ std::unique_ptr<HCIEvent> HCIHandler::getNextCmdCompleteReply(HCICommand &req, H HCIHandler::HCIHandler(const uint16_t dev_id_, const BTMode btMode_) noexcept : env(HCIEnv::get()), dev_id(dev_id_), - rbuffer(HCI_MAX_MTU, jau::endian::little), + rbuffer(HCI_MAX_MTU, jau::lb_endian::little), comm(dev_id_, HCI_CHANNEL_RAW), hci_reader_service("HCIHandler::reader", THREAD_SHUTDOWN_TIMEOUT_MS, jau::bind_member(this, &HCIHandler::hciReaderWork), @@ -869,7 +869,7 @@ bool HCIHandler::initSupCommands() noexcept { zeroSupCommands(); return false; } - le_ll_feats = static_cast<LE_Features>( jau::get_uint64(ev_lf->features, 0, true /* littleEndian */) ); + le_ll_feats = static_cast<LE_Features>( jau::get_uint64(ev_lf->features + 0, jau::lb_endian::little) ); } HCICommand req0(HCIOpcode::READ_LOCAL_COMMANDS, 0); @@ -1515,8 +1515,8 @@ HCIStatusCode HCIHandler::le_add_to_resolv_list(const BDAddressAndType& peerIden hci_cp_le_add_to_resolv_list * cp = req0.getWStruct(); cp->bdaddr_type = static_cast<uint8_t>(peerIdentityAddressAndType.type); cp->bdaddr = jau::cpu_to_le(peerIdentityAddressAndType.address); - jau::put_uint128(cp->peer_irk, 0, peer_irk, true /* le */); - jau::put_uint128(cp->local_irk, 0, local_irk, true /* le */); + jau::put_uint128(cp->peer_irk + 0, peer_irk, jau::lb_endian::little); + jau::put_uint128(cp->local_irk + 0, local_irk, jau::lb_endian::little); const hci_rp_status * ev_res; std::unique_ptr<HCIEvent> ev = processCommandComplete(req0, &ev_res, &status, true /* quiet */); if( nullptr == ev || nullptr == ev_res || HCIStatusCode::SUCCESS != status ) { @@ -1798,8 +1798,8 @@ HCIStatusCode HCIHandler::le_set_adv_param(const EUI48 &peer_bdaddr, // Actually .. but struct uses uint8_t[3] duh .. // cp->min_interval = jau::cpu_to_le(adv_interval_min); // cp->max_interval = jau::cpu_to_le(adv_interval_max); - jau::put_uint16(cp->min_interval, 0, adv_interval_min, true /* littleEndian */); - jau::put_uint16(cp->max_interval, 0, adv_interval_max, true /* littleEndian */); + jau::put_uint16(cp->min_interval + 0, adv_interval_min, jau::lb_endian::little); + jau::put_uint16(cp->max_interval + 0, adv_interval_max, jau::lb_endian::little); cp->channel_map = adv_chan_map; cp->own_addr_type = static_cast<uint8_t>(own_mac_type); cp->peer_addr_type = static_cast<uint8_t>(peer_mac_type); diff --git a/src/direct_bt/HCITypes.cpp b/src/direct_bt/HCITypes.cpp index d4a78381..2221c20e 100644 --- a/src/direct_bt/HCITypes.cpp +++ b/src/direct_bt/HCITypes.cpp @@ -319,20 +319,20 @@ std::string to_string(const HCIMetaEventType op) noexcept { } std::unique_ptr<HCICommand> HCICommand::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept { - const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer, 0) ); + const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer + 0) ); if( HCIPacketType::COMMAND != pc ) { return nullptr; } - const jau::nsize_t paramSize = buffer_size >= number(HCIConstSizeT::COMMAND_HDR_SIZE) ? jau::get_uint8(buffer, 3) : 0; + const jau::nsize_t paramSize = buffer_size >= number(HCIConstSizeT::COMMAND_HDR_SIZE) ? jau::get_uint8(buffer + 3) : 0; if( buffer_size < number(HCIConstSizeT::COMMAND_HDR_SIZE) + paramSize ) { WARN_PRINT("HCIEvent::getSpecialized: length mismatch %u < COMMAND_HDR_SIZE(%u) + %u", buffer_size, number(HCIConstSizeT::COMMAND_HDR_SIZE), paramSize); return nullptr; } - const HCIOpcode oc = static_cast<HCIOpcode>( jau::get_uint16(buffer, 1, true /* littleEndian */) ); + const HCIOpcode oc = static_cast<HCIOpcode>( jau::get_uint16(buffer + 1, jau::lb_endian::little) ); switch( oc ) { case HCIOpcode::DISCONNECT: return std::make_unique<HCIDisconnectCmd>(buffer, buffer_size); @@ -349,20 +349,20 @@ std::unique_ptr<HCICommand> HCICommand::getSpecialized(const uint8_t * buffer, j } std::unique_ptr<HCIEvent> HCIEvent::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept { - const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer, 0) ); + const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer + 0) ); if( HCIPacketType::EVENT != pc ) { return nullptr; } - const jau::nsize_t paramSize = buffer_size >= number(HCIConstSizeT::EVENT_HDR_SIZE) ? jau::get_uint8(buffer, 2) : 0; + const jau::nsize_t paramSize = buffer_size >= number(HCIConstSizeT::EVENT_HDR_SIZE) ? jau::get_uint8(buffer + 2) : 0; if( buffer_size < number(HCIConstSizeT::EVENT_HDR_SIZE) + paramSize ) { WARN_PRINT("HCIEvent::getSpecialized: length mismatch %u < EVENT_HDR_SIZE(%u) + %u", buffer_size, number(HCIConstSizeT::EVENT_HDR_SIZE), paramSize); return nullptr; } - const HCIEventType ec = static_cast<HCIEventType>( jau::get_uint8(buffer, 1) ); + const HCIEventType ec = static_cast<HCIEventType>( jau::get_uint8(buffer + 1) ); switch( ec ) { case HCIEventType::DISCONN_COMPLETE: return std::make_unique<HCIDisconnectionCompleteEvent>(buffer, buffer_size); @@ -371,7 +371,7 @@ std::unique_ptr<HCIEvent> HCIEvent::getSpecialized(const uint8_t * buffer, jau:: case HCIEventType::CMD_STATUS: return std::make_unique<HCICommandStatusEvent>(buffer, buffer_size); case HCIEventType::LE_META: { - const HCIMetaEventType mec = static_cast<HCIMetaEventType>( jau::get_uint8(buffer, number(HCIConstSizeT::EVENT_HDR_SIZE)) ); + const HCIMetaEventType mec = static_cast<HCIMetaEventType>( jau::get_uint8(buffer + number(HCIConstSizeT::EVENT_HDR_SIZE)) ); switch( mec ) { case HCIMetaEventType::LE_LTK_REQUEST: return std::make_unique<HCILELTKReqEvent>(buffer, buffer_size); @@ -402,11 +402,11 @@ std::string HCIACLData::l2cap_frame::toString(const PBFlag v) noexcept { } std::unique_ptr<HCIACLData> HCIACLData::getSpecialized(const uint8_t * buffer, jau::nsize_t const buffer_size) noexcept { - const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer, 0) ); + const HCIPacketType pc = static_cast<HCIPacketType>( jau::get_uint8(buffer + 0) ); if( HCIPacketType::ACLDATA != pc ) { return nullptr; } - const jau::nsize_t paramSize = buffer_size >= number(HCIConstSizeT::ACL_HDR_SIZE) ? jau::get_uint16(buffer, 3) : 0; + const jau::nsize_t paramSize = buffer_size >= number(HCIConstSizeT::ACL_HDR_SIZE) ? jau::get_uint16(buffer + 3) : 0; if( buffer_size < number(HCIConstSizeT::ACL_HDR_SIZE) + paramSize ) { if( jau::environment::get().verbose ) { WARN_PRINT("HCIACLData::getSpecialized: length mismatch %u < ACL_HDR_SIZE(%u) + %u", diff --git a/src/direct_bt/MgmtTypes.cpp b/src/direct_bt/MgmtTypes.cpp index 819958e5..50f7c5ea 100644 --- a/src/direct_bt/MgmtTypes.cpp +++ b/src/direct_bt/MgmtTypes.cpp @@ -305,11 +305,11 @@ MgmtDefaultParam MgmtDefaultParam::read(const uint8_t* data, const jau::nsize_t if( length < 2U ) { return MgmtDefaultParam(); } - const Type type = static_cast<Type>( jau::get_uint16(data, 0, true /* little_endian */) ); + const Type type = static_cast<Type>( jau::get_uint16(data + 0, jau::lb_endian::little) ); if( length < 2U + 1U ) { return MgmtDefaultParam(type); } - const uint8_t value_length = jau::get_uint8(data, 2); + const uint8_t value_length = jau::get_uint8(data + 2); if( value_length != to_size(type) ) { return MgmtDefaultParam(type); } @@ -318,7 +318,7 @@ MgmtDefaultParam MgmtDefaultParam::read(const uint8_t* data, const jau::nsize_t } switch( value_length ) { case 2: - return MgmtDefaultParam(type, jau::get_uint16(data, 2+1, true /* little */)); + return MgmtDefaultParam(type, jau::get_uint16(data + 2+1, jau::lb_endian::little)); default: return MgmtDefaultParam(type); } @@ -542,11 +542,11 @@ std::shared_ptr<ConnectionInfo> MgmtEvtCmdComplete::toConnectionInfo() const noe ERR_PRINT("Data nullptr: %s", toString().c_str()); return nullptr; } - EUI48 address = EUI48( data, jau::endian::native ); - BDAddressType addressType = static_cast<BDAddressType>( jau::get_uint8(data, 6) ); - int8_t rssi = jau::get_int8(data, 7); - int8_t tx_power = jau::get_int8(data, 8); - int8_t max_tx_power = jau::get_int8(data, 9); + EUI48 address = EUI48( data, jau::lb_endian::native ); + BDAddressType addressType = static_cast<BDAddressType>( jau::get_uint8(data + 6) ); + int8_t rssi = jau::get_int8(data + 7); + int8_t tx_power = jau::get_int8(data + 8); + int8_t max_tx_power = jau::get_int8(data + 9); return std::make_shared<ConnectionInfo>(address, addressType, rssi, tx_power, max_tx_power); } diff --git a/src/direct_bt/SMPHandler.cpp b/src/direct_bt/SMPHandler.cpp index 0fcc2697..14fdecf7 100644 --- a/src/direct_bt/SMPHandler.cpp +++ b/src/direct_bt/SMPHandler.cpp @@ -169,7 +169,7 @@ void SMPHandler::smpReaderEndLocked(jau::service_runner& sr) noexcept { SMPHandler::SMPHandler(const std::shared_ptr<BTDevice> &device) noexcept : env(SMPEnv::get()), wbr_device(device), deviceString(device->getAddressAndType().toString()), - rbuffer(number(Defaults::SMP_MTU_BUFFER_SZ), jau::endian::little), + rbuffer(number(Defaults::SMP_MTU_BUFFER_SZ), jau::lb_endian::little), l2cap(device->getAdapter().dev_id, device->getAdapter().getAddressAndType(), L2CAP_PSM::UNDEFINED, L2CAP_CID::SMP), is_connected(l2cap.open(*device)), has_ioerror(false), smp_reader_service("SMPHandler::reader", THREAD_SHUTDOWN_TIMEOUT_MS, diff --git a/src/direct_bt/SMPKeyBin.cpp b/src/direct_bt/SMPKeyBin.cpp index a08c76d5..da075e6b 100644 --- a/src/direct_bt/SMPKeyBin.cpp +++ b/src/direct_bt/SMPKeyBin.cpp @@ -274,23 +274,23 @@ bool SMPKeyBin::write(const std::string& path, const bool overwrite) const noexc } uint8_t buffer[8]; - jau::put_uint16(buffer, 0, version, true /* littleEndian */); + jau::put_uint16(buffer, version, jau::lb_endian::little); file.write((char*)buffer, sizeof(version)); - jau::put_uint16(buffer, 0, size, true /* littleEndian */); + jau::put_uint16(buffer, size, jau::lb_endian::little); file.write((char*)buffer, sizeof(size)); - jau::put_uint64(buffer, 0, ts_creation_sec, true /* littleEndian */); + jau::put_uint64(buffer, ts_creation_sec, jau::lb_endian::little); file.write((char*)buffer, sizeof(ts_creation_sec)); file.write((char*)&localRole, sizeof(localRole)); { - localAddress.address.put(buffer, 0, jau::endian::little); + localAddress.address.put(buffer, jau::lb_endian::little); file.write((char*)buffer, sizeof(localAddress.address.b)); } file.write((char*)&localAddress.type, sizeof(localAddress.type)); { - remoteAddress.address.put(buffer, 0, jau::endian::little); + remoteAddress.address.put(buffer, jau::lb_endian::little); file.write((char*)buffer, sizeof(remoteAddress.address.b)); } file.write((char*)&remoteAddress.type, sizeof(remoteAddress.type)); @@ -351,19 +351,19 @@ bool SMPKeyBin::read(const std::string& fname) { uint8_t buffer[8]; file.read((char*)buffer, sizeof(version)); - version = jau::get_uint16(buffer, 0, true /* littleEndian */); + version = jau::get_uint16(buffer, jau::lb_endian::little); err = file.fail(); if( !err ) { file.read((char*)buffer, sizeof(size)); - size = jau::get_uint16(buffer, 0, true /* littleEndian */); + size = jau::get_uint16(buffer, jau::lb_endian::little); err = file.fail(); } uint16_t remaining = size - sizeof(version) - sizeof(size); if( !err && 8 <= remaining ) { file.read((char*)buffer, sizeof(ts_creation_sec)); - ts_creation_sec = jau::get_uint64(buffer, 0, true /* littleEndian */); + ts_creation_sec = jau::get_uint64(buffer, jau::lb_endian::little); remaining -= 8; err = file.fail(); } else { @@ -373,12 +373,12 @@ bool SMPKeyBin::read(const std::string& fname) { file.read((char*)&localRole, sizeof(localRole)); { file.read((char*)buffer, sizeof(localAddress.address.b)); - localAddress.address = jau::EUI48(buffer, jau::endian::little); + localAddress.address = jau::EUI48(buffer, jau::lb_endian::little); } file.read((char*)&localAddress.type, sizeof(localAddress.type)); { file.read((char*)buffer, sizeof(remoteAddress.address.b)); - remoteAddress.address = jau::EUI48(buffer, jau::endian::little); + remoteAddress.address = jau::EUI48(buffer, jau::lb_endian::little); } file.read((char*)&remoteAddress.type, sizeof(remoteAddress.type)); file.read((char*)&sec_level, sizeof(sec_level)); diff --git a/trial/direct_bt/dbt_client01.hpp b/trial/direct_bt/dbt_client01.hpp index dd40c45c..aca7496a 100644 --- a/trial/direct_bt/dbt_client01.hpp +++ b/trial/direct_bt/dbt_client01.hpp @@ -456,7 +456,7 @@ class DBTClient01 : public DBTClientTest { cmd.setVerbose(true); const bool cmd_resolved = cmd.isResolved(); fprintf_td(stderr, "Command test: %s, resolved %d\n", cmd.toString().c_str(), cmd_resolved); - POctets cmd_data(1, endian::little); + POctets cmd_data(1, lb_endian::little); cmd_data.put_uint8_nc(0, cmd_arg); const HCIStatusCode cmd_res = cmd.send(true /* prefNoAck */, cmd_data, 3_s); if( HCIStatusCode::SUCCESS == cmd_res ) { @@ -495,7 +495,7 @@ class DBTClient01 : public DBTClientTest { fprintf_td(stderr, " [%2.2d.%2.2d] %s\n", i, j, serviceChar->toString().c_str()); } if( serviceChar->hasProperties(BTGattChar::PropertyBitVal::Read) ) { - POctets value(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::endian::little); + POctets value(BTGattHandler::number(BTGattHandler::Defaults::MAX_ATT_MTU), 0, jau::lb_endian::little); if( serviceChar->readValue(value) ) { std::string sval = dfa_utf8_decode(value.get_ptr(), value.size()); if( GATT_VERBOSE ) { @@ -566,7 +566,7 @@ class DBTClient01 : public DBTClientTest { const bool cmd_resolved = cmd.isResolved(); fprintf_td(stderr, "FinalCommand test: %s, resolved %d\n", cmd.toString().c_str(), cmd_resolved); const size_t data_sz = DBTConstants::FailHandshakeCommandData.size(); - POctets cmd_data(data_sz, endian::little); + POctets cmd_data(data_sz, lb_endian::little); if( success ) { cmd_data.put_bytes_nc(0, DBTConstants::SuccessHandshakeCommandData.data(), data_sz); } else { diff --git a/trial/direct_bt/dbt_server01.hpp b/trial/direct_bt/dbt_server01.hpp index 43d8673f..7f7c7057 100644 --- a/trial/direct_bt/dbt_server01.hpp +++ b/trial/direct_bt/dbt_server01.hpp @@ -318,7 +318,7 @@ class DBTServer01 : public DBTServerTest { if( nullptr != connectedDevice_ && connectedDevice_->getConnected() ) { if( 0 != handlePulseDataNotify || 0 != handlePulseDataIndicate ) { std::string data( "Dynamic Data Example. Elapsed Milliseconds: "+jau::to_decstring(environment::getElapsedMillisecond(), ',', 9) ); - jau::POctets v(data.size()+1, jau::endian::little); + jau::POctets v(data.size()+1, jau::lb_endian::little); v.put_string_nc(0, data, v.size(), true /* includeEOS */); if( 0 != handlePulseDataNotify ) { if( GATT_VERBOSE ) { |