///
/// HybridMunimBluetoothSpec.swift
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
/// https://github.com/mrousavy/nitro
/// Copyright © Marc Rousavy @ Margelo
///

import NitroModules

/// See ``HybridMunimBluetoothSpec``
public protocol HybridMunimBluetoothSpec_protocol: HybridObject {
  // Properties
  

  // Methods
  func startAdvertising(options: AdvertisingOptions) throws -> Void
  func updateAdvertisingData(advertisingData: AdvertisingDataTypes) throws -> Void
  func getAdvertisingData() throws -> Promise<AdvertisingDataTypes>
  func stopAdvertising() throws -> Void
  func setServices(services: [GATTService]) throws -> Void
  func updateCharacteristicValue(serviceUUID: String, characteristicUUID: String, value: String, notify: Bool?) throws -> Promise<Void>
  func isBluetoothEnabled() throws -> Promise<Bool>
  func requestBluetoothPermission() throws -> Promise<Bool>
  func getCapabilities() throws -> Promise<BluetoothCapabilities>
  func startScan(options: ScanOptions?) throws -> Void
  func stopScan() throws -> Void
  func connect(deviceId: String) throws -> Promise<Void>
  func disconnect(deviceId: String) throws -> Void
  func discoverServices(deviceId: String) throws -> Promise<[GATTService]>
  func readCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Promise<CharacteristicValue>
  func readDescriptor(deviceId: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String) throws -> Promise<DescriptorValue>
  func writeCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String, value: String, writeType: WriteType?) throws -> Promise<Void>
  func writeDescriptor(deviceId: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, value: String) throws -> Promise<Void>
  func subscribeToCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Void
  func unsubscribeFromCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Void
  func getConnectedDevices() throws -> Promise<[String]>
  func readRSSI(deviceId: String) throws -> Promise<Double>
  func requestMTU(deviceId: String, mtu: Double) throws -> Promise<Double>
  func setPreferredPhy(deviceId: String, txPhy: BluetoothPhy, rxPhy: BluetoothPhy, phyOption: BluetoothPhyOption?) throws -> Promise<Void>
  func readPhy(deviceId: String) throws -> Promise<PhyStatus>
  func getBondState(deviceId: String) throws -> Promise<BondState>
  func createBond(deviceId: String) throws -> Promise<BondState>
  func removeBond(deviceId: String) throws -> Promise<BondState>
  func startExtendedAdvertising(options: ExtendedAdvertisingOptions) throws -> Promise<String>
  func stopExtendedAdvertising(advertisingId: String) throws -> Void
  func publishL2CAPChannel(encryptionRequired: Bool?) throws -> Promise<L2CAPChannel>
  func unpublishL2CAPChannel(psm: Double) throws -> Void
  func openL2CAPChannel(deviceId: String, psm: Double) throws -> Promise<L2CAPChannel>
  func closeL2CAPChannel(channelId: String) throws -> Void
  func sendL2CAPData(channelId: String, value: String) throws -> Promise<Void>
  func startClassicScan() throws -> Void
  func stopClassicScan() throws -> Void
  func connectClassic(deviceId: String, serviceUUID: String?) throws -> Promise<Void>
  func startClassicServer(serviceUUID: String?, serviceName: String?) throws -> Promise<Void>
  func stopClassicServer(serviceUUID: String?) throws -> Void
  func disconnectClassic(deviceId: String) throws -> Void
  func writeClassic(deviceId: String, value: String) throws -> Promise<Void>
  func startBackgroundSession(options: BackgroundSessionOptions) throws -> Void
  func stopBackgroundSession() throws -> Void
  func startMultipeerSession(options: MultipeerSessionOptions) throws -> Void
  func stopMultipeerSession() throws -> Void
  func inviteMultipeerPeer(peerId: String) throws -> Void
  func getMultipeerPeers() throws -> Promise<[MultipeerPeer]>
  func sendMultipeerMessage(value: String, peerIds: [String]?, reliable: Bool?) throws -> Promise<Void>
  func addListener(eventName: String) throws -> Void
  func removeListeners(count: Double) throws -> Void
}

public extension HybridMunimBluetoothSpec_protocol {
  /// Default implementation of ``HybridObject.toString``
  func toString() -> String {
    return "[HybridObject MunimBluetooth]"
  }
}

/// See ``HybridMunimBluetoothSpec``
open class HybridMunimBluetoothSpec_base {
  private weak var cxxWrapper: HybridMunimBluetoothSpec_cxx? = nil
  public init() { }
  public func getCxxWrapper() -> HybridMunimBluetoothSpec_cxx {
  #if DEBUG
    guard self is any HybridMunimBluetoothSpec else {
      fatalError("`self` is not a `HybridMunimBluetoothSpec`! Did you accidentally inherit from `HybridMunimBluetoothSpec_base` instead of `HybridMunimBluetoothSpec`?")
    }
  #endif
    if let cxxWrapper = self.cxxWrapper {
      return cxxWrapper
    } else {
      let cxxWrapper = HybridMunimBluetoothSpec_cxx(self as! any HybridMunimBluetoothSpec)
      self.cxxWrapper = cxxWrapper
      return cxxWrapper
    }
  }
}

/**
 * A Swift base-protocol representing the MunimBluetooth HybridObject.
 * Implement this protocol to create Swift-based instances of MunimBluetooth.
 * ```swift
 * class HybridMunimBluetooth : HybridMunimBluetoothSpec {
 *   // ...
 * }
 * ```
 */
public typealias HybridMunimBluetoothSpec = HybridMunimBluetoothSpec_protocol & HybridMunimBluetoothSpec_base
