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) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8c643bfe55b7 2 *
jksoft 0:8c643bfe55b7 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8c643bfe55b7 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8c643bfe55b7 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8c643bfe55b7 6 *
jksoft 0:8c643bfe55b7 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8c643bfe55b7 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8c643bfe55b7 9 * the file.
jksoft 0:8c643bfe55b7 10 *
jksoft 0:8c643bfe55b7 11 */
jksoft 0:8c643bfe55b7 12
jksoft 0:8c643bfe55b7 13 /** @file
jksoft 0:8c643bfe55b7 14 *
jksoft 0:8c643bfe55b7 15 * @defgroup ble_sdk_lib_conn_params Connection Parameters Negotiation
jksoft 0:8c643bfe55b7 16 * @{
jksoft 0:8c643bfe55b7 17 * @ingroup ble_sdk_lib
jksoft 0:8c643bfe55b7 18 * @brief Module for initiating and executing a connection parameters negotiation procedure.
jksoft 0:8c643bfe55b7 19 */
jksoft 0:8c643bfe55b7 20
jksoft 0:8c643bfe55b7 21 #ifndef BLE_CONN_PARAMS_H__
jksoft 0:8c643bfe55b7 22 #define BLE_CONN_PARAMS_H__
jksoft 0:8c643bfe55b7 23
jksoft 0:8c643bfe55b7 24 #include <stdint.h>
jksoft 0:8c643bfe55b7 25 #include "nordic_global.h"
jksoft 0:8c643bfe55b7 26 #include "ble.h"
jksoft 0:8c643bfe55b7 27 #include "ble_srv_common.h"
jksoft 0:8c643bfe55b7 28
jksoft 0:8c643bfe55b7 29 /**@brief Connection Parameters Module event type. */
jksoft 0:8c643bfe55b7 30 typedef enum
jksoft 0:8c643bfe55b7 31 {
jksoft 0:8c643bfe55b7 32 BLE_CONN_PARAMS_EVT_FAILED , /**< Negotiation procedure failed. */
jksoft 0:8c643bfe55b7 33 BLE_CONN_PARAMS_EVT_SUCCEEDED /**< Negotiation procedure succeeded. */
jksoft 0:8c643bfe55b7 34 } ble_conn_params_evt_type_t;
jksoft 0:8c643bfe55b7 35
jksoft 0:8c643bfe55b7 36 /**@brief Connection Parameters Module event. */
jksoft 0:8c643bfe55b7 37 typedef struct
jksoft 0:8c643bfe55b7 38 {
jksoft 0:8c643bfe55b7 39 ble_conn_params_evt_type_t evt_type; /**< Type of event. */
jksoft 0:8c643bfe55b7 40 } ble_conn_params_evt_t;
jksoft 0:8c643bfe55b7 41
jksoft 0:8c643bfe55b7 42 /**@brief Connection Parameters Module event handler type. */
jksoft 0:8c643bfe55b7 43 typedef void (*ble_conn_params_evt_handler_t) (ble_conn_params_evt_t * p_evt);
jksoft 0:8c643bfe55b7 44
jksoft 0:8c643bfe55b7 45 /**@brief Connection Parameters Module init structure. This contains all options and data needed for
jksoft 0:8c643bfe55b7 46 * initialization of the connection parameters negotiation module. */
jksoft 0:8c643bfe55b7 47 typedef struct
jksoft 0:8c643bfe55b7 48 {
jksoft 0:8c643bfe55b7 49 ble_gap_conn_params_t * p_conn_params; /**< Pointer to the connection parameters desired by the application. When calling ble_conn_params_init, if this parameter is set to NULL, the connection parameters will be fetched from host. */
jksoft 0:8c643bfe55b7 50 uint32_t first_conn_params_update_delay; /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (in number of timer ticks). */
jksoft 0:8c643bfe55b7 51 uint32_t next_conn_params_update_delay; /**< Time between each call to sd_ble_gap_conn_param_update after the first (in number of timer ticks). Recommended value 30 seconds as per BLUETOOTH SPECIFICATION Version 4.0. */
jksoft 0:8c643bfe55b7 52 uint8_t max_conn_params_update_count; /**< Number of attempts before giving up the negotiation. */
jksoft 0:8c643bfe55b7 53 uint16_t start_on_notify_cccd_handle; /**< If procedure is to be started when notification is started, set this to the handle of the corresponding CCCD. Set to BLE_GATT_HANDLE_INVALID if procedure is to be started on connect event. */
jksoft 0:8c643bfe55b7 54 bool disconnect_on_fail; /**< Set to TRUE if a failed connection parameters update shall cause an automatic disconnection, set to FALSE otherwise. */
jksoft 0:8c643bfe55b7 55 ble_conn_params_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Battery Service. */
jksoft 0:8c643bfe55b7 56 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
jksoft 0:8c643bfe55b7 57 } ble_conn_params_init_t;
jksoft 0:8c643bfe55b7 58
jksoft 0:8c643bfe55b7 59
jksoft 0:8c643bfe55b7 60 /**@brief Function for initializing the Connection Parameters module.
jksoft 0:8c643bfe55b7 61 *
jksoft 0:8c643bfe55b7 62 * @note If the negotiation procedure should be triggered when notification/indication of
jksoft 0:8c643bfe55b7 63 * any characteristic is enabled by the peer, then this function must be called after
jksoft 0:8c643bfe55b7 64 * having initialized the services.
jksoft 0:8c643bfe55b7 65 *
jksoft 0:8c643bfe55b7 66 * @param[in] p_init This contains information needed to initialize this module.
jksoft 0:8c643bfe55b7 67 *
jksoft 0:8c643bfe55b7 68 * @return NRF_SUCCESS on successful initialization, otherwise an error code.
jksoft 0:8c643bfe55b7 69 */
jksoft 0:8c643bfe55b7 70 uint32_t ble_conn_params_init(const ble_conn_params_init_t * p_init);
jksoft 0:8c643bfe55b7 71
jksoft 0:8c643bfe55b7 72 /**@brief Function for stopping the Connection Parameters module.
jksoft 0:8c643bfe55b7 73 *
jksoft 0:8c643bfe55b7 74 * @details This function is intended to be used by the application to clean up the connection
jksoft 0:8c643bfe55b7 75 * parameters update module. This will stop the connection parameters update timer if
jksoft 0:8c643bfe55b7 76 * running, thereby preventing any impending connection parameters update procedure. This
jksoft 0:8c643bfe55b7 77 * function must be called by the application when it needs to clean itself up (for
jksoft 0:8c643bfe55b7 78 * example, before disabling the bluetooth SoftDevice) so that an unwanted timer expiry
jksoft 0:8c643bfe55b7 79 * event can be avoided.
jksoft 0:8c643bfe55b7 80 *
jksoft 0:8c643bfe55b7 81 * @return NRF_SUCCESS on successful initialization, otherwise an error code.
jksoft 0:8c643bfe55b7 82 */
jksoft 0:8c643bfe55b7 83 uint32_t ble_conn_params_stop(void);
jksoft 0:8c643bfe55b7 84
jksoft 0:8c643bfe55b7 85 /**@brief Function for changing the current connection parameters to a new set.
jksoft 0:8c643bfe55b7 86 *
jksoft 0:8c643bfe55b7 87 * @details Use this function to change the connection parameters to a new set of parameter
jksoft 0:8c643bfe55b7 88 * (ie different from the ones given at init of the module).
jksoft 0:8c643bfe55b7 89 * This function is usefull for scenario where most of the time the application
jksoft 0:8c643bfe55b7 90 * needs a relatively big connection interval, and just sometimes, for a temporary
jksoft 0:8c643bfe55b7 91 * period requires shorter connection interval, for example to transfer a higher
jksoft 0:8c643bfe55b7 92 * amount of data.
jksoft 0:8c643bfe55b7 93 * If the given parameters does not match the current connection's parameters
jksoft 0:8c643bfe55b7 94 * this function initiates a new negotiation.
jksoft 0:8c643bfe55b7 95 *
jksoft 0:8c643bfe55b7 96 * @param[in] new_params This contains the new connections parameters to setup.
jksoft 0:8c643bfe55b7 97 *
jksoft 0:8c643bfe55b7 98 * @return NRF_SUCCESS on successful initialization, otherwise an error code.
jksoft 0:8c643bfe55b7 99 */
jksoft 0:8c643bfe55b7 100 uint32_t ble_conn_params_change_conn_params(ble_gap_conn_params_t *new_params);
jksoft 0:8c643bfe55b7 101
jksoft 0:8c643bfe55b7 102 /**@brief Function for handling the Application's BLE Stack events.
jksoft 0:8c643bfe55b7 103 *
jksoft 0:8c643bfe55b7 104 * @details Handles all events from the BLE stack that are of interest to this module.
jksoft 0:8c643bfe55b7 105 *
jksoft 0:8c643bfe55b7 106 * @param[in] p_ble_evt The event received from the BLE stack.
jksoft 0:8c643bfe55b7 107 */
jksoft 0:8c643bfe55b7 108 void ble_conn_params_on_ble_evt(ble_evt_t * p_ble_evt);
jksoft 0:8c643bfe55b7 109
jksoft 0:8c643bfe55b7 110 #endif // BLE_CONN_PARAMS_H__
jksoft 0:8c643bfe55b7 111
jksoft 0:8c643bfe55b7 112 /** @} */