add "LE Device Address" 0x1B to advertising data types

Fork of BLE_API by Bluetooth Low Energy

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GattCallbackParamTypes.h Source File

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     enum WriteOp_t {
00022         OP_INVALID               = 0x00,  /**< Invalid operation. */
00023         OP_WRITE_REQ             = 0x01,  /**< Write request. */
00024         OP_WRITE_CMD             = 0x02,  /**< Write command. */
00025         OP_SIGN_WRITE_CMD        = 0x03,  /**< Signed write command. */
00026         OP_PREP_WRITE_REQ        = 0x04,  /**< Prepare write request. */
00027         OP_EXEC_WRITE_REQ_CANCEL = 0x05,  /**< Execute write request: cancel all prepared writes. */
00028         OP_EXEC_WRITE_REQ_NOW    = 0x06,  /**< Execute write request: immediately execute all prepared writes. */
00029     };
00030 
00031     Gap::Handle_t            connHandle;
00032     GattAttribute::Handle_t  handle;
00033     WriteOp_t                writeOp; /**< Type of write operation. */
00034     uint16_t                 offset;  /**< Offset for the write operation. */
00035     uint16_t                 len;
00036     const uint8_t           *data;    /* @note: Data might not persist beyond the callback; make a local copy if needed. */
00037 };
00038 
00039 struct GattReadCallbackParams {
00040     Gap::Handle_t            connHandle;
00041     GattAttribute::Handle_t  handle;
00042     uint16_t                 offset;  /**< Offset for the read operation. */
00043     uint16_t                 len;
00044     const uint8_t           *data;    /* @note: Data might not persist beyond the callback; make a local copy if needed. */
00045 };
00046 
00047 enum GattAuthCallbackReply_t {
00048     AUTH_CALLBACK_REPLY_SUCCESS                       = 0x00,    /**< Success. */
00049     AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE         = 0x0101,  /**< ATT Error: Invalid attribute handle. */
00050     AUTH_CALLBACK_REPLY_ATTERR_READ_NOT_PERMITTED     = 0x0102,  /**< ATT Error: Read not permitted. */
00051     AUTH_CALLBACK_REPLY_ATTERR_WRITE_NOT_PERMITTED    = 0x0103,  /**< ATT Error: Write not permitted. */
00052     AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHENTICATION   = 0x0105,  /**< ATT Error: Authenticated link required. */
00053     AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET         = 0x0107,  /**< ATT Error: The specified offset was past the end of the attribute. */
00054     AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION    = 0x0108,  /**< ATT Error: Used in ATT as "insufficient authorization". */
00055     AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL     = 0x0109,  /**< ATT Error: Used in ATT as "prepare queue full". */
00056     AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND    = 0x010A,  /**< ATT Error: Used in ATT as "attribute not found". */
00057     AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_LONG     = 0x010B,  /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */
00058     AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH = 0x010D,  /**< ATT Error: Invalid value size. */
00059     AUTH_CALLBACK_REPLY_ATTERR_INSUF_RESOURCES        = 0x0111,  /**< ATT Error: Encrypted link required. */
00060 };
00061 
00062 struct GattWriteAuthCallbackParams {
00063     Gap::Handle_t            connHandle;
00064     GattAttribute::Handle_t  handle;
00065     uint16_t                 offset; /**< Offset for the write operation. */
00066     uint16_t                 len;    /**< Length of the incoming data. */
00067     const uint8_t           *data;   /**< Incoming data, variable length. */
00068     GattAuthCallbackReply_t  authorizationReply; /* This is the out parameter that the callback 
00069                                                   * needs to set to AUTH_CALLBACK_REPLY_SUCCESS 
00070                                                   * for the request to proceed. */
00071 };
00072 
00073 struct GattReadAuthCallbackParams {
00074     Gap::Handle_t            connHandle;
00075     GattAttribute::Handle_t  handle;
00076     uint16_t                 offset; /**< Offset for the read operation. */
00077     uint16_t                 len;    /**< Optional: new length of the outgoing data. */
00078     uint8_t                 *data;   /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */
00079     GattAuthCallbackReply_t  authorizationReply; /* This is the out parameter that the callback
00080                                                   * needs to set to AUTH_CALLBACK_REPLY_SUCCESS
00081                                                   * for the request to proceed. */
00082 };
00083 
00084 /* For encapsulating handle-value update events (notifications or indications) generated at the remote server. */
00085 struct GattHVXCallbackParams {
00086   Gap::Handle_t            connHandle;
00087   GattAttribute::Handle_t  handle; /**< Attribute Handle to which the HVx operation applies. */
00088   HVXType_t                type;   /**< Indication or Notification, see @ref HVXType_t. */
00089   uint16_t                 len;    /**< Attribute data length. */
00090   const uint8_t           *data;   /**< Attribute data, variable length. */
00091 };
00092 
00093 #endif /*__GATT_CALLBACK_PARAM_TYPES_H__*/