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/GattCharacteristic.cpp@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 | #include <stdio.h> |
jksoft | 0:8c643bfe55b7 | 18 | #include <string.h> |
jksoft | 0:8c643bfe55b7 | 19 | |
jksoft | 0:8c643bfe55b7 | 20 | #include "GattCharacteristic.h" |
jksoft | 0:8c643bfe55b7 | 21 | |
jksoft | 0:8c643bfe55b7 | 22 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 23 | /*! |
jksoft | 0:8c643bfe55b7 | 24 | @brief Creates a new GattCharacteristic using the specified 16-bit |
jksoft | 0:8c643bfe55b7 | 25 | UUID, value length, and properties |
jksoft | 0:8c643bfe55b7 | 26 | |
jksoft | 0:8c643bfe55b7 | 27 | @note The UUID value must be unique in the service and is normally >1 |
jksoft | 0:8c643bfe55b7 | 28 | |
jksoft | 0:8c643bfe55b7 | 29 | @param[in] id |
jksoft | 0:8c643bfe55b7 | 30 | The 16-bit UUID to use for this characteristic |
jksoft | 0:8c643bfe55b7 | 31 | @param[in] minLen |
jksoft | 0:8c643bfe55b7 | 32 | The min length in bytes of this characteristic's value |
jksoft | 0:8c643bfe55b7 | 33 | @param[in] maxLen |
jksoft | 0:8c643bfe55b7 | 34 | The max length in bytes of this characteristic's value |
jksoft | 0:8c643bfe55b7 | 35 | @param[in] props |
jksoft | 0:8c643bfe55b7 | 36 | The 8-bit bit field containing the characteristic's |
jksoft | 0:8c643bfe55b7 | 37 | properties |
jksoft | 0:8c643bfe55b7 | 38 | |
jksoft | 0:8c643bfe55b7 | 39 | @section EXAMPLE |
jksoft | 0:8c643bfe55b7 | 40 | |
jksoft | 0:8c643bfe55b7 | 41 | @code |
jksoft | 0:8c643bfe55b7 | 42 | |
jksoft | 0:8c643bfe55b7 | 43 | // UUID = 0x2A19, Min length 2, Max len = 2, Properties = write |
jksoft | 0:8c643bfe55b7 | 44 | GattCharacteristic c = GattCharacteristic( 0x2A19, 2, 2, BLE_GATT_CHAR_PROPERTIES_WRITE ); |
jksoft | 0:8c643bfe55b7 | 45 | |
jksoft | 0:8c643bfe55b7 | 46 | @endcode |
jksoft | 0:8c643bfe55b7 | 47 | */ |
jksoft | 0:8c643bfe55b7 | 48 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 49 | GattCharacteristic::GattCharacteristic(uint16_t id, uint16_t minLen, uint16_t maxLen, uint8_t props) |
jksoft | 0:8c643bfe55b7 | 50 | { |
jksoft | 0:8c643bfe55b7 | 51 | uuid = id; |
jksoft | 0:8c643bfe55b7 | 52 | memcpy(&properties, &props, 1); |
jksoft | 0:8c643bfe55b7 | 53 | lenMin = minLen; |
jksoft | 0:8c643bfe55b7 | 54 | lenMax = maxLen; |
jksoft | 0:8c643bfe55b7 | 55 | // handle = 0; |
jksoft | 0:8c643bfe55b7 | 56 | } |
jksoft | 0:8c643bfe55b7 | 57 | |
jksoft | 0:8c643bfe55b7 | 58 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 59 | /*! |
jksoft | 0:8c643bfe55b7 | 60 | Destructor |
jksoft | 0:8c643bfe55b7 | 61 | */ |
jksoft | 0:8c643bfe55b7 | 62 | /**************************************************************************/ |
jksoft | 0:8c643bfe55b7 | 63 | GattCharacteristic::~GattCharacteristic(void) |
jksoft | 0:8c643bfe55b7 | 64 | { |
jksoft | 0:8c643bfe55b7 | 65 | } |