my version with changed conversion between duration units

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     GattAttribute::Handle_t  handle;
00032     WriteOp_t                writeOp; /**< Type of write operation, */
00033     uint16_t                 offset;  /**< Offset for the write operation. */
00034     uint16_t                 len;
00035     const uint8_t           *data;    /* @note: data might not persist beyond the callback; make a local copy if needed. */
00036 };
00037 
00038 struct GattReadCallbackParams {
00039     GattAttribute::Handle_t  handle;
00040     uint16_t                 offset;  /**< Offset for the read operation. */
00041     uint16_t                 len;
00042     const uint8_t           *data;    /* @note: data might not persist beyond the callback; make a local copy if needed. */
00043 };
00044 
00045 enum GattAuthCallbackReply_t {
00046     AUTH_CALLBACK_REPLY_SUCCESS =                       0x00,    /**< Success. */
00047     AUTH_CALLBACK_REPLY_ATTERR_INVALID_HANDLE =         0x0101,  /**< ATT Error: Invalid Attribute Handle. */
00048     AUTH_CALLBACK_REPLY_ATTERR_READ_NOT_PERMITTED =     0x0102,  /**< ATT Error: Read not permitted. */
00049     AUTH_CALLBACK_REPLY_ATTERR_WRITE_NOT_PERMITTED =    0x0103,  /**< ATT Error: Write not permitted. */
00050     AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHENTICATION =   0x0105,  /**< ATT Error: Authenticated link required. */
00051     AUTH_CALLBACK_REPLY_ATTERR_INVALID_OFFSET =         0x0107,  /**< ATT Error: Offset specified was past the end of the attribute. */
00052     AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION =    0x0108,  /**< ATT Error: Used in ATT as Insufficient Authorisation. */
00053     AUTH_CALLBACK_REPLY_ATTERR_PREPARE_QUEUE_FULL =     0x0109,  /**< ATT Error: Used in ATT as Prepare Queue Full. */
00054     AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_FOUND =    0x010A,  /**< ATT Error: Used in ATT as Attribute not found. */
00055     AUTH_CALLBACK_REPLY_ATTERR_ATTRIBUTE_NOT_LONG =     0x010B,  /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */
00056     AUTH_CALLBACK_REPLY_ATTERR_INVALID_ATT_VAL_LENGTH = 0x010D,  /**< ATT Error: Invalid value size. */
00057     AUTH_CALLBACK_REPLY_ATTERR_INSUF_RESOURCES =        0x0111,  /**< ATT Error: Encrypted link required. */
00058 };
00059 
00060 struct GattWriteAuthCallbackParams {
00061     GattAttribute::Handle_t  handle;
00062     uint16_t                 offset; /**< Offset for the write operation. */
00063     uint16_t                 len;    /**< Length of the incoming data. */
00064     const uint8_t           *data;   /**< Incoming data, variable length. */
00065     GattAuthCallbackReply_t  authorizationReply; /* This is the out parameter which needs to be set to true by the callback if the
00066                                                   * request is to proceed; false otherwise. */
00067 };
00068 
00069 struct GattReadAuthCallbackParams {
00070     GattAttribute::Handle_t  handle;
00071     uint16_t                 offset; /**< Offset for the read operation. */
00072     uint16_t                 len;    /**< Optional: new length of the outgoing data. */
00073     uint8_t                 *data;   /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */
00074     GattAuthCallbackReply_t  authorizationReply; /* This is the out parameter which needs to be set to true by the callback if the
00075                                                   * request is to proceed; false otherwise. */
00076 };
00077 
00078 /* For encapsulating handle-value update events (notifications or indications) generated at the remote server. */
00079 struct GattHVXCallbackParams {
00080   GattAttribute::Handle_t  handle; /**< Attribute Handle to which the HVx operation applies. */
00081   HVXType_t                type;   /**< Indication or Notification, see @ref HVXType_t. */
00082   uint16_t                 len;    /**< Attribute data length. */
00083   const uint8_t           *data;   /**< Attribute data, variable length. */
00084 };
00085 
00086 #endif /*__GATT_CALLBACK_PARAM_TYPES_H__*/