テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

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