Example for Bluetooth low energy interface

Dependencies:   mbed HC_SR04_Ultrasonic_Library

Committer:
julientiron
Date:
Tue May 19 20:42:25 2015 +0000
Revision:
3:829f081fde15
Parent:
0:3d641e170a74
hihi;

Who changed what in which revision?

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