Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5b15083 authored by Łukasz Rymanowski's avatar Łukasz Rymanowski
Browse files

gatt: Add upper tester for Multiple Variable Len notification

Core spec requires GATT Server implementations to support Multiple Variable
Len Notification for the certification purposes.
This patch adds simple Upper tester which helps to pass GATT/SR/GAN/BV-02-C.

Proper API for Android might come later if any.

To enable upper test two steps are required
1) set GATT_UPPER_TESTER_MULT_VARIABLE_LENGTH_NOTIF to TRUE
2) PTS_ForceEattForNotifications=true

< ACL Data TX: Handle 64 flags 0x00 dlen 19
      Channel: 84 len 15 sdu 13 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
      ATT: Handle Multiple Value Notification (0x23) len 12
        Handle: 0x009a
        Length: 0x0003
          Data: 797979
        Handle: 0x00a2
        Length: 0x0001
          Data: 02

Bug: 236702711
Tag: #feature
Test: atest BluetoothInstrumentationTests

Change-Id: I8a3c47ddae2b8e5487ef112b84888ea34d33a3b1
parent bf99d7bc
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -44,6 +44,9 @@ TRC_HID_DEV=2
# Disable LE Connection updates
#PTS_DisableConnUpdates=true

# Use EATT for the notifications
#PTS_ForceEattForNotifications=true

# Disable BR/EDR discovery after LE pairing to avoid cross key derivation errors
#PTS_DisableSDPOnLEPair=true

+4 −0
Original line number Diff line number Diff line
@@ -551,6 +551,10 @@
#define GATT_CONFORMANCE_TESTING FALSE
#endif

/* Used only for GATT Multiple Variable Length Notifications PTS tests */
#ifndef GATT_UPPER_TESTER_MULT_VARIABLE_LENGTH_NOTIF
#define GATT_UPPER_TESTER_MULT_VARIABLE_LENGTH_NOTIF FALSE
#endif
/******************************************************************************
 *
 * SMP
+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ typedef struct {
  bool (*get_pts_crosskey_sdp_disable)(void);
  const std::string* (*get_pts_smp_options)(void);
  int (*get_pts_smp_failure_case)(void);
  bool (*get_pts_force_eatt_for_notifications)(void);
  config_t* (*get_all)(void);
} stack_config_t;

+15 −5
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ const char* PTS_LE_CONN_UPDATED_DISABLED = "PTS_DisableConnUpdates";
const char* PTS_DISABLE_SDP_LE_PAIR = "PTS_DisableSDPOnLEPair";
const char* PTS_SMP_PAIRING_OPTIONS_KEY = "PTS_SmpOptions";
const char* PTS_SMP_FAILURE_CASE_KEY = "PTS_SmpFailureCase";
const char* PTS_FORCE_EATT_FOR_NOTIFICATIONS = "PTS_ForceEattForNotifications";

static std::unique_ptr<config_t> config;
}  // namespace
@@ -110,12 +111,21 @@ static int get_pts_smp_failure_case(void) {
                        PTS_SMP_FAILURE_CASE_KEY, 0);
}

static bool get_pts_force_eatt_for_notifications(void) {
  return config_get_bool(*config, CONFIG_DEFAULT_SECTION,
                         PTS_FORCE_EATT_FOR_NOTIFICATIONS, false);
}

static config_t* get_all(void) { return config.get(); }

const stack_config_t interface = {
    get_trace_config_enabled,     get_pts_avrcp_test,
    get_pts_secure_only_mode,     get_pts_conn_updates_disabled,
    get_pts_crosskey_sdp_disable, get_pts_smp_options,
    get_pts_smp_failure_case,     get_all};
const stack_config_t interface = {get_trace_config_enabled,
                                  get_pts_avrcp_test,
                                  get_pts_secure_only_mode,
                                  get_pts_conn_updates_disabled,
                                  get_pts_crosskey_sdp_disable,
                                  get_pts_smp_options,
                                  get_pts_smp_failure_case,
                                  get_pts_force_eatt_for_notifications,
                                  get_all};

const stack_config_t* stack_config_get_interface(void) { return &interface; }
+5 −3
Original line number Diff line number Diff line
@@ -54,8 +54,10 @@ class FakeA2dpInterface : public A2dpInterface {

bool get_pts_avrcp_test(void) { return false; }

const stack_config_t interface = {
    nullptr, get_pts_avrcp_test, nullptr, nullptr, nullptr, nullptr, nullptr,
const stack_config_t interface = {nullptr, get_pts_avrcp_test,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr, nullptr,
                                  nullptr};

void Callback(uint8_t, bool, std::unique_ptr<::bluetooth::PacketBuilder>) {}
Loading