Я работаю над разработкой приложения BLE с использованием канала, ориентированного на соединение. Я использую Nordic Semiconductor NRF52 в качестве периферийного устройства и iPhone 6 в качестве центрального менеджера. < /p>
Я использовал предварительно определенное значение PSM, предоставленное Bluetooth Sig, которое составляет 0x0025.
I Blable, чтобы успешно подключиться к периферическому и открытому каналу L2CAP. < /p>
Я получаю ниже ошибку: < /p>
** [corebluetooth] Предупреждение: неизвестная ошибка: 436 < /p>
2018-06-08 10: 03: 17,532709-0400. ** Нет известного сопоставления каналов с PSM 37 **** < /p>
Можно сообщить мне, как продолжить и что означает код ошибки 436 < /p>
Ниже мой код: < /p>
ниже: < /p>
func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
//handling callback when a peripheral is discover
print("Central Manager PowerOn State Check:\(central.state.rawValue)")
if (peripheral.name?.contains("Nordic_OTSX") == true)
{
print(peripheral.name ?? "no name")
print("advertisement Data : \(advertisementData) ")
central.connect(peripheral, options: nil )
myPeripheral = peripheral
}
}
func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral)
{
print("didConnect\(myPeripheral.debugDescription)")
myPeripheral.delegate = self
myPeripheral.discoverServices(nil)
}
//if error while making connection
func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?)
{
print("error:\(error.debugDescription)")
}
//after opening L2CAP Channel
func peripheral(_ peripheral: CBPeripheral, didOpen channel: CBL2CAPChannel?, error: Error?)
{
print("didOpen")
print(error.customMirror)
print(channel!.outputStream.debugDescription)
print(channel!.inputStream.debugDescription)
print(channel?.outputStream.hasSpaceAvailable)
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?)
{
print("*******************************************************")
if ((error) != nil) {
print("Error discovering services: \(error!.localizedDescription)")
return
}
guard let services = peripheral.services else {
return
}
//We need to discover the all characteristic
for service in services {
peripheral.discoverCharacteristics(nil, for: service)
// bleService = service
}
print("Discovered Services: \(services)")
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?)
{
print("*******************************************************")
if let charcterstics = service.characteristics
{
print("characteristics :")
for char in charcterstics
{
/* if char.uuid == buttonCharacteristicUUID
{
buttonCharacteristic = char
enableButtonNotifications(buttonCharacteristic!)
readButtonValue()
}*/
print(char.uuid.uuidString)
}
}
peripheral.openL2CAPChannel(0x0025)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Подробнее здесь: https://stackoverflow.com/questions/508 ... a-transfer
Передача данных канала L2CAP ⇐ IOS
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Отключение канала RabbitMQ из-за ошибки канала с неизвестным тегом доставки
Anonymous » » в форуме JAVA - 0 Ответы
- 92 Просмотры
-
Последнее сообщение Anonymous
-