BLE API as used in the blog entry.

Dependents:   BLE_iBeacon_Exercise

Fork of BLE_API_Native by Kevin Townsend

Committer:
donalm
Date:
Sun Feb 23 12:51:12 2014 +0000
Revision:
18:f776bb9efb7a
Parent:
0:4c3097c65247
Removed hw layer.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ktownsend 0:4c3097c65247 1 /* mbed Microcontroller Library
ktownsend 0:4c3097c65247 2 * Copyright (c) 2006-2013 ARM Limited
ktownsend 0:4c3097c65247 3 *
ktownsend 0:4c3097c65247 4 * Licensed under the Apache License, Version 2.0 (the "License");
ktownsend 0:4c3097c65247 5 * you may not use this file except in compliance with the License.
ktownsend 0:4c3097c65247 6 * You may obtain a copy of the License at
ktownsend 0:4c3097c65247 7 *
ktownsend 0:4c3097c65247 8 * http://www.apache.org/licenses/LICENSE-2.0
ktownsend 0:4c3097c65247 9 *
ktownsend 0:4c3097c65247 10 * Unless required by applicable law or agreed to in writing, software
ktownsend 0:4c3097c65247 11 * distributed under the License is distributed on an "AS IS" BASIS,
ktownsend 0:4c3097c65247 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ktownsend 0:4c3097c65247 13 * See the License for the specific language governing permissions and
ktownsend 0:4c3097c65247 14 * limitations under the License.
ktownsend 0:4c3097c65247 15 */
ktownsend 0:4c3097c65247 16
ktownsend 0:4c3097c65247 17 #ifndef __GAP_EVENTS_H__
ktownsend 0:4c3097c65247 18 #define __GAP_EVENTS_H__
ktownsend 0:4c3097c65247 19
ktownsend 0:4c3097c65247 20 #include "blecommon.h"
ktownsend 0:4c3097c65247 21 #include "mbed.h"
ktownsend 0:4c3097c65247 22
ktownsend 0:4c3097c65247 23 /**************************************************************************/
ktownsend 0:4c3097c65247 24 /*!
ktownsend 0:4c3097c65247 25 \brief
ktownsend 0:4c3097c65247 26 The base class used to abstract away the callback events that can be
ktownsend 0:4c3097c65247 27 triggered with the GAP.
ktownsend 0:4c3097c65247 28 */
ktownsend 0:4c3097c65247 29 /**************************************************************************/
ktownsend 0:4c3097c65247 30 class GapEvents {
ktownsend 0:4c3097c65247 31 public:
ktownsend 0:4c3097c65247 32 /******************************************************************/
ktownsend 0:4c3097c65247 33 /*!
ktownsend 0:4c3097c65247 34 \brief
ktownsend 0:4c3097c65247 35 Identifies GAP events generated by the radio HW when an event
ktownsend 0:4c3097c65247 36 callback occurs
ktownsend 0:4c3097c65247 37 */
ktownsend 0:4c3097c65247 38 /******************************************************************/
ktownsend 0:4c3097c65247 39 typedef enum gapEvent_e
ktownsend 0:4c3097c65247 40 {
ktownsend 0:4c3097c65247 41 GAP_EVENT_TIMEOUT = 1, /**< Advertising timed out before a connection was established */
ktownsend 0:4c3097c65247 42 GAP_EVENT_CONNECTED = 2, /**< A connection was established with a central device */
ktownsend 0:4c3097c65247 43 GAP_EVENT_DISCONNECTED = 3 /**< A connection was closed or lost with a central device */
ktownsend 0:4c3097c65247 44 } gapEvent_t;
ktownsend 0:4c3097c65247 45
ktownsend 0:4c3097c65247 46 /******************************************************************/
ktownsend 0:4c3097c65247 47 /*!
ktownsend 0:4c3097c65247 48 \brief
ktownsend 0:4c3097c65247 49 Advertising timed out before a connection was established
ktownsend 0:4c3097c65247 50 */
ktownsend 0:4c3097c65247 51 /******************************************************************/
ktownsend 0:4c3097c65247 52 virtual void onTimeout(void) {}
ktownsend 0:4c3097c65247 53
ktownsend 0:4c3097c65247 54 /******************************************************************/
ktownsend 0:4c3097c65247 55 /*!
ktownsend 0:4c3097c65247 56 \brief
ktownsend 0:4c3097c65247 57 A connection was established with a central device
ktownsend 0:4c3097c65247 58 */
ktownsend 0:4c3097c65247 59 /******************************************************************/
ktownsend 0:4c3097c65247 60 virtual void onConnected(void) {}
ktownsend 0:4c3097c65247 61
ktownsend 0:4c3097c65247 62 /******************************************************************/
ktownsend 0:4c3097c65247 63 /*!
ktownsend 0:4c3097c65247 64 \brief
ktownsend 0:4c3097c65247 65 A connection was closed or lost with a central device
ktownsend 0:4c3097c65247 66 */
ktownsend 0:4c3097c65247 67 /******************************************************************/
ktownsend 0:4c3097c65247 68 virtual void onDisconnected(void) {}
ktownsend 0:4c3097c65247 69 };
ktownsend 0:4c3097c65247 70
ktownsend 0:4c3097c65247 71 #endif