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