This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2540 termination reason from LL 参数的说明

Other Parts Discussed in Thread: CC2540

请问各位:

cc2540 做为Central角色连接上了外围设备,之后连接断开,会返回 pEvent->linkTerminate.reason,表示原因的参数,请问关于terminate reason参数的说明在哪里可以找到啊?谢谢!

  • LL.h有定义,搜索LL_STATUS_ERROR_。

     

  • /*
    ** LL API Status Codes
    **
    ** Note: These status values map directly to the HCI Error Codes.
    **       Per the Bluetooth Core Specification, V4.0.0, Vol. 2, Part D.
    */
    #define LL_STATUS_SUCCESS                              0x00 // Success
    #define LL_STATUS_ERROR_UNKNOWN_CONN_HANDLE            0x02 // Unknown Connection Identifier
    #define LL_STATUS_ERROR_INACTIVE_CONNECTION            0x02 // Unknown Connection Identifier for now; may be needed for multiple connections
    #define LL_STATUS_ERROR_AUTH_FAILURE                   0x05 // Authentication Failure
    #define LL_STATUS_ERROR_PIN_OR_KEY_MISSING             0x06 // Pin or Key Missing
    #define LL_STATUS_ERROR_OUT_OF_CONN_RESOURCES          0x07 // Memory Capacity Exceeded
    #define LL_STATUS_ERROR_OUT_OF_TX_MEM                  0x07 // Memory Capacity Exceeded
    #define LL_STATUS_ERROR_OUT_OF_RX_MEM                  0x07 // Memory Capacity Exceeded
    #define LL_STATUS_ERROR_OUT_OF_HEAP                    0x07 // Memory Capacity Exceeded
    #define LL_STATUS_ERROR_WL_TABLE_FULL                  0x07 // Memory Capacity Exceeded
    #define LL_STATUS_ERROR_CONNECTION_TIMEOUT             0x08 // Connection Timeout
    #define LL_STATUS_ERROR_CONNECTION_LIMIT_EXCEEDED      0x09 // Connection Limit Exceeded
    #define LL_STATUS_ERROR_COMMAND_DISALLOWED             0x0C // Command Disallowed
    #define LL_STATUS_ERROR_DUE_TO_LIMITED_RESOURCES       0x0D // Command Rejected Due To Limited Resources
    #define LL_STATUS_ERROR_DUE_TO_DELAYED_RESOURCES       0x0D // Command Delayed Due To Limited Resources
    #define LL_STATUS_ERROR_FEATURE_NOT_SUPPORTED          0x11 // Unsupported Feature or Parameter Value
    #define LL_STATUS_ERROR_UNEXPECTED_PARAMETER           0x12 // Invalid HCI Command Parameters
    #define LL_STATUS_ERROR_ILLEGAL_PARAM_COMBINATION      0x12 // Invalid HCI Command Parameters
    #define LL_STATUS_ERROR_BAD_PARAMETER                  0x12 // Invalid HCI Command Parameters or 0x30: Parameter Out of Mandatory Range?
    #define LL_STATUS_ERROR_UNKNOWN_ADV_EVT_TYPE           0x12 // Invalid HCI Command Parameters or 0x30: Parameter Out of Mandatory Range?
    #define LL_STATUS_ERROR_PEER_TERM                      0x13 // Remote User Terminated Connection
    #define LL_STATUS_ERROR_PEER_DEVICE_TERM_LOW_RESOURCES 0x14 // Remote Device Terminated Connection Due To Low Resources
    #define LL_STATUS_ERROR_PEER_DEVICE_TERM_POWER_OFF     0x15 // Remote Device Terminated Connection Due To Power Off
    #define LL_STATUS_ERROR_HOST_TERM                      0x16 // Connection Terminated By Local Host
    #define LL_STATUS_ERROR_UNSUPPORTED_REMOTE_FEATURE     0x1A // Unsupported Remote Feature
    #define LL_STATUS_ERROR_WL_ENTRY_NOT_FOUND             0x1F // Unspecified Error
    #define LL_STATUS_ERROR_WL_TABLE_EMPTY                 0x1F // Unspecified Error
    #define LL_STATUS_ERROR_RNG_FAILURE                    0x1F // Unspecified Error
    #define LL_STATUS_ERROR_DISCONNECT_IMMEDIATE           0x1F // Unspecified Error
    #define LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE          0x21 // Role Change Not Allowed
    #define LL_STATUS_ERROR_LL_TIMEOUT                     0x22 // Link Layer Response Timeout
    #define LL_STATUS_ERROR_LL_TIMEOUT_HOST                0x22 // Link Layer Response Timeout
    #define LL_STATUS_ERROR_LL_TIMEOUT_PEER                0x22 // Link Layer Response Timeout
    #define LL_STATUS_ERROR_INSTANT_PASSED                 0x28 // Instant Passed
    #define LL_STATUS_ERROR_INSTANT_PASSED_HOST            0x28 // Instant Passed
    #define LL_STATUS_ERROR_INSTANT_PASSED_PEER            0x28 // Instant Passed
    #define LL_STATUS_ERROR_KEY_PAIRING_NOT_SUPPORTED      0x29 // Pairing With Unit Key Not Supported
    #define LL_STATUS_ERROR_NO_ADV_CHAN_FOUND              0x30 // Parameter Out Of Mandatory Range
    #define LL_STATUS_ERROR_PARAM_OUT_OF_RANGE             0x30 // Parameter Out Of Mandatory Range
    #define LL_STATUS_ERROR_UPDATE_CTRL_PROC_PENDING       0x3A // Controller Busy
    #define LL_STATUS_ERROR_CTRL_PROC_ALREADY_ACTIVE       0x3A // Controller Busy
    #define LL_STATUS_ERROR_VER_INFO_REQ_ALREADY_PENDING   0x3A // Controller Busy
    #define LL_STATUS_ERROR_UNACCEPTABLE_CONN_INTERVAL     0x3B // Unacceptable Connection Interval
    #define LL_STATUS_ERROR_DIRECTED_ADV_TIMEOUT           0x3C // Directed Advertising Timeout
    #define LL_STATUS_ERROR_CONN_TERM_DUE_TO_MIC_FAILURE   0x3D // Connection Terminated Due To MIC Failure
    #define LL_STATUS_ERROR_CONN_FAILED_TO_BE_ESTABLISHED  0x3E // Connection Failed To Be Established
    #define LL_STATUS_ERROR_CONN_TIMING_FAILURE            0x3F // MAC Connection Failed

  • 谢谢!

    当central操作断开连接的话,返回0x22 ,( Link Layer Response Timeout)

    当从机电源断开导致的断开连接,返回0x08,(Connection Timeout)

    但是我还无意中测到一个返回值是:0x63 ,在LL.h里找不到,请问这个值代表什么?

  • 截个图吧,0x63肯定不是蓝牙的Error code descriptions.你去翻蓝牙手册,最多到0x3F.

  • 是无意中看到的,后来一直还没重现,等我抓到有效信息了再向您请教吧。谢谢!

  • 有帮助的话,请先确认close掉这个帖子,下次有问题再post

  • 0x3F // MAC Connection Failed

    这个一般是什么情况才会出现??