Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
test_attpdu01.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <cassert>
3#include <cinttypes>
4#include <cstring>
5
7
8#include <jau/uuid.hpp>
9// #include <direct_bt/BTAddress.hpp>
10// #include <direct_bt/BTTypes1.hpp>
12// #include <direct_bt/GATTHandler.hpp>
13// #include <direct_bt/GATTIoctl.hpp>
14
15using namespace direct_bt;
16
17TEST_CASE( "ATT PDU Test 01", "[datatype][attpdu]" ) {
18 const jau::uuid16_t uuid16 = jau::uuid16_t(0x1234);
19 const AttReadByNTypeReq req(true /* group */, 1, 0xffff, uuid16);
20
21 std::shared_ptr<const jau::uuid_t> uuid16_2 = req.getNType();
22 REQUIRE(uuid16.getTypeSizeInt() == 2);
23 REQUIRE(uuid16_2->getTypeSizeInt() == 2);
24 REQUIRE( 0 == memcmp(uuid16.data(), uuid16_2->data(), 2) );
25 REQUIRE( uuid16.toString() == uuid16_2->toString() );
26
27 REQUIRE(req.getStartHandle() == 1);
28 REQUIRE(req.getEndHandle() == 0xffff);
29}
30
BT Core Spec v5.2: Vol 3, Part F ATT: 3.4.4.1 ATT_READ_BY_TYPE_REQ.
std::unique_ptr< const jau::uuid_t > getNType() const
constexpr uint16_t getStartHandle() const noexcept
constexpr uint16_t getEndHandle() const noexcept
const uint8_t * data() const noexcept override
returns the pointer to the uuid data of size getTypeSize()
Definition: uuid.hpp:168
std::string toString() const noexcept override
Returns the string representation in BE network order, i.e.
Definition: uuid.cpp:135
jau::nsize_t getTypeSizeInt() const noexcept
Definition: uuid.hpp:126
TEST_CASE("ATT PDU Test 01", "[datatype][attpdu]")