Minor temporary patch to allow DFU packet callback

Fork of BLE_API by Bluetooth Low Energy

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GattCharacteristicCallbackParams.h Source File

GattCharacteristicCallbackParams.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_CHARACTERISTIC_CALLBACK_PARAMS_H__
00018 #define __GATT_CHARACTERISTIC_CALLBACK_PARAMS_H__
00019 
00020 struct GattCharacteristicWriteCBParams {
00021     GattAttribute::Handle_t charHandle;
00022     enum Type {
00023         GATTS_CHAR_OP_INVALID               = 0x00,  /**< Invalid Operation. */
00024         GATTS_CHAR_OP_WRITE_REQ             = 0x01,  /**< Write Request. */
00025         GATTS_CHAR_OP_WRITE_CMD             = 0x02,  /**< Write Command. */
00026         GATTS_CHAR_OP_SIGN_WRITE_CMD        = 0x03,  /**< Signed Write Command. */
00027         GATTS_CHAR_OP_PREP_WRITE_REQ        = 0x04,  /**< Prepare Write Request. */
00028         GATTS_CHAR_OP_EXEC_WRITE_REQ_CANCEL = 0x05,  /**< Execute Write Request: Cancel all prepared writes. */
00029         GATTS_CHAR_OP_EXEC_WRITE_REQ_NOW    = 0x06,  /**< Execute Write Request: Immediately execute all prepared writes. */
00030     } op;                  /**< Type of write operation, */
00031     uint16_t       offset; /**< Offset for the write operation. */
00032     uint16_t       len;    /**< Length of the incoming data. */
00033     const uint8_t *data;   /**< Incoming data, variable length. */
00034 };
00035 
00036 struct GattCharacteristicReadCBParams {
00037     GattAttribute::Handle_t charHandle;
00038     enum Type {
00039         GATTS_CHAR_OP_INVALID               = 0x00,  /**< Invalid Operation. */
00040         GATTS_CHAR_OP_READ_REQ              = 0x0A,  /**< Read Request. */
00041     } op;                  /**< Type of write operation, */
00042     uint16_t       offset; /**< Offset for the read operation. */
00043     uint16_t       *len;   /**< Length of the outgoing data. */
00044     uint8_t        *data;  /**< Outgoing data, variable length. */
00045 };
00046 
00047 enum GattCharacteristicAuthCBReply_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: Offset specified was past the end of the attribute. */
00054     AUTH_CALLBACK_REPLY_ATTERR_INSUF_AUTHORIZATION =    0x0108,  /**< ATT Error: Used in ATT as Insufficient Authorisation. */
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 GattCharacteristicWriteAuthCBParams {
00063     GattAttribute::Handle_t  charHandle;
00064     uint16_t                 offset; /**< Offset for the write operation. */
00065     uint16_t                 len;    /**< Length of the incoming data. */
00066     const uint8_t           *data;   /**< Incoming data, variable length. */
00067     GattCharacteristicAuthCBReply_t authorizationReply; /* This is the out parameter which needs to be set to true by the callback if the
00068                                                          * request is to proceed; false otherwise. */
00069 };
00070 
00071 struct GattCharacteristicReadAuthCBParams {
00072     GattAttribute::Handle_t  charHandle;
00073     uint16_t                 offset; /**< Offset for the read operation. */
00074     uint16_t                 len;    /**< Optional: new length of the outgoing data. */
00075     uint8_t                 *data;   /**< Optional: new outgoing data. Leave at NULL if data is unchanged. */
00076     GattCharacteristicAuthCBReply_t authorizationReply; /* This is the out parameter which needs to be set to true by the callback if the
00077                                                          * request is to proceed; false otherwise. */
00078 };
00079 
00080 #endif /*__GATT_CHARACTERISTIC_CALLBACK_PARAMS_H__*/