iOSのBLEコントローラアプリ「RCBController」とmbed HRM1017を接続し、RCサーボモータを操作するテストプログラムです。
Dependencies: BLE_API_Native_IRC Servo mbed
Fork of BLE_RCBController by
- 古いBLEライブラリを使っているのでプラットフォームは”Nordic nRF51822”を選択してください。
- ライブラリ類はUpdateしないでください。コンパイルエラーになります。
うまく接続できない時は、iPhone/iPadのBluetoothをOFF->ONしてキャッシュをクリアしてみてください。
BLE_API_Native_IRC/hw/nRF51822n/nordic/nrf-sdk/ble/rpc/ble_rpc_cmd_decoder.h@0:8c643bfe55b7, 2014-07-10 (annotated)
- Committer:
- jksoft
- Date:
- Thu Jul 10 14:21:52 2014 +0000
- Revision:
- 0:8c643bfe55b7
??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:8c643bfe55b7 | 1 | /* Copyright (c) 2013 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_rpc_cmd_decoder Command Decoder |
jksoft | 0:8c643bfe55b7 | 16 | * @{ |
jksoft | 0:8c643bfe55b7 | 17 | * @ingroup ble_sdk_lib_serialization |
jksoft | 0:8c643bfe55b7 | 18 | * |
jksoft | 0:8c643bfe55b7 | 19 | * @brief Decoder for serialized commands from Application Chip. |
jksoft | 0:8c643bfe55b7 | 20 | * |
jksoft | 0:8c643bfe55b7 | 21 | * @details This file contains declaration of common functions used for sending responses back to |
jksoft | 0:8c643bfe55b7 | 22 | * Application Chip after the command is processed, and function for processing commands |
jksoft | 0:8c643bfe55b7 | 23 | * received by the transport layer. |
jksoft | 0:8c643bfe55b7 | 24 | */ |
jksoft | 0:8c643bfe55b7 | 25 | |
jksoft | 0:8c643bfe55b7 | 26 | #ifndef BLE_RPC_CMD_DECODER_H__ |
jksoft | 0:8c643bfe55b7 | 27 | #define BLE_RPC_CMD_DECODER_H__ |
jksoft | 0:8c643bfe55b7 | 28 | |
jksoft | 0:8c643bfe55b7 | 29 | #include <stdint.h> |
jksoft | 0:8c643bfe55b7 | 30 | |
jksoft | 0:8c643bfe55b7 | 31 | #define RPC_DECODER_LENGTH_CHECK(LEN, INDEX, CMD) if ( INDEX > LEN) \ |
jksoft | 0:8c643bfe55b7 | 32 | return ble_rpc_cmd_resp_send(CMD, NRF_ERROR_INVALID_LENGTH); |
jksoft | 0:8c643bfe55b7 | 33 | |
jksoft | 0:8c643bfe55b7 | 34 | /**@brief Function for sending a Command Response packet to the Application Chip through the transport |
jksoft | 0:8c643bfe55b7 | 35 | * layer. |
jksoft | 0:8c643bfe55b7 | 36 | * |
jksoft | 0:8c643bfe55b7 | 37 | * @param[in] op_code The op code of the command for which the Command Response is sent. |
jksoft | 0:8c643bfe55b7 | 38 | * @param[in] status The status field to be encoded into the Command Response. |
jksoft | 0:8c643bfe55b7 | 39 | * |
jksoft | 0:8c643bfe55b7 | 40 | * @retval NRF_SUCCESS On successful write of Command Response, otherwise an error code. |
jksoft | 0:8c643bfe55b7 | 41 | * If the transport layer returns an error code while sending |
jksoft | 0:8c643bfe55b7 | 42 | * the Command Response, the same error code will be returned by this |
jksoft | 0:8c643bfe55b7 | 43 | * function (see @ref hci_transport_pkt_write for the list of |
jksoft | 0:8c643bfe55b7 | 44 | * error codes). |
jksoft | 0:8c643bfe55b7 | 45 | */ |
jksoft | 0:8c643bfe55b7 | 46 | uint32_t ble_rpc_cmd_resp_send(uint8_t op_code, uint32_t status); |
jksoft | 0:8c643bfe55b7 | 47 | |
jksoft | 0:8c643bfe55b7 | 48 | /**@brief Function for sending a command response with additional data to the Application Chip through |
jksoft | 0:8c643bfe55b7 | 49 | * the transport layer. |
jksoft | 0:8c643bfe55b7 | 50 | * |
jksoft | 0:8c643bfe55b7 | 51 | * @param[in] op_code The op code of the command for which the Command Response is sent. |
jksoft | 0:8c643bfe55b7 | 52 | * @param[in] status The status field to be encoded into the Command Response. |
jksoft | 0:8c643bfe55b7 | 53 | * @param[in] p_data The data to be sent along with the status. |
jksoft | 0:8c643bfe55b7 | 54 | * @param[in] data_len The length of the additional data. |
jksoft | 0:8c643bfe55b7 | 55 | * |
jksoft | 0:8c643bfe55b7 | 56 | * @retval NRF_SUCCESS On successful write of Command Response, otherwise an error code. |
jksoft | 0:8c643bfe55b7 | 57 | * If the transport layer returns an error code while sending |
jksoft | 0:8c643bfe55b7 | 58 | * the Command Response, the same error code will be returned by this |
jksoft | 0:8c643bfe55b7 | 59 | * function (see @ref hci_transport_pkt_write for the list of |
jksoft | 0:8c643bfe55b7 | 60 | * error codes). |
jksoft | 0:8c643bfe55b7 | 61 | */ |
jksoft | 0:8c643bfe55b7 | 62 | uint32_t ble_rpc_cmd_resp_data_send(uint8_t op_code, |
jksoft | 0:8c643bfe55b7 | 63 | uint8_t status, |
jksoft | 0:8c643bfe55b7 | 64 | const uint8_t * const p_data, |
jksoft | 0:8c643bfe55b7 | 65 | uint16_t data_len); |
jksoft | 0:8c643bfe55b7 | 66 | |
jksoft | 0:8c643bfe55b7 | 67 | /**@brief Function for scheduling an RPC command event to be processed in main-thread. |
jksoft | 0:8c643bfe55b7 | 68 | * |
jksoft | 0:8c643bfe55b7 | 69 | * @details The function will read the arrived packet from the transport layer |
jksoft | 0:8c643bfe55b7 | 70 | * which is passed for decoding by the rpc_cmd_decoder module. |
jksoft | 0:8c643bfe55b7 | 71 | * |
jksoft | 0:8c643bfe55b7 | 72 | * @param[in] p_event_data Event data. This will be NULL as rpc_evt_schedule |
jksoft | 0:8c643bfe55b7 | 73 | * does not set any data. |
jksoft | 0:8c643bfe55b7 | 74 | * @param[in] event_size Event data size. This will be 0 as rpc_evt_schedule |
jksoft | 0:8c643bfe55b7 | 75 | * does not set any data. |
jksoft | 0:8c643bfe55b7 | 76 | */ |
jksoft | 0:8c643bfe55b7 | 77 | void ble_rpc_cmd_handle(void * p_event_data, uint16_t event_size); |
jksoft | 0:8c643bfe55b7 | 78 | |
jksoft | 0:8c643bfe55b7 | 79 | #endif // BLE_RPC_CMD_DECODER_H__ |
jksoft | 0:8c643bfe55b7 | 80 | |
jksoft | 0:8c643bfe55b7 | 81 | /** @} */ |