BLE API as used in the blog entry.
Dependents: BLE_iBeacon_Exercise
Fork of BLE_API_Native by
hw/GattServerEvents.h@18:f776bb9efb7a, 2014-02-23 (annotated)
- Committer:
- donalm
- Date:
- Sun Feb 23 12:51:12 2014 +0000
- Revision:
- 18:f776bb9efb7a
- Parent:
- 17:d5600677d532
Removed hw layer.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ktownsend | 17:d5600677d532 | 1 | /* mbed Microcontroller Library |
ktownsend | 17:d5600677d532 | 2 | * Copyright (c) 2006-2013 ARM Limited |
ktownsend | 17:d5600677d532 | 3 | * |
ktownsend | 17:d5600677d532 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ktownsend | 17:d5600677d532 | 5 | * you may not use this file except in compliance with the License. |
ktownsend | 17:d5600677d532 | 6 | * You may obtain a copy of the License at |
ktownsend | 17:d5600677d532 | 7 | * |
ktownsend | 17:d5600677d532 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ktownsend | 17:d5600677d532 | 9 | * |
ktownsend | 17:d5600677d532 | 10 | * Unless required by applicable law or agreed to in writing, software |
ktownsend | 17:d5600677d532 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
ktownsend | 17:d5600677d532 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ktownsend | 17:d5600677d532 | 13 | * See the License for the specific language governing permissions and |
ktownsend | 17:d5600677d532 | 14 | * limitations under the License. |
ktownsend | 17:d5600677d532 | 15 | */ |
ktownsend | 17:d5600677d532 | 16 | |
ktownsend | 17:d5600677d532 | 17 | #ifndef __GATT_SERVER_EVENTS_H__ |
ktownsend | 17:d5600677d532 | 18 | #define __GATT_SERVER_EVENTS_H__ |
ktownsend | 17:d5600677d532 | 19 | |
ktownsend | 17:d5600677d532 | 20 | #include "blecommon.h" |
ktownsend | 17:d5600677d532 | 21 | #include "mbed.h" |
ktownsend | 17:d5600677d532 | 22 | |
ktownsend | 17:d5600677d532 | 23 | /**************************************************************************/ |
ktownsend | 17:d5600677d532 | 24 | /*! |
ktownsend | 17:d5600677d532 | 25 | \brief |
ktownsend | 17:d5600677d532 | 26 | The base class used to abstract away the callback events that can be |
ktownsend | 17:d5600677d532 | 27 | triggered with the GATT Server. |
ktownsend | 17:d5600677d532 | 28 | */ |
ktownsend | 17:d5600677d532 | 29 | /**************************************************************************/ |
ktownsend | 17:d5600677d532 | 30 | class GattServerEvents { |
ktownsend | 17:d5600677d532 | 31 | public: |
ktownsend | 17:d5600677d532 | 32 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 33 | /*! |
ktownsend | 17:d5600677d532 | 34 | \brief |
ktownsend | 17:d5600677d532 | 35 | Identifies GATT events generated by the radio HW when an event |
ktownsend | 17:d5600677d532 | 36 | callback occurs |
ktownsend | 17:d5600677d532 | 37 | */ |
ktownsend | 17:d5600677d532 | 38 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 39 | typedef enum gattEvent_e |
ktownsend | 17:d5600677d532 | 40 | { |
ktownsend | 17:d5600677d532 | 41 | GATT_EVENT_DATA_SENT = 1, /**< Fired when a msg was successfully sent out (notify only?) */ |
ktownsend | 17:d5600677d532 | 42 | GATT_EVENT_DATA_WRITTEN = 2, /**< Client wrote data to Server (separate into char and descriptor writes?) */ |
ktownsend | 17:d5600677d532 | 43 | GATT_EVENT_UPDATES_ENABLED = 3, /**< Notify/Indicate Enabled in CCCD */ |
ktownsend | 17:d5600677d532 | 44 | GATT_EVENT_UPDATES_DISABLED = 4, /**< Notify/Indicate Disabled in CCCD */ |
ktownsend | 17:d5600677d532 | 45 | GATT_EVENT_CONFIRMATION_RECEIVED = 5 /**< Response received from Indicate message */ |
ktownsend | 17:d5600677d532 | 46 | } gattEvent_t; |
ktownsend | 17:d5600677d532 | 47 | |
ktownsend | 17:d5600677d532 | 48 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 49 | /*! |
ktownsend | 17:d5600677d532 | 50 | \brief |
ktownsend | 17:d5600677d532 | 51 | A message was successfully transmitted |
ktownsend | 17:d5600677d532 | 52 | */ |
ktownsend | 17:d5600677d532 | 53 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 54 | virtual void onDataSent(uint16_t charHandle) {} |
ktownsend | 17:d5600677d532 | 55 | |
ktownsend | 17:d5600677d532 | 56 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 57 | /*! |
ktownsend | 17:d5600677d532 | 58 | \brief |
ktownsend | 17:d5600677d532 | 59 | The GATT client (the phone, tablet, etc.) wrote data to a |
ktownsend | 17:d5600677d532 | 60 | characteristic or descriptor on the GATT Server (the peripheral |
ktownsend | 17:d5600677d532 | 61 | device). |
ktownsend | 17:d5600677d532 | 62 | */ |
ktownsend | 17:d5600677d532 | 63 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 64 | virtual void onDataWritten(uint16_t charHandle) {} |
ktownsend | 17:d5600677d532 | 65 | |
ktownsend | 17:d5600677d532 | 66 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 67 | /*! |
ktownsend | 17:d5600677d532 | 68 | \brief |
ktownsend | 17:d5600677d532 | 69 | A Notify or Indicate flag was enabled in the CCCD |
ktownsend | 17:d5600677d532 | 70 | */ |
ktownsend | 17:d5600677d532 | 71 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 72 | virtual void onUpdatesEnabled(uint16_t charHandle) {} |
ktownsend | 17:d5600677d532 | 73 | |
ktownsend | 17:d5600677d532 | 74 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 75 | /*! |
ktownsend | 17:d5600677d532 | 76 | \brief |
ktownsend | 17:d5600677d532 | 77 | A Notify or Indicate flag was disabled in the CCCD |
ktownsend | 17:d5600677d532 | 78 | */ |
ktownsend | 17:d5600677d532 | 79 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 80 | virtual void onUpdatesDisabled(uint16_t charHandle) {} |
ktownsend | 17:d5600677d532 | 81 | |
ktownsend | 17:d5600677d532 | 82 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 83 | /*! |
ktownsend | 17:d5600677d532 | 84 | \brief |
ktownsend | 17:d5600677d532 | 85 | A confirmation response was received from an Indicate message |
ktownsend | 17:d5600677d532 | 86 | */ |
ktownsend | 17:d5600677d532 | 87 | /******************************************************************/ |
ktownsend | 17:d5600677d532 | 88 | virtual void onConfirmationReceived(uint16_t charHandle) {} |
ktownsend | 17:d5600677d532 | 89 | }; |
ktownsend | 17:d5600677d532 | 90 | |
ktownsend | 17:d5600677d532 | 91 | #endif |