5

我现在正在测试寿命/鲁棒性问题,需要调试偶尔的核心蓝牙错误,例如 #242。

Apple 是否提供了每个核心蓝牙错误的含义列表?

4

2 回答 2

5

通常,CoreBluetooth 使用Bluetooth Core Spec V4.0 Vol 3 Part F Sec 3.4.1.1 Table 3.3 Error Codes中定义的标准错误代码。

                             Error 
Name                         Code  Description
==============================================================================
Invalid Handle               0x01  The attribute handle given was not valid on 
                                   this server.
Read Not Permitted           0x02  The attribute cannot be read.
Write Not Permitted          0x03  The attribute cannot be written.
Invalid PDU                  0x04  The attribute PDU was invalid.
Insufficient Authentication  0x05  The attribute requires authentication 
                                   before it can be read or written.
Request Not Supported        0x06  Attribute server does not support the 
                                   request received from the client.
Invalid Offset               0x07  Offset specified was past the end of the 
                                   attribute.
Insufficient Authorization   0x08  The attribute requires authorization before 
                                   it can be read or written.
Prepare Queue Full           0x09  Too many prepare writes have been queued.
Attribute Not Found          0x0A  No attribute found within the given 
                                   attribute handle range.
Attribute Not Long           0x0B  The attribute cannot be read or written 
                                   using the Read Blob Request
Insufficient Encryption Key  0x0C  The Encryption Key Size used for encrypting
Size                               this link is insufficient.
Invalid Attribute Value      0x0D  The attribute value length is invalid for 
Length                             the operation.
Unlikely Error               0x0E  The attribute request that was requested 
                                   has encountered an error that was unlikely, 
                                   and therefore could not be completed as 
                                   requested. 
Insufficient Encryption      0x0F  The attribute requires encryption before it 
                                   can be read or written.
Unsupported Group Type       0x10  The attribute type is not a supported 
                                   grouping attribute as defined by a higher 
                                   layer specification.
Insufficient Resources       0x11  Insufficient Resources to complete the 
                                   request
Reserved             0x012 – 0x7F  Reserved for future use.
Application Error     0x80 – 0xFF  Application error code defined by a higher 
                                   layer specification.

请注意,iOS 存在某些显示任意错误代码的问题。例如,如果您作为外围应用程序在一定时间内没有响应请求,则返回的错误代码没有任何意义。

真正的错误代码始终仅在打印到控制台的警告中可见。NSError 在任何情况下都没有提供我迄今为止遇到的 CoreBluetooth 的任何详细信息。

于 2013-10-24T09:45:01.480 回答
2

Apple 的文档包含一个CoreBluetooth 常量列表,其中包含您将从框架收到的大多数错误代码。

我还为 CoreBluetooth 创建了一个 Wikia 站点,以收集有关人们遇到特定错误的情况的更多信息。

于 2013-10-24T02:29:28.117 回答