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

Commit 14c4fe7b authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Introduce L2cap classic link property listener

For shim, and some other module in the future, to receive some link
callbacks, which are for non-security purposes.

Test: cert/run
Tag: #gd-refactor
Bug: 141555841
Change-Id: I8842ac63b98d8233f7af00a8d2e85a4ff166d828
parent afbe4633
Loading
Loading
Loading
Loading
+85 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <memory>

#include "hci/address.h"
#include "hci/hci_packets.h"

namespace bluetooth {
namespace l2cap {
namespace classic {

/**
 * This is the listener interface for link property callbacks.
 */
class LinkPropertyListener {
 public:
  virtual ~LinkPropertyListener() = default;

  /**
   * Invoked when an ACL link is connected.
   */
  virtual void OnLinkConnected(hci::Address remote) {}

  /**
   * Invoked when an ACL link is disconnected.
   */
  virtual void OnLinkDisconnected(hci::Address remote) {}

  /**
   * Invoked when received remote version information for a given link
   */
  virtual void OnReadRemoteVersionInformation(
      hci::Address remote, uint8_t lmp_version, uint16_t manufacturer_name, uint16_t sub_version) {}

  /**
   * Invoked when received remote features and remote exnteded features for a given link
   */
  virtual void OnReadRemoteExtendedFeatures(
      hci::Address remote, uint8_t page_number, uint8_t max_page_number, uint64_t features) {}

  /**
   * Invoked when received role change
   */
  virtual void OnRoleChange(hci::Address remote, hci::Role role) {}

  /**
   * Invoked when received clock offset
   */
  virtual void OnReadClockOffset(hci::Address remote, uint16_t clock_offset) {}

  /**
   * Invoked when received mode change
   */
  virtual void OnModeChange(hci::Address remote, hci::Mode mode, uint16_t interval) {}

  /**
   * Invoked when received sniff subrating
   */
  virtual void OnSniffSubrating(
      hci::Address remote,
      uint16_t max_tx_lat,
      uint16_t max_rx_lat,
      uint16_t min_remote_timeout,
      uint16_t min_local_timeout) {}
};

}  // namespace classic
}  // namespace l2cap
}  // namespace bluetooth