iOSのBLEコントローラアプリ「RCBController」と接続し、コントローラの操作を取得するサンプルプログラムです。 mbed HRM1017で動作を確認しています。 2014.08.20時点でのBLEライブラリに対応しました。

Dependencies:   BLE_API mbed

Fork of BLE_RCBController by Junichi Katsu

Committer:
jksoft
Date:
Wed Aug 20 13:41:01 2014 +0000
Revision:
4:ebda47d22091
Parent:
nRF51822/nordic/nrf-sdk/ble/ble_services/ble_ias.h@1:48f6e08a3ac2
?????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 1:48f6e08a3ac2 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 1:48f6e08a3ac2 2 *
jksoft 1:48f6e08a3ac2 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 1:48f6e08a3ac2 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 1:48f6e08a3ac2 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 1:48f6e08a3ac2 6 *
jksoft 1:48f6e08a3ac2 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 1:48f6e08a3ac2 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 1:48f6e08a3ac2 9 * the file.
jksoft 1:48f6e08a3ac2 10 *
jksoft 1:48f6e08a3ac2 11 */
jksoft 1:48f6e08a3ac2 12
jksoft 1:48f6e08a3ac2 13 /** @file
jksoft 1:48f6e08a3ac2 14 *
jksoft 1:48f6e08a3ac2 15 * @defgroup ble_sdk_srv_ias Immediate Alert Service
jksoft 1:48f6e08a3ac2 16 * @{
jksoft 1:48f6e08a3ac2 17 * @ingroup ble_sdk_srv
jksoft 1:48f6e08a3ac2 18 * @brief Immediate Alert Service module.
jksoft 1:48f6e08a3ac2 19 *
jksoft 1:48f6e08a3ac2 20 * @details This module implements the Immediate Alert Service with the Alert Level characteristic.
jksoft 1:48f6e08a3ac2 21 * During initialization it adds the Immediate Alert Service and Alert Level characteristic
jksoft 1:48f6e08a3ac2 22 * to the BLE stack database.
jksoft 1:48f6e08a3ac2 23 *
jksoft 1:48f6e08a3ac2 24 * The application must supply an event handler for receiving Immediate Alert Service
jksoft 1:48f6e08a3ac2 25 * events. Using this handler, the service will notify the application when the
jksoft 1:48f6e08a3ac2 26 * Alert Level characteristic value changes.
jksoft 1:48f6e08a3ac2 27 *
jksoft 1:48f6e08a3ac2 28 * The service also provides a function for letting the application poll the current
jksoft 1:48f6e08a3ac2 29 * value of the Alert Level characteristic.
jksoft 1:48f6e08a3ac2 30 *
jksoft 1:48f6e08a3ac2 31 * @note The application must propagate BLE stack events to the Immediate Alert Service
jksoft 1:48f6e08a3ac2 32 * module by calling ble_ias_on_ble_evt() from the @ref ble_stack_handler callback.
jksoft 1:48f6e08a3ac2 33 *
jksoft 1:48f6e08a3ac2 34 * @note Attention!
jksoft 1:48f6e08a3ac2 35 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
jksoft 1:48f6e08a3ac2 36 * qualification listings, this section of source code must not be modified.
jksoft 1:48f6e08a3ac2 37 */
jksoft 1:48f6e08a3ac2 38
jksoft 1:48f6e08a3ac2 39 #ifndef BLE_IAS_H__
jksoft 1:48f6e08a3ac2 40 #define BLE_IAS_H__
jksoft 1:48f6e08a3ac2 41
jksoft 1:48f6e08a3ac2 42 #include <stdint.h>
jksoft 1:48f6e08a3ac2 43 #include "ble.h"
jksoft 1:48f6e08a3ac2 44
jksoft 1:48f6e08a3ac2 45 /**@brief Immediate Alert Service event type. */
jksoft 1:48f6e08a3ac2 46 typedef enum
jksoft 1:48f6e08a3ac2 47 {
jksoft 1:48f6e08a3ac2 48 BLE_IAS_EVT_ALERT_LEVEL_UPDATED /**< Alert Level Updated event. */
jksoft 1:48f6e08a3ac2 49 } ble_ias_evt_type_t;
jksoft 1:48f6e08a3ac2 50
jksoft 1:48f6e08a3ac2 51 /**@brief Immediate Alert Service event. */
jksoft 1:48f6e08a3ac2 52 typedef struct
jksoft 1:48f6e08a3ac2 53 {
jksoft 1:48f6e08a3ac2 54 ble_ias_evt_type_t evt_type; /**< Type of event. */
jksoft 1:48f6e08a3ac2 55 union
jksoft 1:48f6e08a3ac2 56 {
jksoft 1:48f6e08a3ac2 57 uint8_t alert_level; /**< New Alert Level value. */
jksoft 1:48f6e08a3ac2 58 } params;
jksoft 1:48f6e08a3ac2 59 } ble_ias_evt_t;
jksoft 1:48f6e08a3ac2 60
jksoft 1:48f6e08a3ac2 61 // Forward declaration of the ble_ias_t type.
jksoft 1:48f6e08a3ac2 62 typedef struct ble_ias_s ble_ias_t;
jksoft 1:48f6e08a3ac2 63
jksoft 1:48f6e08a3ac2 64 /**@brief Immediate Alert Service event handler type. */
jksoft 1:48f6e08a3ac2 65 typedef void (*ble_ias_evt_handler_t) (ble_ias_t * p_ias, ble_ias_evt_t * p_evt);
jksoft 1:48f6e08a3ac2 66
jksoft 1:48f6e08a3ac2 67 /**@brief Immediate Alert Service init structure. This contains all options and data needed for
jksoft 1:48f6e08a3ac2 68 * initialization of the service. */
jksoft 1:48f6e08a3ac2 69 typedef struct
jksoft 1:48f6e08a3ac2 70 {
jksoft 1:48f6e08a3ac2 71 ble_ias_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Immediate Alert Service. */
jksoft 1:48f6e08a3ac2 72 } ble_ias_init_t;
jksoft 1:48f6e08a3ac2 73
jksoft 1:48f6e08a3ac2 74 /**@brief Immediate Alert Service structure. This contains various status information for the
jksoft 1:48f6e08a3ac2 75 * service. */
jksoft 1:48f6e08a3ac2 76 typedef struct ble_ias_s
jksoft 1:48f6e08a3ac2 77 {
jksoft 1:48f6e08a3ac2 78 ble_ias_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Immediate Alert Service. */
jksoft 1:48f6e08a3ac2 79 uint16_t service_handle; /**< Handle of Immediate Alert Service (as provided by the BLE stack). */
jksoft 1:48f6e08a3ac2 80 ble_gatts_char_handles_t alert_level_handles; /**< Handles related to the Alert Level characteristic. */
jksoft 1:48f6e08a3ac2 81 } ble_ias_t;
jksoft 1:48f6e08a3ac2 82
jksoft 1:48f6e08a3ac2 83 /**@brief Function for initializing the Immediate Alert Service.
jksoft 1:48f6e08a3ac2 84 *
jksoft 1:48f6e08a3ac2 85 * @param[out] p_ias Immediate Alert Service structure. This structure will have to be
jksoft 1:48f6e08a3ac2 86 * supplied by the application. It will be initialized by this function,
jksoft 1:48f6e08a3ac2 87 * and will later be used to identify this particular service instance.
jksoft 1:48f6e08a3ac2 88 * @param[in] p_ias_init Information needed to initialize the service.
jksoft 1:48f6e08a3ac2 89 *
jksoft 1:48f6e08a3ac2 90 * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
jksoft 1:48f6e08a3ac2 91 */
jksoft 1:48f6e08a3ac2 92 uint32_t ble_ias_init(ble_ias_t * p_ias, const ble_ias_init_t * p_ias_init);
jksoft 1:48f6e08a3ac2 93
jksoft 1:48f6e08a3ac2 94 /**@brief Function for handling the Application's BLE Stack events.
jksoft 1:48f6e08a3ac2 95 *
jksoft 1:48f6e08a3ac2 96 * @details Handles all events from the BLE stack of interest to the Immediate Alert Service.
jksoft 1:48f6e08a3ac2 97 *
jksoft 1:48f6e08a3ac2 98 * @param[in] p_ias Immediate Alert Service structure.
jksoft 1:48f6e08a3ac2 99 * @param[in] p_ble_evt Event received from the BLE stack.
jksoft 1:48f6e08a3ac2 100 */
jksoft 1:48f6e08a3ac2 101 void ble_ias_on_ble_evt(ble_ias_t * p_ias, ble_evt_t * p_ble_evt);
jksoft 1:48f6e08a3ac2 102
jksoft 1:48f6e08a3ac2 103 /**@brief Function for getting current value of the Alert Level characteristic.
jksoft 1:48f6e08a3ac2 104 *
jksoft 1:48f6e08a3ac2 105 * @param[in] p_ias Immediate Alert Service structure.
jksoft 1:48f6e08a3ac2 106 * @param[out] p_alert_level Current Alert Level value.
jksoft 1:48f6e08a3ac2 107 */
jksoft 1:48f6e08a3ac2 108 uint32_t ble_ias_alert_level_get(ble_ias_t * p_ias, uint8_t * p_alert_level);
jksoft 1:48f6e08a3ac2 109
jksoft 1:48f6e08a3ac2 110 #endif // BLE_IAS_H__
jksoft 1:48f6e08a3ac2 111
jksoft 1:48f6e08a3ac2 112 /** @} */