Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
nordic/nrf-sdk/ble/ble_racp.h@37:c29c330d942c, 2014-07-07 (annotated)
- Committer:
- Rohit Grover
- Date:
- Mon Jul 07 13:43:31 2014 +0100
- Revision:
- 37:c29c330d942c
- Parent:
- 0:eff01767de02
changes required to upgrade to V7 of the soft-device
Who changed what in which revision?
User | Revision | Line number | New 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 "ble.h" |
bogdanm | 0:eff01767de02 | 26 | #include "ble_types.h" |
bogdanm | 0:eff01767de02 | 27 | #include "ble.h" |
bogdanm | 0:eff01767de02 | 28 | |
bogdanm | 0:eff01767de02 | 29 | /**@brief Record Access Control Point opcodes. */ |
bogdanm | 0:eff01767de02 | 30 | #define RACP_OPCODE_RESERVED 0 /**< Record Access Control Point opcode - Reserved for future use. */ |
bogdanm | 0:eff01767de02 | 31 | #define RACP_OPCODE_REPORT_RECS 1 /**< Record Access Control Point opcode - Report stored records. */ |
bogdanm | 0:eff01767de02 | 32 | #define RACP_OPCODE_DELETE_RECS 2 /**< Record Access Control Point opcode - Delete stored records. */ |
bogdanm | 0:eff01767de02 | 33 | #define RACP_OPCODE_ABORT_OPERATION 3 /**< Record Access Control Point opcode - Abort operation. */ |
bogdanm | 0:eff01767de02 | 34 | #define RACP_OPCODE_REPORT_NUM_RECS 4 /**< Record Access Control Point opcode - Report number of stored records. */ |
bogdanm | 0:eff01767de02 | 35 | #define RACP_OPCODE_NUM_RECS_RESPONSE 5 /**< Record Access Control Point opcode - Number of stored records response. */ |
bogdanm | 0:eff01767de02 | 36 | #define RACP_OPCODE_RESPONSE_CODE 6 /**< Record Access Control Point opcode - Response code. */ |
bogdanm | 0:eff01767de02 | 37 | |
bogdanm | 0:eff01767de02 | 38 | /**@brief Record Access Control Point operators. */ |
bogdanm | 0:eff01767de02 | 39 | #define RACP_OPERATOR_NULL 0 /**< Record Access Control Point operator - Null. */ |
bogdanm | 0:eff01767de02 | 40 | #define RACP_OPERATOR_ALL 1 /**< Record Access Control Point operator - All records. */ |
bogdanm | 0:eff01767de02 | 41 | #define RACP_OPERATOR_LESS_OR_EQUAL 2 /**< Record Access Control Point operator - Less than or equal to. */ |
bogdanm | 0:eff01767de02 | 42 | #define RACP_OPERATOR_GREATER_OR_EQUAL 3 /**< Record Access Control Point operator - Greater than or equal to. */ |
bogdanm | 0:eff01767de02 | 43 | #define RACP_OPERATOR_RANGE 4 /**< Record Access Control Point operator - Within range of (inclusive). */ |
bogdanm | 0:eff01767de02 | 44 | #define RACP_OPERATOR_FIRST 5 /**< Record Access Control Point operator - First record (i.e. oldest record). */ |
bogdanm | 0:eff01767de02 | 45 | #define RACP_OPERATOR_LAST 6 /**< Record Access Control Point operator - Last record (i.e. most recent record). */ |
bogdanm | 0:eff01767de02 | 46 | #define RACP_OPERATOR_RFU_START 7 /**< Record Access Control Point operator - Start of Reserved for Future Use area. */ |
bogdanm | 0:eff01767de02 | 47 | |
bogdanm | 0:eff01767de02 | 48 | /**@brief Record Access Control Point response codes. */ |
bogdanm | 0:eff01767de02 | 49 | #define RACP_RESPONSE_RESERVED 0 /**< Record Access Control Point response code - Reserved for future use. */ |
bogdanm | 0:eff01767de02 | 50 | #define RACP_RESPONSE_SUCCESS 1 /**< Record Access Control Point response code - Successful operation. */ |
bogdanm | 0:eff01767de02 | 51 | #define RACP_RESPONSE_OPCODE_UNSUPPORTED 2 /**< Record Access Control Point response code - Unsupported op code received. */ |
bogdanm | 0:eff01767de02 | 52 | #define RACP_RESPONSE_INVALID_OPERATOR 3 /**< Record Access Control Point response code - Operator not valid for service. */ |
bogdanm | 0:eff01767de02 | 53 | #define RACP_RESPONSE_OPERATOR_UNSUPPORTED 4 /**< Record Access Control Point response code - Unsupported operator. */ |
bogdanm | 0:eff01767de02 | 54 | #define RACP_RESPONSE_INVALID_OPERAND 5 /**< Record Access Control Point response code - Operand not valid for service. */ |
bogdanm | 0:eff01767de02 | 55 | #define RACP_RESPONSE_NO_RECORDS_FOUND 6 /**< Record Access Control Point response code - No matching records found. */ |
bogdanm | 0:eff01767de02 | 56 | #define RACP_RESPONSE_ABORT_FAILED 7 /**< Record Access Control Point response code - Abort could not be completed. */ |
bogdanm | 0:eff01767de02 | 57 | #define RACP_RESPONSE_PROCEDURE_NOT_DONE 8 /**< Record Access Control Point response code - Procedure could not be completed. */ |
bogdanm | 0:eff01767de02 | 58 | #define RACP_RESPONSE_OPERAND_UNSUPPORTED 9 /**< Record Access Control Point response code - Unsupported operand. */ |
bogdanm | 0:eff01767de02 | 59 | |
bogdanm | 0:eff01767de02 | 60 | /**@brief Record Access Control Point value structure. */ |
bogdanm | 0:eff01767de02 | 61 | typedef struct |
bogdanm | 0:eff01767de02 | 62 | { |
bogdanm | 0:eff01767de02 | 63 | uint8_t opcode; /**< Op Code. */ |
bogdanm | 0:eff01767de02 | 64 | uint8_t operator; /**< Operator. */ |
bogdanm | 0:eff01767de02 | 65 | uint8_t operand_len; /**< Length of the operand. */ |
bogdanm | 0:eff01767de02 | 66 | uint8_t * p_operand; /**< Pointer to the operand. */ |
bogdanm | 0:eff01767de02 | 67 | } ble_racp_value_t; |
bogdanm | 0:eff01767de02 | 68 | |
bogdanm | 0:eff01767de02 | 69 | /**@brief Function for decoding a Record Access Control Point write. |
bogdanm | 0:eff01767de02 | 70 | * |
bogdanm | 0:eff01767de02 | 71 | * @details This call decodes a write to the Record Access Control Point. |
bogdanm | 0:eff01767de02 | 72 | * |
bogdanm | 0:eff01767de02 | 73 | * @param[in] data_len Length of data in received write. |
bogdanm | 0:eff01767de02 | 74 | * @param[in] p_data Pointer to received data. |
bogdanm | 0:eff01767de02 | 75 | * @param[out] p_racp_val Pointer to decoded Record Access Control Point write. |
bogdanm | 0:eff01767de02 | 76 | * @note This does not do a data copy. It assumes the data pointed to by |
bogdanm | 0:eff01767de02 | 77 | * p_data is persistant until no longer needed. |
bogdanm | 0:eff01767de02 | 78 | */ |
bogdanm | 0:eff01767de02 | 79 | void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_racp_val); |
bogdanm | 0:eff01767de02 | 80 | |
bogdanm | 0:eff01767de02 | 81 | /**@brief Function for encoding a Record Access Control Point response. |
bogdanm | 0:eff01767de02 | 82 | * |
bogdanm | 0:eff01767de02 | 83 | * @details This call encodes a response from the Record Access Control Point response. |
bogdanm | 0:eff01767de02 | 84 | * |
bogdanm | 0:eff01767de02 | 85 | * @param[in] p_racp_val Pointer to Record Access Control Point to encode. |
bogdanm | 0:eff01767de02 | 86 | * @param[out] p_data Pointer to where encoded data is written. |
bogdanm | 0:eff01767de02 | 87 | * NOTE! It is calling routines respsonsibility to make sure. |
bogdanm | 0:eff01767de02 | 88 | * |
bogdanm | 0:eff01767de02 | 89 | * @return Length of encoded data. |
bogdanm | 0:eff01767de02 | 90 | */ |
bogdanm | 0:eff01767de02 | 91 | uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data); |
bogdanm | 0:eff01767de02 | 92 | |
bogdanm | 0:eff01767de02 | 93 | #endif // BLE_RACP_H__ |
bogdanm | 0:eff01767de02 | 94 | |
bogdanm | 0:eff01767de02 | 95 | /** @} */ |
bogdanm | 0:eff01767de02 | 96 | |
bogdanm | 0:eff01767de02 | 97 | /** @endcond */ |