iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。

Dependencies:   BLE_API_Native_IRC Servo mbed

Fork of BLE_RCBController by Junichi Katsu

  • 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
  • ライブラリ類はUpdateしないでください。コンパイルエラーになります。

うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。

/media/uploads/robo8080/img_1560.jpg

Committer:
jksoft
Date:
Thu Jul 10 14:21:52 2014 +0000
Revision:
0:8c643bfe55b7
??

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8c643bfe55b7 1 /* Copyright (c) 2011 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8c643bfe55b7 2 *
jksoft 0:8c643bfe55b7 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
jksoft 0:8c643bfe55b7 4 * copying, transfer or disclosure of such information is prohibited except by express written
jksoft 0:8c643bfe55b7 5 * agreement with Nordic Semiconductor.
jksoft 0:8c643bfe55b7 6 *
jksoft 0:8c643bfe55b7 7 */
jksoft 0:8c643bfe55b7 8 /**
jksoft 0:8c643bfe55b7 9 @addtogroup BLE_COMMON
jksoft 0:8c643bfe55b7 10 @{
jksoft 0:8c643bfe55b7 11 @defgroup ble_types Common types and macro definitions
jksoft 0:8c643bfe55b7 12 @{
jksoft 0:8c643bfe55b7 13
jksoft 0:8c643bfe55b7 14 @brief Common types and macro definitions for the S110 SoftDevice.
jksoft 0:8c643bfe55b7 15 */
jksoft 0:8c643bfe55b7 16
jksoft 0:8c643bfe55b7 17 #ifndef BLE_TYPES_H__
jksoft 0:8c643bfe55b7 18 #define BLE_TYPES_H__
jksoft 0:8c643bfe55b7 19
jksoft 0:8c643bfe55b7 20 #include <stdint.h>
jksoft 0:8c643bfe55b7 21 #include "nordic_global.h"
jksoft 0:8c643bfe55b7 22
jksoft 0:8c643bfe55b7 23 /** @addtogroup BLE_COMMON_DEFINES Defines
jksoft 0:8c643bfe55b7 24 * @{ */
jksoft 0:8c643bfe55b7 25
jksoft 0:8c643bfe55b7 26 /** @defgroup BLE_CONN_HANDLES BLE Connection Handles
jksoft 0:8c643bfe55b7 27 * @{ */
jksoft 0:8c643bfe55b7 28 #define BLE_CONN_HANDLE_INVALID 0xFFFF /**< Invalid Connection Handle. */
jksoft 0:8c643bfe55b7 29 #define BLE_CONN_HANDLE_ALL 0xFFFE /**< Applies to all Connection Handles. */
jksoft 0:8c643bfe55b7 30 /** @} */
jksoft 0:8c643bfe55b7 31
jksoft 0:8c643bfe55b7 32
jksoft 0:8c643bfe55b7 33 /** @defgroup BLE_UUID_VALUES Assigned Values for BLE UUIDs
jksoft 0:8c643bfe55b7 34 * @{ */
jksoft 0:8c643bfe55b7 35 /* Generic UUIDs, applicable to all services */
jksoft 0:8c643bfe55b7 36 #define BLE_UUID_UNKNOWN 0x0000 /**< Reserved UUID. */
jksoft 0:8c643bfe55b7 37 #define BLE_UUID_SERVICE_PRIMARY 0x2800 /**< Primary Service. */
jksoft 0:8c643bfe55b7 38 #define BLE_UUID_SERVICE_SECONDARY 0x2801 /**< Secondary Service. */
jksoft 0:8c643bfe55b7 39 #define BLE_UUID_SERVICE_INCLUDE 0x2802 /**< Include. */
jksoft 0:8c643bfe55b7 40 #define BLE_UUID_CHARACTERISTIC 0x2803 /**< Characteristic. */
jksoft 0:8c643bfe55b7 41 #define BLE_UUID_DESCRIPTOR_CHAR_EXT_PROP 0x2900 /**< Characteristic Extended Properties Descriptor. */
jksoft 0:8c643bfe55b7 42 #define BLE_UUID_DESCRIPTOR_CHAR_USER_DESC 0x2901 /**< Characteristic User Description Descriptor. */
jksoft 0:8c643bfe55b7 43 #define BLE_UUID_DESCRIPTOR_CLIENT_CHAR_CONFIG 0x2902 /**< Client Characteristic Configuration Descriptor. */
jksoft 0:8c643bfe55b7 44 #define BLE_UUID_DESCRIPTOR_SERVER_CHAR_CONFIG 0x2903 /**< Server Characteristic Configuration Descriptor. */
jksoft 0:8c643bfe55b7 45 #define BLE_UUID_DESCRIPTOR_CHAR_PRESENTATION_FORMAT 0x2904 /**< Characteristic Presentation Format Descriptor. */
jksoft 0:8c643bfe55b7 46 #define BLE_UUID_DESCRIPTOR_CHAR_AGGREGATE_FORMAT 0x2905 /**< Characteristic Aggregate Format Descriptor. */
jksoft 0:8c643bfe55b7 47 /* GATT specific UUIDs */
jksoft 0:8c643bfe55b7 48 #define BLE_UUID_GATT 0x1801 /**< Generic Attribute Profile. */
jksoft 0:8c643bfe55b7 49 #define BLE_UUID_GATT_CHARACTERISTIC_SERVICE_CHANGED 0x2A05 /**< Service Changed Characteristic. */
jksoft 0:8c643bfe55b7 50 /* GAP specific UUIDs */
jksoft 0:8c643bfe55b7 51 #define BLE_UUID_GAP 0x1800 /**< Generic Access Profile. */
jksoft 0:8c643bfe55b7 52 #define BLE_UUID_GAP_CHARACTERISTIC_DEVICE_NAME 0x2A00 /**< Device Name Characteristic. */
jksoft 0:8c643bfe55b7 53 #define BLE_UUID_GAP_CHARACTERISTIC_APPEARANCE 0x2A01 /**< Appearance Characteristic. */
jksoft 0:8c643bfe55b7 54 #define BLE_UUID_GAP_CHARACTERISTIC_PPF 0x2A02 /**< Peripheral Privacy Flag Characteristic. */
jksoft 0:8c643bfe55b7 55 #define BLE_UUID_GAP_CHARACTERISTIC_RECONN_ADDR 0x2A03 /**< Reconnection Address Characteristic. */
jksoft 0:8c643bfe55b7 56 #define BLE_UUID_GAP_CHARACTERISTIC_PPCP 0x2A04 /**< Peripheral Preferred Connection Parameters Characteristic. */
jksoft 0:8c643bfe55b7 57 /** @} */
jksoft 0:8c643bfe55b7 58
jksoft 0:8c643bfe55b7 59
jksoft 0:8c643bfe55b7 60 /** @defgroup BLE_UUID_TYPES Types of UUID
jksoft 0:8c643bfe55b7 61 * @{ */
jksoft 0:8c643bfe55b7 62 #define BLE_UUID_TYPE_UNKNOWN 0x00 /**< Invalid UUID type. */
jksoft 0:8c643bfe55b7 63 #define BLE_UUID_TYPE_BLE 0x01 /**< Bluetooth SIG UUID (16-bit). */
jksoft 0:8c643bfe55b7 64 #define BLE_UUID_TYPE_VENDOR_BEGIN 0x02 /**< Vendor UUID types start at this index (128-bit). */
jksoft 0:8c643bfe55b7 65 /** @} */
jksoft 0:8c643bfe55b7 66
jksoft 0:8c643bfe55b7 67
jksoft 0:8c643bfe55b7 68 /** @defgroup BLE_APPEARANCES Bluetooth Appearance values
jksoft 0:8c643bfe55b7 69 * @note Retrieved from http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.gap.appearance.xml
jksoft 0:8c643bfe55b7 70 * @{ */
jksoft 0:8c643bfe55b7 71 #define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */
jksoft 0:8c643bfe55b7 72 #define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */
jksoft 0:8c643bfe55b7 73 #define BLE_APPEARANCE_GENERIC_COMPUTER 128 /**< Generic Computer. */
jksoft 0:8c643bfe55b7 74 #define BLE_APPEARANCE_GENERIC_WATCH 192 /**< Generic Watch. */
jksoft 0:8c643bfe55b7 75 #define BLE_APPEARANCE_WATCH_SPORTS_WATCH 193 /**< Watch: Sports Watch. */
jksoft 0:8c643bfe55b7 76 #define BLE_APPEARANCE_GENERIC_CLOCK 256 /**< Generic Clock. */
jksoft 0:8c643bfe55b7 77 #define BLE_APPEARANCE_GENERIC_DISPLAY 320 /**< Generic Display. */
jksoft 0:8c643bfe55b7 78 #define BLE_APPEARANCE_GENERIC_REMOTE_CONTROL 384 /**< Generic Remote Control. */
jksoft 0:8c643bfe55b7 79 #define BLE_APPEARANCE_GENERIC_EYE_GLASSES 448 /**< Generic Eye-glasses. */
jksoft 0:8c643bfe55b7 80 #define BLE_APPEARANCE_GENERIC_TAG 512 /**< Generic Tag. */
jksoft 0:8c643bfe55b7 81 #define BLE_APPEARANCE_GENERIC_KEYRING 576 /**< Generic Keyring. */
jksoft 0:8c643bfe55b7 82 #define BLE_APPEARANCE_GENERIC_MEDIA_PLAYER 640 /**< Generic Media Player. */
jksoft 0:8c643bfe55b7 83 #define BLE_APPEARANCE_GENERIC_BARCODE_SCANNER 704 /**< Generic Barcode Scanner. */
jksoft 0:8c643bfe55b7 84 #define BLE_APPEARANCE_GENERIC_THERMOMETER 768 /**< Generic Thermometer. */
jksoft 0:8c643bfe55b7 85 #define BLE_APPEARANCE_THERMOMETER_EAR 769 /**< Thermometer: Ear. */
jksoft 0:8c643bfe55b7 86 #define BLE_APPEARANCE_GENERIC_HEART_RATE_SENSOR 832 /**< Generic Heart rate Sensor. */
jksoft 0:8c643bfe55b7 87 #define BLE_APPEARANCE_HEART_RATE_SENSOR_HEART_RATE_BELT 833 /**< Heart Rate Sensor: Heart Rate Belt. */
jksoft 0:8c643bfe55b7 88 #define BLE_APPEARANCE_GENERIC_BLOOD_PRESSURE 896 /**< Generic Blood Pressure. */
jksoft 0:8c643bfe55b7 89 #define BLE_APPEARANCE_BLOOD_PRESSURE_ARM 897 /**< Blood Pressure: Arm. */
jksoft 0:8c643bfe55b7 90 #define BLE_APPEARANCE_BLOOD_PRESSURE_WRIST 898 /**< Blood Pressure: Wrist. */
jksoft 0:8c643bfe55b7 91 #define BLE_APPEARANCE_GENERIC_HID 960 /**< Human Interface Device (HID). */
jksoft 0:8c643bfe55b7 92 #define BLE_APPEARANCE_HID_KEYBOARD 961 /**< Keyboard (HID Subtype). */
jksoft 0:8c643bfe55b7 93 #define BLE_APPEARANCE_HID_MOUSE 962 /**< Mouse (HID Subtype). */
jksoft 0:8c643bfe55b7 94 #define BLE_APPEARANCE_HID_JOYSTICK 963 /**< Joystiq (HID Subtype). */
jksoft 0:8c643bfe55b7 95 #define BLE_APPEARANCE_HID_GAMEPAD 964 /**< Gamepad (HID Subtype). */
jksoft 0:8c643bfe55b7 96 #define BLE_APPEARANCE_HID_DIGITIZERSUBTYPE 965 /**< Digitizer Tablet (HID Subtype). */
jksoft 0:8c643bfe55b7 97 #define BLE_APPEARANCE_HID_CARD_READER 966 /**< Card Reader (HID Subtype). */
jksoft 0:8c643bfe55b7 98 #define BLE_APPEARANCE_HID_DIGITAL_PEN 967 /**< Digital Pen (HID Subtype). */
jksoft 0:8c643bfe55b7 99 #define BLE_APPEARANCE_HID_BARCODE 968 /**< Barcode Scanner (HID Subtype). */
jksoft 0:8c643bfe55b7 100 #define BLE_APPEARANCE_GENERIC_GLUCOSE_METER 1024 /**< Generic Glucose Meter. */
jksoft 0:8c643bfe55b7 101 #define BLE_APPEARANCE_GENERIC_RUNNING_WALKING_SENSOR 1088 /**< Generic Running Walking Sensor. */
jksoft 0:8c643bfe55b7 102 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_IN_SHOE 1089 /**< Running Walking Sensor: In-Shoe. */
jksoft 0:8c643bfe55b7 103 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_SHOE 1090 /**< Running Walking Sensor: On-Shoe. */
jksoft 0:8c643bfe55b7 104 #define BLE_APPEARANCE_RUNNING_WALKING_SENSOR_ON_HIP 1091 /**< Running Walking Sensor: On-Hip. */
jksoft 0:8c643bfe55b7 105 #define BLE_APPEARANCE_GENERIC_CYCLING 1152 /**< Generic Cycling. */
jksoft 0:8c643bfe55b7 106 #define BLE_APPEARANCE_CYCLING_CYCLING_COMPUTER 1153 /**< Cycling: Cycling Computer. */
jksoft 0:8c643bfe55b7 107 #define BLE_APPEARANCE_CYCLING_SPEED_SENSOR 1154 /**< Cycling: Speed Sensor. */
jksoft 0:8c643bfe55b7 108 #define BLE_APPEARANCE_CYCLING_CADENCE_SENSOR 1155 /**< Cycling: Cadence Sensor. */
jksoft 0:8c643bfe55b7 109 #define BLE_APPEARANCE_CYCLING_POWER_SENSOR 1156 /**< Cycling: Power Sensor. */
jksoft 0:8c643bfe55b7 110 #define BLE_APPEARANCE_CYCLING_SPEED_CADENCE_SENSOR 1157 /**< Cycling: Speed and Cadence Sensor. */
jksoft 0:8c643bfe55b7 111 /** @} */
jksoft 0:8c643bfe55b7 112
jksoft 0:8c643bfe55b7 113 /** @brief Set .type and .uuid fields of ble_uuid_struct to specified uuid value. */
jksoft 0:8c643bfe55b7 114 #define BLE_UUID_BLE_ASSIGN(instance, value) do {\
jksoft 0:8c643bfe55b7 115 instance.type = BLE_UUID_TYPE_BLE; \
jksoft 0:8c643bfe55b7 116 instance.uuid = value;} while(0)
jksoft 0:8c643bfe55b7 117
jksoft 0:8c643bfe55b7 118 /** @brief Copy type and uuid members from src to dst ble_uuid_t pointer. Both pointers must be valid/non-null. */
jksoft 0:8c643bfe55b7 119 #define BLE_UUID_COPY_PTR(dst, src) do {\
jksoft 0:8c643bfe55b7 120 (dst)->type = (src)->type; \
jksoft 0:8c643bfe55b7 121 (dst)->uuid = (src)->uuid;} while(0)
jksoft 0:8c643bfe55b7 122
jksoft 0:8c643bfe55b7 123 /** @brief Copy type and uuid members from src to dst ble_uuid_t struct. */
jksoft 0:8c643bfe55b7 124 #define BLE_UUID_COPY_INST(dst, src) do {\
jksoft 0:8c643bfe55b7 125 (dst).type = (src).type; \
jksoft 0:8c643bfe55b7 126 (dst).uuid = (src).uuid;} while(0)
jksoft 0:8c643bfe55b7 127
jksoft 0:8c643bfe55b7 128 /** @brief Compare for equality both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
jksoft 0:8c643bfe55b7 129 #define BLE_UUID_EQ(p_uuid1, p_uuid2) \
jksoft 0:8c643bfe55b7 130 (((p_uuid1)->type == (p_uuid2)->type) && ((p_uuid1)->uuid == (p_uuid2)->uuid))
jksoft 0:8c643bfe55b7 131
jksoft 0:8c643bfe55b7 132 /** @brief Compare for difference both type and uuid members of two (valid, non-null) ble_uuid_t pointers. */
jksoft 0:8c643bfe55b7 133 #define BLE_UUID_NEQ(p_uuid1, p_uuid2) \
jksoft 0:8c643bfe55b7 134 (((p_uuid1)->type != (p_uuid2)->type) || ((p_uuid1)->uuid != (p_uuid2)->uuid))
jksoft 0:8c643bfe55b7 135
jksoft 0:8c643bfe55b7 136 /** @} */
jksoft 0:8c643bfe55b7 137
jksoft 0:8c643bfe55b7 138 /** @brief 128 bit UUID values. */
jksoft 0:8c643bfe55b7 139 typedef struct
jksoft 0:8c643bfe55b7 140 {
jksoft 0:8c643bfe55b7 141 unsigned char uuid128[16];
jksoft 0:8c643bfe55b7 142 } ble_uuid128_t;
jksoft 0:8c643bfe55b7 143
jksoft 0:8c643bfe55b7 144 /** @brief Bluetooth Low Energy UUID type, encapsulates both 16-bit and 128-bit UUIDs. */
jksoft 0:8c643bfe55b7 145 typedef struct
jksoft 0:8c643bfe55b7 146 {
jksoft 0:8c643bfe55b7 147 uint16_t uuid; /**< 16-bit UUID value or octets 12-13 of 128-bit UUID. */
jksoft 0:8c643bfe55b7 148 uint8_t type; /**< UUID type, see @ref BLE_UUID_TYPES. If type is BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */
jksoft 0:8c643bfe55b7 149 } ble_uuid_t;
jksoft 0:8c643bfe55b7 150
jksoft 0:8c643bfe55b7 151
jksoft 0:8c643bfe55b7 152
jksoft 0:8c643bfe55b7 153 #endif /* BLE_TYPES_H__ */
jksoft 0:8c643bfe55b7 154
jksoft 0:8c643bfe55b7 155 /**
jksoft 0:8c643bfe55b7 156 @}
jksoft 0:8c643bfe55b7 157 @}
jksoft 0:8c643bfe55b7 158 */