iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。
Dependencies: BLE_API_Native_IRC Servo mbed
Fork of BLE_RCBController by
- 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
- ライブラリ類はUpdateしないでください。コンパイルエラーになります。
うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。
BLE_API_Native_IRC/GapAdvertisingParams.h@2:1a3fb1a40edf, 2014-07-30 (annotated)
- Committer:
- robo8080
- Date:
- Wed Jul 30 00:09:23 2014 +0000
- Revision:
- 2:1a3fb1a40edf
- Parent:
- 0:8c643bfe55b7
test2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8c643bfe55b7 | 1 | /* mbed Microcontroller Library |
jksoft | 0:8c643bfe55b7 | 2 | * Copyright (c) 2006-2013 ARM Limited |
jksoft | 0:8c643bfe55b7 | 3 | * |
jksoft | 0:8c643bfe55b7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jksoft | 0:8c643bfe55b7 | 5 | * you may not use this file except in compliance with the License. |
jksoft | 0:8c643bfe55b7 | 6 | * You may obtain a copy of the License at |
jksoft | 0:8c643bfe55b7 | 7 | * |
jksoft | 0:8c643bfe55b7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jksoft | 0:8c643bfe55b7 | 9 | * |
jksoft | 0:8c643bfe55b7 | 10 | * Unless required by applicable law or agreed to in writing, software |
jksoft | 0:8c643bfe55b7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jksoft | 0:8c643bfe55b7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jksoft | 0:8c643bfe55b7 | 13 | * See the License for the specific language governing permissions and |
jksoft | 0:8c643bfe55b7 | 14 | * limitations under the License. |
jksoft | 0:8c643bfe55b7 | 15 | */ |
jksoft | 0:8c643bfe55b7 | 16 | |
jksoft | 0:8c643bfe55b7 | 17 | #ifndef __GAP_ADVERTISING_PARAMS_H__ |
jksoft | 0:8c643bfe55b7 | 18 | #define __GAP_ADVERTISING_PARAMS_H__ |
jksoft | 0:8c643bfe55b7 | 19 | |
jksoft | 0:8c643bfe55b7 | 20 | #include "blecommon.h" |
jksoft | 0:8c643bfe55b7 | 21 | |
jksoft | 0:8c643bfe55b7 | 22 | #define GAP_ADV_PARAMS_INTERVAL_MIN (0x0020) |
jksoft | 0:8c643bfe55b7 | 23 | #define GAP_ADV_PARAMS_INTERVAL_MIN_NONCON (0x00A0) |
jksoft | 0:8c643bfe55b7 | 24 | #define GAP_ADV_PARAMS_INTERVAL_MAX (0x1000) |
jksoft | 0:8c643bfe55b7 | 25 | #define GAP_ADV_PARAMS_TIMEOUT_MAX (0x3FFF) |
jksoft | 0:8c643bfe55b7 | 26 | |
jksoft | 0:8c643bfe55b7 | 27 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 28 | /*! |
jksoft | 0:8c643bfe55b7 | 29 | \brief |
jksoft | 0:8c643bfe55b7 | 30 | This class provides a wrapper for the core advertising parameters, |
jksoft | 0:8c643bfe55b7 | 31 | including the advertising type (Connectable Undirected, |
jksoft | 0:8c643bfe55b7 | 32 | Non Connectable Undirected, etc.), as well as the advertising and |
jksoft | 0:8c643bfe55b7 | 33 | timeout intervals. |
jksoft | 0:8c643bfe55b7 | 34 | |
jksoft | 0:8c643bfe55b7 | 35 | \par |
jksoft | 0:8c643bfe55b7 | 36 | See the following for more information on advertising types: |
jksoft | 0:8c643bfe55b7 | 37 | |
jksoft | 0:8c643bfe55b7 | 38 | \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 |
jksoft | 0:8c643bfe55b7 | 39 | \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 |
jksoft | 0:8c643bfe55b7 | 40 | |
jksoft | 0:8c643bfe55b7 | 41 | \par EXAMPLE |
jksoft | 0:8c643bfe55b7 | 42 | |
jksoft | 0:8c643bfe55b7 | 43 | \code |
jksoft | 0:8c643bfe55b7 | 44 | |
jksoft | 0:8c643bfe55b7 | 45 | // ToDo |
jksoft | 0:8c643bfe55b7 | 46 | |
jksoft | 0:8c643bfe55b7 | 47 | \endcode |
jksoft | 0:8c643bfe55b7 | 48 | */ |
jksoft | 0:8c643bfe55b7 | 49 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 50 | class GapAdvertisingParams |
jksoft | 0:8c643bfe55b7 | 51 | { |
jksoft | 0:8c643bfe55b7 | 52 | public: |
jksoft | 0:8c643bfe55b7 | 53 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 54 | /*! |
jksoft | 0:8c643bfe55b7 | 55 | \brief |
jksoft | 0:8c643bfe55b7 | 56 | Encapsulates the peripheral advertising modes, which determine how |
jksoft | 0:8c643bfe55b7 | 57 | the device appears to other central devices in hearing range |
jksoft | 0:8c643bfe55b7 | 58 | |
jksoft | 0:8c643bfe55b7 | 59 | \par |
jksoft | 0:8c643bfe55b7 | 60 | See the following for more information on advertising types: |
jksoft | 0:8c643bfe55b7 | 61 | |
jksoft | 0:8c643bfe55b7 | 62 | \li \c Bluetooth Core Specification 4.0 (Vol. 6), Part B, Section 2.3.1 |
jksoft | 0:8c643bfe55b7 | 63 | \li \c Bluetooth Core Specification 4.0 (Vol. 3), Part C, Section 9.3 |
jksoft | 0:8c643bfe55b7 | 64 | */ |
jksoft | 0:8c643bfe55b7 | 65 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 66 | enum AdvertisingType |
jksoft | 0:8c643bfe55b7 | 67 | { |
jksoft | 0:8c643bfe55b7 | 68 | ADV_CONNECTABLE_UNDIRECTED, /**< Vol 3, Part C, Section 9.3.4 and Vol 6, Part B, Section 2.3.1.1 */ |
jksoft | 0:8c643bfe55b7 | 69 | ADV_CONNECTABLE_DIRECTED, /**< Vol 3, Part C, Section 9.3.3 and Vol 6, Part B, Section 2.3.1.2 */ |
jksoft | 0:8c643bfe55b7 | 70 | ADV_SCANNABLE_UNDIRECTED, /**< Include support for Scan Response payloads, see Vol 6, Part B, Section 2.3.1.4 */ |
jksoft | 0:8c643bfe55b7 | 71 | ADV_NON_CONNECTABLE_UNDIRECTED /**< Vol 3, Part C, Section 9.3.2 and Vol 6, Part B, Section 2.3.1.3 */ |
jksoft | 0:8c643bfe55b7 | 72 | }; |
jksoft | 0:8c643bfe55b7 | 73 | |
jksoft | 0:8c643bfe55b7 | 74 | GapAdvertisingParams(AdvertisingType advType = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED, |
jksoft | 0:8c643bfe55b7 | 75 | uint16_t interval = GAP_ADV_PARAMS_INTERVAL_MIN_NONCON, |
jksoft | 0:8c643bfe55b7 | 76 | uint16_t timeout = 0); |
jksoft | 0:8c643bfe55b7 | 77 | virtual ~GapAdvertisingParams(void); |
jksoft | 0:8c643bfe55b7 | 78 | |
jksoft | 0:8c643bfe55b7 | 79 | virtual AdvertisingType getAdvertisingType(void); |
jksoft | 0:8c643bfe55b7 | 80 | virtual uint16_t getInterval(void); |
jksoft | 0:8c643bfe55b7 | 81 | virtual uint16_t getTimeout(void); |
jksoft | 0:8c643bfe55b7 | 82 | |
jksoft | 0:8c643bfe55b7 | 83 | private: |
jksoft | 0:8c643bfe55b7 | 84 | AdvertisingType _advType; |
jksoft | 0:8c643bfe55b7 | 85 | uint16_t _interval; |
jksoft | 0:8c643bfe55b7 | 86 | uint16_t _timeout; |
jksoft | 0:8c643bfe55b7 | 87 | }; |
jksoft | 0:8c643bfe55b7 | 88 | |
jksoft | 0:8c643bfe55b7 | 89 | #endif |