テスト用

Fork of nRF51822 by Nordic Semiconductor

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Child:
37:c29c330d942c
Initial import of the nRF51822 code

Who changed what in which revision?

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