* 临时提交 * 临时提交 * 临时提交 * fix: 调整接口 * fix: 修复问题 * fix: 调整 iOS 实现 * fix: 添加注释 * fix: 修改预览版本号 * fix: 修复已知问题 * fix: 优化接口 * fix: 解决 32 位 UUID 报错问题 * fix: 修复问题 * fix: 修复依赖项 * fix: 移除多余代码 * fix: 修复已知问题 * fix: 修复问题 * fix: 修改版本号 * fix: 修复问题 * fix: 发布正式版本
50 lines
1.7 KiB
Swift
50 lines
1.7 KiB
Swift
//
|
|
// MyPeripheralManagerDelegate.swift
|
|
// bluetooth_low_energy_darwin
|
|
//
|
|
// Created by 闫守旺 on 2023/10/7.
|
|
//
|
|
|
|
import Foundation
|
|
import CoreBluetooth
|
|
|
|
class MyPeripheralManagerDelegate: NSObject, CBPeripheralManagerDelegate {
|
|
init(_ peripheralManager: MyPeripheralManager) {
|
|
self.peripheralManager = peripheralManager
|
|
}
|
|
|
|
private let peripheralManager: MyPeripheralManager
|
|
|
|
func peripheralManagerDidUpdateState(_ peripheral: CBPeripheralManager) {
|
|
peripheralManager.didUpdateState()
|
|
}
|
|
|
|
func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) {
|
|
peripheralManager.didAdd(service, error)
|
|
}
|
|
|
|
func peripheralManagerDidStartAdvertising(_ peripheral: CBPeripheralManager, error: Error?) {
|
|
peripheralManager.didStartAdvertising(error)
|
|
}
|
|
|
|
func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveRead request: CBATTRequest) {
|
|
peripheralManager.didReceiveRead(request)
|
|
}
|
|
|
|
func peripheralManager(_ peripheral: CBPeripheralManager, didReceiveWrite requests: [CBATTRequest]) {
|
|
peripheralManager.didReceiveWrite(requests)
|
|
}
|
|
|
|
func peripheralManager(_ peripheral: CBPeripheralManager, central: CBCentral, didSubscribeTo characteristic: CBCharacteristic) {
|
|
peripheralManager.didSubscribeTo(central, characteristic)
|
|
}
|
|
|
|
func peripheralManager(_ peripheral: CBPeripheralManager, central: CBCentral, didUnsubscribeFrom characteristic: CBCharacteristic) {
|
|
peripheralManager.didUnsubscribeFrom(central, characteristic)
|
|
}
|
|
|
|
func peripheralManagerIsReady(toUpdateSubscribers peripheral: CBPeripheralManager) {
|
|
peripheralManager.isReadyToUpdateSubscribers()
|
|
}
|
|
}
|