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