* 临时提交 * 临时提交 * 临时提交 * fix: 调整接口 * fix: 修复问题 * fix: 调整 iOS 实现 * fix: 添加注释 * fix: 修改预览版本号 * fix: 修复已知问题 * fix: 优化接口 * fix: 解决 32 位 UUID 报错问题 * fix: 修复问题 * fix: 修复依赖项 * fix: 移除多余代码 * fix: 修复已知问题 * fix: 修复问题 * fix: 修改版本号 * fix: 修复问题 * fix: 发布正式版本
54 lines
2.0 KiB
Swift
54 lines
2.0 KiB
Swift
//
|
|
// MyPeripheralDelegate.swift
|
|
// bluetooth_low_energy_ios
|
|
//
|
|
// Created by 闫守旺 on 2023/8/13.
|
|
//
|
|
|
|
import Foundation
|
|
import CoreBluetooth
|
|
|
|
class MyPeripheralDelegate: NSObject, CBPeripheralDelegate {
|
|
private let centralManager: MyCentralManager
|
|
|
|
init(_ centralManager: MyCentralManager) {
|
|
self.centralManager = centralManager
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didReadRSSI RSSI: NSNumber, error: Error?) {
|
|
centralManager.didReadRSSI(peripheral, RSSI, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
|
|
centralManager.didDiscoverServices(peripheral, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
|
|
centralManager.didDiscoverCharacteristics(peripheral, service, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didDiscoverDescriptorsFor characteristic: CBCharacteristic, error: Error?) {
|
|
centralManager.didDiscoverDescriptors(peripheral, characteristic, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
|
|
centralManager.didUpdateCharacteristicValue(characteristic, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?) {
|
|
centralManager.didWriteCharacteristicValue(characteristic, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) {
|
|
centralManager.didUpdateNotificationState(characteristic, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor descriptor: CBDescriptor, error: Error?) {
|
|
centralManager.didUpdateDescriptorValue(descriptor, error)
|
|
}
|
|
|
|
func peripheral(_ peripheral: CBPeripheral, didWriteValueFor descriptor: CBDescriptor, error: Error?) {
|
|
centralManager.didWriteDescriptorValue(descriptor, error)
|
|
}
|
|
}
|