我现在正在测试生命周期/稳健性问题,需要调试偶尔出现的核心蓝牙错误,例如 #242。
Apple 是否列出了每个核心蓝牙错误的含义?
最佳答案
通常,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 存在某些会显示任意错误代码的问题。比如你作为外设app在一定时间内没有响应请求,那么返回的错误码没有任何意义。
真正的错误代码总是只在打印到控制台的警告中可见。 NSError 没有提供我目前遇到的任何 CoreBluetooth 情况下的任何详细信息。
关于ios - 在哪里可以找到 Core Bluetooth 的 Apple iOS 错误列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19117512/