Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
test_client_server20_SC0.cpp
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2022 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
26
28
29using namespace direct_bt;
30
31/**
32 * Testing a full Bluetooth server and client lifecycle of operations, requiring two BT adapter:
33 * - operating in legacy non SC mode
34 * - start server advertising
35 * - start client discovery and connect to server when discovered
36 * - client/server processing of connection when ready
37 * - client disconnect
38 * - server stop advertising
39 * - security-level: NONE, ENC_ONLY freshly-paired and ENC_ONLY pre-paired
40 * - reuse server-adapter for client-mode discovery (just toggle on/off)
41 */
43 private:
44 static constexpr const bool serverSC = false;
45
46 public:
49 {
50 const ExpectedPairing serverExpPairing = ExpectedPairing::NEW_PAIRING;
51 const ExpectedPairing clientExpPairing = ExpectedPairing::NEW_PAIRING;
52 test8x_fullCycle("20", 1 /* protocolSessionCount */, true /* server_client_order */, serverSC,
53 BTSecurityLevel::ENC_ONLY, serverExpPairing, BTSecurityLevel::ENC_ONLY, clientExpPairing);
54 }
56 }
57
60 {
61 const ExpectedPairing serverExpPairing = ExpectedPairing::PREPAIRED;
62 const ExpectedPairing clientExpPairing = ExpectedPairing::PREPAIRED;
63 test8x_fullCycle("21", 2 /* protocolSessionCount */, true /* server_client_order */, serverSC,
64 BTSecurityLevel::ENC_ONLY, serverExpPairing, BTSecurityLevel::ENC_ONLY, clientExpPairing);
65 }
67 }
68
69};
70
71METHOD_AS_TEST_CASE( TestDBTClientServer20_SC0::test10_FullCycle_EncOnlyNo1, "ClientServer 20 SC0 EncOnly Trial", "[trial][serverclient][fullcycle][sc0][enconly][newpairing]");
72METHOD_AS_TEST_CASE( TestDBTClientServer20_SC0::test20_FullCycle_EncOnlyNo2, "ClientServer 21 SC0 EncOnly Trial", "[trial][serverclient][fullcycle][sc0][enconly][prepaired]");
void setupTest(const jau::fraction_i64 timeout=0_s)
Ensure.
Testing a full Bluetooth server and client lifecycle of operations, requiring two BT adapter:
void test8x_fullCycle(const std::string &suffix, const int protocolSessionCount, const bool server_client_order, const bool serverSC, const BTSecurityLevel secLevelServer, const ExpectedPairing serverExpPairing, const BTSecurityLevel secLevelClient, const ExpectedPairing clientExpPairing)
Testing a full Bluetooth server and client lifecycle of operations, requiring two BT adapter:
static BaseDBTClientServer & base_test_framework
METHOD_AS_TEST_CASE(TestDBTClientServer20_SC0::test10_FullCycle_EncOnlyNo1, "ClientServer 20 SC0 EncOnly Trial", "[trial][serverclient][fullcycle][sc0][enconly][newpairing]")
ExpectedPairing