Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Android/tools/tools/rootcanal/model/devices/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 2 kB image not shown  

Quelle  device.h

  Sprache: C
 

/*
 * Copyright 2016 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 <cstdint>
#include <functional>
#include <memory>
#include <string>
#include <vector>

#include "hci/address.h"
#include "packets/link_layer_packets.h"
#include "phy.h"

namespace rootcanal {

using ::bluetooth::hci::Address;

// Represent a Bluetooth Device
//  - Provide Get*() and Set*() functions for device attributes.
class Device {
public:
  // Unique device identifier.
  const uint32_t id_;

  Device();
  virtual ~Device() = default;

  // Return a string representation of the type of device.
  virtual std::string GetTypeString() const = 0;

  // Return the string representation of the device.
  virtual std::string ToString() const;

  // Set the device's Bluetooth address.
  void SetAddress(Address address) { address_.address = address.address; }

  // Get the device's Bluetooth address.
  const Address& GetAddress() const { return address_; }

  virtual void Tick() {}
  virtual void Close();

  virtual void ReceiveLinkLayerPacket(model::packets::LinkLayerPacketView /*packet*/,
                                      Phy::Type /*type*/, int8_t /*rssi*/) {}

  void SendLinkLayerPacket(std::shared_ptr<model::packets::LinkLayerPacketBuilder> packet,
                           Phy::Type type, int8_t tx_power = 0);

  void SendLinkLayerPacket(std::vector<uint8_t> const& packet, Phy::Type type, int8_t tx_power = 0);

  void RegisterLinkLayerChannel(
          std::function<void(std::vector<uint8_t> const&, Phy::Type, int8_t)> send_ll);

  void RegisterCloseCallback(std::function<void()> close_callback);

protected:
  // Unique device address. Used as public device address for
  // Bluetooth activities.
  Address address_;

  // Callback to be invoked when this device is closed.
  std::function<void()> close_callback_;

  // Callback function to send link layer packets.
  std::function<void(std::vector<uint8_t> const&, Phy::Type, uint8_t)> send_ll_;
};

}  // namespace rootcanal

Messung V0.5 in Prozent
C=85 H=96 G=90

¤ Dauer der Verarbeitung: 0.13 Sekunden  (vorverarbeitet am  2026-06-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.