High level Bluetooth Low Energy API and radio abstraction layer
Dependents: BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more
GattCallbackParamTypes.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef __GATT_CALLBACK_PARAM_TYPES_H__ 00018 #define __GATT_CALLBACK_PARAM_TYPES_H__ 00019 00020 struct GattWriteCallbackParams { 00021 /** 00022 * Enumeration for write operations. 00023 */ 00024 enum WriteOp_t { 00025 OP_INVALID = 0x00, /**< Invalid operation. */ 00026 OP_WRITE_REQ = 0x01, /**< Write request. */ 00027 OP_WRITE_CMD = 0x02, /**< Write command. */ 00028 OP_SIGN_WRITE_CMD = 0x03, /**< Signed write command. */ 00029 OP_PREP_WRITE_REQ = 0x04, /**< Prepare write request. */ 00030 OP_EXEC_WRITE_REQ_CANCEL = 0x05, /**< Execute write request: cancel all prepared writes. */ 00031 OP_EXEC_WRITE_REQ_NOW = 0x06, /**< Execute write request: immediately execute all prepared writes. */ 00032 }; 00033 00034 Gap::Handle_t connHandle; /**< The handle of the connection that triggered the event */ 00035 GattAttribute::Handle_t handle; /**< Attribute Handle to which the write operation applies. */ 00036 WriteOp_t writeOp; /**< Type of write operation. */ 00037 uint16_t offset; /**< Offset for the write operation. */ 00038 uint16_t len; /**< Length (in bytes) of the data to write. */ 00039 /** 00040 * Pointer to the data to write. 00041 * 00042 * @note Data might not persist beyond the callback; make a local copy if 00043 * needed. 00044 */ 00045 const uint8_t *data; 00046 }; 00047 00048 struct GattReadCallbackParams { 00049 Gap::Handle_t connHandle; /**< The handle of the connection that triggered the event */ 00050 GattAttribute::Handle_t handle; /**< Attribute Handle to which the read operation applies. */ 00051 uint16_t offset; /**< Offset for the read operation. */ 00052 uint16_t len; /**< Length (in bytes) of the data to read. */ 00053 /** 00054 * Pointer to the data read. 00055 * 00056 * @note Data might not persist beyond the callback; make a local copy if 00057 * needed. 00058 */ 00059 const uint8_t *data; 00060 }; 00061 00062 enum GattAuthCallbackReply_t { 00063 AUTH_CALLBACK_REPLY_SUCCESS = 0x00, /**< Success. */ 00064 AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE = 0x0101, /**< ATT Error: Invalid attribute handle. */ 00065 AUTH_CALLBACK_REPLY_ATTERR_READ_NOT_PERMITTED = 0x0102, /**< ATT Error: Read not permitted. */ 00066 AUTH_CALLBACK_REPLY_ATTERR_WRITE_NOT_PERMITTED = 0x0103, /**< ATT Error: Write not permitted. */ 00067 AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHENTICATION = 0x0105, /**< ATT Error: Authenticated link required. */ 00068 AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET = 0x0107, /**< ATT Error: The specified offset was past the end of the attribute. */ 00069 AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION = 0x0108, /**< ATT Error: Used in ATT as "insufficient authorization". */ 00070 AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL = 0x0109, /**< ATT Error: Used in ATT as "prepare queue full". */ 00071 AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND = 0x010A, /**< ATT Error: Used in ATT as "attribute not found". */ 00072 AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_LONG = 0x010B, /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ 00073 AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH = 0x010D, /**< ATT Error: Invalid value size. */ 00074 AUTH_CALLBACK_REPLY_ATTERR_INSUF_RESOURCES = 0x0111, /**< ATT Error: Encrypted link required. */ 00075 }; 00076 00077 struct GattWriteAuthCallbackParams { 00078 Gap::Handle_t connHandle; /**< The handle of the connection that triggered the event */ 00079 GattAttribute::Handle_t handle; /**< Attribute Handle to which the write operation applies. */ 00080 uint16_t offset; /**< Offset for the write operation. */ 00081 uint16_t len; /**< Length of the incoming data. */ 00082 const uint8_t *data; /**< Incoming data, variable length. */ 00083 /** 00084 * This is the out parameter that the callback needs to set to 00085 * AUTH_CALLBACK_REPLY_SUCCESS for the request to proceed. 00086 */ 00087 GattAuthCallbackReply_t authorizationReply; 00088 }; 00089 00090 struct GattReadAuthCallbackParams { 00091 Gap::Handle_t connHandle; /**< The handle of the connection that triggered the event */ 00092 GattAttribute::Handle_t handle; /**< Attribute Handle to which the read operation applies. */ 00093 uint16_t offset; /**< Offset for the read operation. */ 00094 uint16_t len; /**< Optional: new length of the outgoing data. */ 00095 uint8_t *data; /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */ 00096 /** 00097 * This is the out parameter that the callback needs to set to 00098 * AUTH_CALLBACK_REPLY_SUCCESS for the request to proceed. 00099 */ 00100 GattAuthCallbackReply_t authorizationReply; 00101 }; 00102 00103 /** 00104 * For encapsulating handle-value update events (notifications or indications) 00105 * generated at the remote server. 00106 */ 00107 struct GattHVXCallbackParams { 00108 Gap::Handle_t connHandle; /**< The handle of the connection that triggered the event */ 00109 GattAttribute::Handle_t handle; /**< Attribute Handle to which the HVx operation applies. */ 00110 HVXType_t type; /**< Indication or Notification, see HVXType_t. */ 00111 uint16_t len; /**< Attribute data length. */ 00112 const uint8_t *data; /**< Attribute data, variable length. */ 00113 }; 00114 00115 #endif /*__GATT_CALLBACK_PARAM_TYPES_H__*/
Generated on Tue Jul 12 2022 12:49:01 by 1.7.2