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:24:20 2014 +0000
Revision:
1:48f6e08a3ac2
2014.08.20?????BLE?????????????; ???mbed?????????????????; mbed HRM1017; Nordic nRF51822

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 /** @file
jksoft 1:48f6e08a3ac2 13 *
jksoft 1:48f6e08a3ac2 14 * @defgroup ble_sdk_lib_racp Record Access Control Point
jksoft 1:48f6e08a3ac2 15 * @{
jksoft 1:48f6e08a3ac2 16 * @ingroup ble_sdk_lib
jksoft 1:48f6e08a3ac2 17 * @brief Record Access Control Point library.
jksoft 1:48f6e08a3ac2 18 */
jksoft 1:48f6e08a3ac2 19
jksoft 1:48f6e08a3ac2 20 #ifndef BLE_RACP_H__
jksoft 1:48f6e08a3ac2 21 #define BLE_RACP_H__
jksoft 1:48f6e08a3ac2 22
jksoft 1:48f6e08a3ac2 23 #include <stdint.h>
jksoft 1:48f6e08a3ac2 24 #include <stdbool.h>
jksoft 1:48f6e08a3ac2 25 #include "ble.h"
jksoft 1:48f6e08a3ac2 26 #include "ble_types.h"
jksoft 1:48f6e08a3ac2 27 #include "ble.h"
jksoft 1:48f6e08a3ac2 28
jksoft 1:48f6e08a3ac2 29 /**@brief Record Access Control Point opcodes. */
jksoft 1:48f6e08a3ac2 30 #define RACP_OPCODE_RESERVED 0 /**< Record Access Control Point opcode - Reserved for future use. */
jksoft 1:48f6e08a3ac2 31 #define RACP_OPCODE_REPORT_RECS 1 /**< Record Access Control Point opcode - Report stored records. */
jksoft 1:48f6e08a3ac2 32 #define RACP_OPCODE_DELETE_RECS 2 /**< Record Access Control Point opcode - Delete stored records. */
jksoft 1:48f6e08a3ac2 33 #define RACP_OPCODE_ABORT_OPERATION 3 /**< Record Access Control Point opcode - Abort operation. */
jksoft 1:48f6e08a3ac2 34 #define RACP_OPCODE_REPORT_NUM_RECS 4 /**< Record Access Control Point opcode - Report number of stored records. */
jksoft 1:48f6e08a3ac2 35 #define RACP_OPCODE_NUM_RECS_RESPONSE 5 /**< Record Access Control Point opcode - Number of stored records response. */
jksoft 1:48f6e08a3ac2 36 #define RACP_OPCODE_RESPONSE_CODE 6 /**< Record Access Control Point opcode - Response code. */
jksoft 1:48f6e08a3ac2 37
jksoft 1:48f6e08a3ac2 38 /**@brief Record Access Control Point operators. */
jksoft 1:48f6e08a3ac2 39 #define RACP_OPERATOR_NULL 0 /**< Record Access Control Point operator - Null. */
jksoft 1:48f6e08a3ac2 40 #define RACP_OPERATOR_ALL 1 /**< Record Access Control Point operator - All records. */
jksoft 1:48f6e08a3ac2 41 #define RACP_OPERATOR_LESS_OR_EQUAL 2 /**< Record Access Control Point operator - Less than or equal to. */
jksoft 1:48f6e08a3ac2 42 #define RACP_OPERATOR_GREATER_OR_EQUAL 3 /**< Record Access Control Point operator - Greater than or equal to. */
jksoft 1:48f6e08a3ac2 43 #define RACP_OPERATOR_RANGE 4 /**< Record Access Control Point operator - Within range of (inclusive). */
jksoft 1:48f6e08a3ac2 44 #define RACP_OPERATOR_FIRST 5 /**< Record Access Control Point operator - First record (i.e. oldest record). */
jksoft 1:48f6e08a3ac2 45 #define RACP_OPERATOR_LAST 6 /**< Record Access Control Point operator - Last record (i.e. most recent record). */
jksoft 1:48f6e08a3ac2 46 #define RACP_OPERATOR_RFU_START 7 /**< Record Access Control Point operator - Start of Reserved for Future Use area. */
jksoft 1:48f6e08a3ac2 47
jksoft 1:48f6e08a3ac2 48 /**@brief Record Access Control Point response codes. */
jksoft 1:48f6e08a3ac2 49 #define RACP_RESPONSE_RESERVED 0 /**< Record Access Control Point response code - Reserved for future use. */
jksoft 1:48f6e08a3ac2 50 #define RACP_RESPONSE_SUCCESS 1 /**< Record Access Control Point response code - Successful operation. */
jksoft 1:48f6e08a3ac2 51 #define RACP_RESPONSE_OPCODE_UNSUPPORTED 2 /**< Record Access Control Point response code - Unsupported op code received. */
jksoft 1:48f6e08a3ac2 52 #define RACP_RESPONSE_INVALID_OPERATOR 3 /**< Record Access Control Point response code - Operator not valid for service. */
jksoft 1:48f6e08a3ac2 53 #define RACP_RESPONSE_OPERATOR_UNSUPPORTED 4 /**< Record Access Control Point response code - Unsupported operator. */
jksoft 1:48f6e08a3ac2 54 #define RACP_RESPONSE_INVALID_OPERAND 5 /**< Record Access Control Point response code - Operand not valid for service. */
jksoft 1:48f6e08a3ac2 55 #define RACP_RESPONSE_NO_RECORDS_FOUND 6 /**< Record Access Control Point response code - No matching records found. */
jksoft 1:48f6e08a3ac2 56 #define RACP_RESPONSE_ABORT_FAILED 7 /**< Record Access Control Point response code - Abort could not be completed. */
jksoft 1:48f6e08a3ac2 57 #define RACP_RESPONSE_PROCEDURE_NOT_DONE 8 /**< Record Access Control Point response code - Procedure could not be completed. */
jksoft 1:48f6e08a3ac2 58 #define RACP_RESPONSE_OPERAND_UNSUPPORTED 9 /**< Record Access Control Point response code - Unsupported operand. */
jksoft 1:48f6e08a3ac2 59
jksoft 1:48f6e08a3ac2 60 /**@brief Record Access Control Point value structure. */
jksoft 1:48f6e08a3ac2 61 typedef struct
jksoft 1:48f6e08a3ac2 62 {
jksoft 1:48f6e08a3ac2 63 uint8_t opcode; /**< Op Code. */
jksoft 1:48f6e08a3ac2 64 uint8_t operator; /**< Operator. */
jksoft 1:48f6e08a3ac2 65 uint8_t operand_len; /**< Length of the operand. */
jksoft 1:48f6e08a3ac2 66 uint8_t * p_operand; /**< Pointer to the operand. */
jksoft 1:48f6e08a3ac2 67 } ble_racp_value_t;
jksoft 1:48f6e08a3ac2 68
jksoft 1:48f6e08a3ac2 69 /**@brief Function for decoding a Record Access Control Point write.
jksoft 1:48f6e08a3ac2 70 *
jksoft 1:48f6e08a3ac2 71 * @details This call decodes a write to the Record Access Control Point.
jksoft 1:48f6e08a3ac2 72 *
jksoft 1:48f6e08a3ac2 73 * @param[in] data_len Length of data in received write.
jksoft 1:48f6e08a3ac2 74 * @param[in] p_data Pointer to received data.
jksoft 1:48f6e08a3ac2 75 * @param[out] p_racp_val Pointer to decoded Record Access Control Point write.
jksoft 1:48f6e08a3ac2 76 * @note This does not do a data copy. It assumes the data pointed to by
jksoft 1:48f6e08a3ac2 77 * p_data is persistant until no longer needed.
jksoft 1:48f6e08a3ac2 78 */
jksoft 1:48f6e08a3ac2 79 void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_racp_val);
jksoft 1:48f6e08a3ac2 80
jksoft 1:48f6e08a3ac2 81 /**@brief Function for encoding a Record Access Control Point response.
jksoft 1:48f6e08a3ac2 82 *
jksoft 1:48f6e08a3ac2 83 * @details This call encodes a response from the Record Access Control Point response.
jksoft 1:48f6e08a3ac2 84 *
jksoft 1:48f6e08a3ac2 85 * @param[in] p_racp_val Pointer to Record Access Control Point to encode.
jksoft 1:48f6e08a3ac2 86 * @param[out] p_data Pointer to where encoded data is written.
jksoft 1:48f6e08a3ac2 87 * NOTE! It is calling routines respsonsibility to make sure.
jksoft 1:48f6e08a3ac2 88 *
jksoft 1:48f6e08a3ac2 89 * @return Length of encoded data.
jksoft 1:48f6e08a3ac2 90 */
jksoft 1:48f6e08a3ac2 91 uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data);
jksoft 1:48f6e08a3ac2 92
jksoft 1:48f6e08a3ac2 93 #endif // BLE_RACP_H__
jksoft 1:48f6e08a3ac2 94
jksoft 1:48f6e08a3ac2 95 /** @} */
jksoft 1:48f6e08a3ac2 96
jksoft 1:48f6e08a3ac2 97 /** @endcond */