New version

Based on the main repo's master version, with edits to the API.
This commit is contained in:
Irit Arkin 2015-11-16 13:25:02 +00:00
parent ac28368019
commit 737d0e845a

View file

@ -19,21 +19,21 @@
struct GattWriteCallbackParams {
enum WriteOp_t {
OP_INVALID = 0x00, /**< Invalid Operation. */
OP_WRITE_REQ = 0x01, /**< Write Request. */
OP_WRITE_CMD = 0x02, /**< Write Command. */
OP_SIGN_WRITE_CMD = 0x03, /**< Signed Write Command. */
OP_PREP_WRITE_REQ = 0x04, /**< Prepare Write Request. */
OP_EXEC_WRITE_REQ_CANCEL = 0x05, /**< Execute Write Request: Cancel all prepared writes. */
OP_EXEC_WRITE_REQ_NOW = 0x06, /**< Execute Write Request: Immediately execute all prepared writes. */
OP_INVALID = 0x00, /**< Invalid operation. */
OP_WRITE_REQ = 0x01, /**< Write request. */
OP_WRITE_CMD = 0x02, /**< Write command. */
OP_SIGN_WRITE_CMD = 0x03, /**< Signed write command. */
OP_PREP_WRITE_REQ = 0x04, /**< Prepare write request. */
OP_EXEC_WRITE_REQ_CANCEL = 0x05, /**< Execute write request: cancel all prepared writes. */
OP_EXEC_WRITE_REQ_NOW = 0x06, /**< Execute write request: immediately execute all prepared writes. */
};
Gap::Handle_t connHandle;
GattAttribute::Handle_t handle;
WriteOp_t writeOp; /**< Type of write operation, */
WriteOp_t writeOp; /**< Type of write operation. */
uint16_t offset; /**< Offset for the write operation. */
uint16_t len;
const uint8_t *data; /* @note: data might not persist beyond the callback; make a local copy if needed. */
const uint8_t *data; /* @note: Data might not persist beyond the callback; make a local copy if needed. */
};
struct GattReadCallbackParams {
@ -41,19 +41,19 @@ struct GattReadCallbackParams {
GattAttribute::Handle_t handle;
uint16_t offset; /**< Offset for the read operation. */
uint16_t len;
const uint8_t *data; /* @note: data might not persist beyond the callback; make a local copy if needed. */
const uint8_t *data; /* @note: Data might not persist beyond the callback; make a local copy if needed. */
};
enum GattAuthCallbackReply_t {
AUTH_CALLBACK_REPLY_SUCCESS = 0x00, /**< Success. */
AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE = 0x0101, /**< ATT Error: Invalid Attribute Handle. */
AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE = 0x0101, /**< ATT Error: Invalid attribute handle. */
AUTH_CALLBACK_REPLY_ATTERR_READ_NOT_PERMITTED = 0x0102, /**< ATT Error: Read not permitted. */
AUTH_CALLBACK_REPLY_ATTERR_WRITE_NOT_PERMITTED = 0x0103, /**< ATT Error: Write not permitted. */
AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHENTICATION = 0x0105, /**< ATT Error: Authenticated link required. */
AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET = 0x0107, /**< ATT Error: Offset specified was past the end of the attribute. */
AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION = 0x0108, /**< ATT Error: Used in ATT as Insufficient Authorisation. */
AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL = 0x0109, /**< ATT Error: Used in ATT as Prepare Queue Full. */
AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND = 0x010A, /**< ATT Error: Used in ATT as Attribute not found. */
AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET = 0x0107, /**< ATT Error: The specified offset was past the end of the attribute. */
AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION = 0x0108, /**< ATT Error: Used in ATT as "insufficient authorization". */
AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL = 0x0109, /**< ATT Error: Used in ATT as "prepare queue full". */
AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND = 0x010A, /**< ATT Error: Used in ATT as "attribute not found". */
AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_LONG = 0x010B, /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */
AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH = 0x010D, /**< ATT Error: Invalid value size. */
AUTH_CALLBACK_REPLY_ATTERR_INSUF_RESOURCES = 0x0111, /**< ATT Error: Encrypted link required. */
@ -65,9 +65,9 @@ struct GattWriteAuthCallbackParams {
uint16_t offset; /**< Offset for the write operation. */
uint16_t len; /**< Length of the incoming data. */
const uint8_t *data; /**< Incoming data, variable length. */
GattAuthCallbackReply_t authorizationReply; /* This is the out parameter which needs to be set to
* AUTH_CALLBACK_REPLY_SUCCESS by the callback if the
* request is to proceed. */
GattAuthCallbackReply_t authorizationReply; /* This is the out parameter that the callback
* needs to set to AUTH_CALLBACK_REPLY_SUCCESS
* for the request to proceed. */
};
struct GattReadAuthCallbackParams {
@ -76,9 +76,9 @@ struct GattReadAuthCallbackParams {
uint16_t offset; /**< Offset for the read operation. */
uint16_t len; /**< Optional: new length of the outgoing data. */
uint8_t *data; /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */
GattAuthCallbackReply_t authorizationReply; /* This is the out parameter which needs to be set to
* AUTH_CALLBACK_REPLY_SUCCESS by the callback if the
* request is to proceed. */
GattAuthCallbackReply_t authorizationReply; /* This is the out parameter that the callback
* needs to set to AUTH_CALLBACK_REPLY_SUCCESS
* for the request to proceed. */
};
/* For encapsulating handle-value update events (notifications or indications) generated at the remote server. */