«LE Link отключен для дескриптора» «причина 708», когда приложение выполняет роль периферийного устройства - PullRequest
0 голосов
/ 15 мая 2019

Мое приложение использует corebluetooth и играет 2 роли:

  1. Центральная роль: подключение к периферийному устройству (устройство IoT) для сбора данных (3 выборки в секунду).

  2. Роль периферийных устройств: реклама и уведомление данных с помощью предварительно определенной характеристики.

Мое приложение получало данные из IoT 3 раза в секунду, каждый раз, когда оно получало новые данные, оноотправить данные через предопределенную характеристику

- (BOOL)updateValue:(NSData *)value forCharacteristic:(CBMutableCharacteristic *)characteristic onSubscribedCentrals:(nullable NSArray *)centrals;  

Проблема в том, что если к моему приложению подключено более одного приложения для получения данных (эти приложения используют corebluetooth и играют центральные роли), то мое приложение получилоочень часто отключается от устройства IoT (каждые 5–10 минут).

В этом тестовом сценарии к моему приложению подключаются 3 приложения для получения данных через уведомление.

Тестовые устройства: iPad 6-го поколения 12.2, играет центральную роль при подключении к устройству IoT и играет периферийную роль при подключении к 3 другим приложениям.

Другие приложения работают на iPad 12.2,iPhone 5S iOS 11, iPad Air 12.2

Каждую секунду я видел столько журналов отправки данных в каждое приложение, почему corebluetooth использует слишком много связи через сообщения XPC?

default 16:31:50.232796 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.232963 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.233010 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.233051 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.233111 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.237711 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.237914 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.238059 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.239895 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.239961 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.240023 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.240187 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.240219 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.240281 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.240313 -0600 bluetoothd Received XPC message "CBMsgIdSendValueNotification" from session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.240343 -0600 bluetoothd Sending notification to device "01030BB5-AAE1-8EEA-F758-0EBE0DD85860"  
default 16:31:50.240373 -0600 bluetoothd Sending notification to device "5DC348FC-3354-19C0-5748-7F78953E556A"  
default 16:31:50.240452 -0600 bluetoothd Sending notification to device "19918C2D-7AF4-78FD-8030-36DBBC614167"  
default 16:31:50.240515 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.240618 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.240710 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.240780 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.240875 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.240906 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.240936 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.241065 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.241095 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.241125 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.241156 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.241187 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.241218 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.241248 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.241278 -0600 bluetoothd Received XPC message "CBMsgIdSendValueNotification" from session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.241380 -0600 bluetoothd Sending notification to device "01030BB5-AAE1-8EEA-F758-0EBE0DD85860"  
default 16:31:50.241410 -0600 bluetoothd Sending notification to device "5DC348FC-3354-19C0-5748-7F78953E556A"  
default 16:31:50.241471 -0600 bluetoothd Sending notification to device "19918C2D-7AF4-78FD-8030-36DBBC614167"  
default 16:31:50.241531 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.241561 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.241624 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.241654 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.241683 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.241714 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.241743 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.241773 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.242210 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.242283 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.242343 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.242430 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.242509 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.242590 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.244428 -0600 bluetoothd Received XPC message "CBMsgIdSendValueNotification" from session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.244459 -0600 bluetoothd Sending notification to device "01030BB5-AAE1-8EEA-F758-0EBE0DD85860"  
default 16:31:50.244488 -0600 bluetoothd Sending notification to device "5DC348FC-3354-19C0-5748-7F78953E556A"  
default 16:31:50.244518 -0600 bluetoothd Sending notification to device "19918C2D-7AF4-78FD-8030-36DBBC614167"  
default 16:31:50.244548 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.244578 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.244609 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.244639 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.244668 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.244698 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.244729 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.244759 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.244788 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.244818 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.244848 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.244879 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.244909 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.245185 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.245227 -0600 bluetoothd Received XPC message "CBMsgIdSendValueNotification" from session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.245258 -0600 bluetoothd Sending notification to device "01030BB5-AAE1-8EEA-F758-0EBE0DD85860"  
default 16:31:50.245288 -0600 bluetoothd Sending notification to device "5DC348FC-3354-19C0-5748-7F78953E556A"  
default 16:31:50.245317 -0600 bluetoothd Sending notification to device "19918C2D-7AF4-78FD-8030-36DBBC614167"  
default 16:31:50.245346 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.245413 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.245445 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.245491 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.245527 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.245558 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.245593 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.245624 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.245654 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.245683 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.245713 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.245743 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.246437 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.246469 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.246500 -0600 bluetoothd Received XPC message "CBMsgIdSendValueNotification" from session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.246531 -0600 bluetoothd Sending notification to device "01030BB5-AAE1-8EEA-F758-0EBE0DD85860"  
default 16:31:50.246561 -0600 bluetoothd Sending notification to device "5DC348FC-3354-19C0-5748-7F78953E556A"  
default 16:31:50.246591 -0600 bluetoothd Sending notification to device "19918C2D-7AF4-78FD-8030-36DBBC614167"  
default 16:31:50.246622 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.246866 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.246897 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.246927 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.246957 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.246986 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.247016 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.247047 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.247230 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.247260 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.247290 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.247320 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.247350 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.247381 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.247413 -0600 bluetoothd Received XPC message "CBMsgIdSendValueNotification" from session "com.mycompany.MyBLEApp-peripheral-230-18"  
default 16:31:50.247442 -0600 bluetoothd Sending notification to device "01030BB5-AAE1-8EEA-F758-0EBE0DD85860"  
default 16:31:50.247471 -0600 bluetoothd Sending notification to device "5DC348FC-3354-19C0-5748-7F78953E556A"  
default 16:31:50.247500 -0600 bluetoothd Sending notification to device "19918C2D-7AF4-78FD-8030-36DBBC614167"  
default 16:31:50.247530 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-0"  
default 16:31:50.247567 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-1"  
default 16:31:50.247598 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.locationd-central-57-4"  
default 16:31:50.247629 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-8"  
default 16:31:50.247659 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-central-55-6"  
default 16:31:50.247689 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-peripheral-71-5"  
default 16:31:50.247718 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-16"  
default 16:31:50.247748 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.BTLEServer-peripheral-187-12"  
default 16:31:50.247777 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-peripheral-53-2"  
default 16:31:50.247806 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.wirelessproxd-central-53-3"  
default 16:31:50.247869 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-central-230-17"  
default 16:31:50.247929 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.sharingd-peripheral-55-11"  
default 16:31:50.247989 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.apple.rapportd-central-71-25"  
default 16:31:50.248524 -0600 bluetoothd Sending XPC message "CBMsgIdReadyForUpdates" to session "com.mycompany.MyBLEApp-peripheral-230-18"  

Проблема послекаждые 5-10 минут я видел это сообщение:

default 16:31:50.984625 -0600 bluetoothd LE Link disconnected for handle 0x106a018b0 address Public A0:E6:F8:28:DF:8D with reason 708  

Мое приложение получило ответный вызов didDisconnectedPeripheral от corebluetooth для устройства IoT:

default 16:31:51.032169 -0600 MyBLEApp Disconnected peripheral <CBPeripheral: 0x282f64aa0, identifier = 37DE887F-674B-E861-3192-B29C7F31D3D9, name = IOTDEVICE, state = disconnected> (error: Error Domain=CBErrorDomain Code=6 "The connection has timed out unexpectedly." UserInfo={NSLocalizedDescription=The connection has timed out unexpectedly.})  

Почему corebluetooth не может сохранить соединение с IoTустройство?Это из-за того, что мое приложение играет периферийные роли, и могут ли другие приложения подключаться к нему?

Если я убью все другие приложения (центральная роль), после этого устройство IoT останется подключенным очень стабильно, и iPad, которыйиграет второстепенную роль, все еще занимаясь рекламой, когда она получает данные из Интернета вещей без каких-либо проблем.Спасибо.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...