attErrorRsp_t结构体如下所示:
/**
* Error Response format.
*/
typedef struct
{
uint8 reqOpcode; //!< Request that generated this error response
uint16 handle; //!< Attribute handle that generated error response
uint8 errCode; //!< Reason why the request has generated error response
} attErrorRsp_t;
注释里只说了errCode表示产生错误的原因,但是没有说明错误码代表的具体错误原因,请问在哪里可以找到?
user1735146:
找到了,在att.h文件里面,使用宏定义的一组错误码
#define ATT_ERR_INVALID_HANDLE0x01 //!< Attribute handle value given was not valid on this attribute server #define ATT_ERR_READ_NOT_PERMITTED0x02 //!< Attribute cannot be read #define ATT_ERR_WRITE_NOT_PERMITTED0x03 //!< Attribute cannot be written #define ATT_ERR_INVALID_PDU0x04 //!< The attribute PDU was invalid #define ATT_ERR_INSUFFICIENT_AUTHEN0x05 //!< The attribute requires authentication before it can be read or written #define ATT_ERR_UNSUPPORTED_REQ0x06 //!< Attribute server doesn't support the request received from the attribute client #define ATT_ERR_INVALID_OFFSET0x07 //!< Offset specified was past the end of the attribute #define ATT_ERR_INSUFFICIENT_AUTHOR0x08 //!< The attribute requires an authorization before it can be read or written #define ATT_ERR_PREPARE_QUEUE_FULL0x09 //!< Too many prepare writes have been queued #define ATT_ERR_ATTR_NOT_FOUND0x0a //!< No attribute found within the given attribute handle range #define ATT_ERR_ATTR_NOT_LONG0x0b //!< Attribute cannot be read or written using the Read Blob Request or Prepare Write Request #define ATT_ERR_INSUFFICIENT_KEY_SIZE0x0c //!< The Encryption Key Size used for encrypting this link is insufficient #define ATT_ERR_INVALID_VALUE_SIZE0x0d //!< The attribute value length is invalid for the operation #define ATT_ERR_UNLIKELY0x0e //!< The attribute request that was requested has encountered an error that was very unlikely, and therefore could not be completed as requested #define ATT_ERR_INSUFFICIENT_ENCRYPT0x0f //!< The attribute requires encryption before it can be read or written #define ATT_ERR_UNSUPPORTED_GRP_TYPE0x10 //!< The attribute type is not a supported grouping attribute as defined by a higher layer specification #define ATT_ERR_INSUFFICIENT_RESOURCES0x11 //!< Insufficient Resources to complete the request希望能把这些定义在一个枚举里面,然后在结构体的注释里说明,错误码由哪个枚举定义,这样找起来更方便一些
Viki Shi:
回复 user1735146:
感谢反馈。软件的架构TI是有一定规则的,改起来可能不太方便