Maxim Integrated Bluetooth LE Library

Dependents:   BLE_Thermometer MAXWSNENV_demo

Committer:
enginerd
Date:
Thu Mar 03 14:13:21 2016 +0000
Revision:
0:b562096246b3
Child:
5:5b87f64ce81e
Initial commit of Maxim Integrated Bluetooth LE Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
enginerd 0:b562096246b3 1 /*******************************************************************************
enginerd 0:b562096246b3 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
enginerd 0:b562096246b3 3 *
enginerd 0:b562096246b3 4 * Permission is hereby granted, free of charge, to any person obtaining a
enginerd 0:b562096246b3 5 * copy of this software and associated documentation files (the "Software"),
enginerd 0:b562096246b3 6 * to deal in the Software without restriction, including without limitation
enginerd 0:b562096246b3 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
enginerd 0:b562096246b3 8 * and/or sell copies of the Software, and to permit persons to whom the
enginerd 0:b562096246b3 9 * Software is furnished to do so, subject to the following conditions:
enginerd 0:b562096246b3 10 *
enginerd 0:b562096246b3 11 * The above copyright notice and this permission notice shall be included
enginerd 0:b562096246b3 12 * in all copies or substantial portions of the Software.
enginerd 0:b562096246b3 13 *
enginerd 0:b562096246b3 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
enginerd 0:b562096246b3 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
enginerd 0:b562096246b3 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
enginerd 0:b562096246b3 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
enginerd 0:b562096246b3 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
enginerd 0:b562096246b3 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
enginerd 0:b562096246b3 20 * OTHER DEALINGS IN THE SOFTWARE.
enginerd 0:b562096246b3 21 *
enginerd 0:b562096246b3 22 * Except as contained in this notice, the name of Maxim Integrated
enginerd 0:b562096246b3 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
enginerd 0:b562096246b3 24 * Products, Inc. Branding Policy.
enginerd 0:b562096246b3 25 *
enginerd 0:b562096246b3 26 * The mere transfer of this software does not imply any licenses
enginerd 0:b562096246b3 27 * of trade secrets, proprietary technology, copyrights, patents,
enginerd 0:b562096246b3 28 * trademarks, maskwork rights, or any other form of intellectual
enginerd 0:b562096246b3 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
enginerd 0:b562096246b3 30 * ownership rights.
enginerd 0:b562096246b3 31 *******************************************************************************
enginerd 0:b562096246b3 32 */
enginerd 0:b562096246b3 33
enginerd 0:b562096246b3 34 #ifndef _MAXIMBLE_H_
enginerd 0:b562096246b3 35 #define _MAXIMBLE_H_
enginerd 0:b562096246b3 36
enginerd 0:b562096246b3 37 #include "ble/BLE.h"
enginerd 0:b562096246b3 38 #include "ble/blecommon.h"
enginerd 0:b562096246b3 39 #include "ble/BLEInstanceBase.h"
enginerd 0:b562096246b3 40
enginerd 0:b562096246b3 41 #include "MaximGap.h"
enginerd 0:b562096246b3 42 #include "MaximGattServer.h"
enginerd 0:b562096246b3 43 #include "MaximGattClient.h"
enginerd 0:b562096246b3 44 #include "MaximSecurityManager.h"
enginerd 0:b562096246b3 45
enginerd 0:b562096246b3 46 class MaximBLE : public BLEInstanceBase
enginerd 0:b562096246b3 47 {
enginerd 0:b562096246b3 48 public:
enginerd 0:b562096246b3 49 MaximBLE(void);
enginerd 0:b562096246b3 50 virtual ~MaximBLE(void);
enginerd 0:b562096246b3 51
enginerd 0:b562096246b3 52 virtual ble_error_t init(BLE::InstanceID_t instanceID, FunctionPointerWithContext<BLE::InitializationCompleteCallbackContext *> initCallback);
enginerd 0:b562096246b3 53 virtual bool hasInitialized(void) const {
enginerd 0:b562096246b3 54 return initialized;
enginerd 0:b562096246b3 55 }
enginerd 0:b562096246b3 56 virtual ble_error_t shutdown(void);
enginerd 0:b562096246b3 57 virtual const char *getVersion(void);
enginerd 0:b562096246b3 58
enginerd 0:b562096246b3 59 virtual Gap &getGap() {
enginerd 0:b562096246b3 60 return MaximGap::getInstance();
enginerd 0:b562096246b3 61 };
enginerd 0:b562096246b3 62 virtual const Gap &getGap() const {
enginerd 0:b562096246b3 63 return MaximGap::getInstance();
enginerd 0:b562096246b3 64 };
enginerd 0:b562096246b3 65 virtual GattServer &getGattServer() {
enginerd 0:b562096246b3 66 return MaximGattServer::getInstance();
enginerd 0:b562096246b3 67 };
enginerd 0:b562096246b3 68 virtual const GattServer &getGattServer() const {
enginerd 0:b562096246b3 69 return MaximGattServer::getInstance();
enginerd 0:b562096246b3 70 };
enginerd 0:b562096246b3 71 virtual GattClient &getGattClient() {
enginerd 0:b562096246b3 72 return MaximGattClient::getInstance();
enginerd 0:b562096246b3 73 };
enginerd 0:b562096246b3 74 virtual SecurityManager &getSecurityManager() {
enginerd 0:b562096246b3 75 return MaximSecurityManager::getInstance();
enginerd 0:b562096246b3 76 };
enginerd 0:b562096246b3 77 virtual const SecurityManager &getSecurityManager() const {
enginerd 0:b562096246b3 78 return MaximSecurityManager::getInstance();
enginerd 0:b562096246b3 79 };
enginerd 0:b562096246b3 80
enginerd 0:b562096246b3 81 virtual void waitForEvent(void);
enginerd 0:b562096246b3 82
enginerd 0:b562096246b3 83 private:
enginerd 0:b562096246b3 84 bool initialized;
enginerd 0:b562096246b3 85 BLE::InstanceID_t instanceID;
enginerd 0:b562096246b3 86
enginerd 0:b562096246b3 87 static void timeoutCallback(void);
enginerd 0:b562096246b3 88 void callDispatcher(void);
enginerd 0:b562096246b3 89 };
enginerd 0:b562096246b3 90
enginerd 0:b562096246b3 91 #endif /* _MAXIMBLE_H_ */