mbed HRM11017を使ってkonashi.jsでナイトライダー

Dependencies:   BLE_API_Native_IRC mbed

Fork of BLE_RCBController by Junichi Katsu

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_racp.h Source File

ble_racp.h

Go to the documentation of this file.
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
00002  *
00003  * The information contained herein is property of Nordic Semiconductor ASA.
00004  * Terms and conditions of usage are described in detail in NORDIC
00005  * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
00006  *
00007  * Licensees are granted free, non-transferable use of the information. NO
00008  * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
00009  * the file.
00010  */
00011 
00012 /** @file
00013  *
00014  * @defgroup ble_sdk_lib_racp Record Access Control Point
00015  * @{
00016  * @ingroup ble_sdk_lib
00017  * @brief Record Access Control Point library.
00018  */
00019 
00020 #ifndef BLE_RACP_H__
00021 #define BLE_RACP_H__
00022 
00023 #include <stdint.h>
00024 #include <stdbool.h>
00025 #include "nordic_global.h"
00026 #include "ble.h"
00027 #include "ble_types.h"
00028 #include "ble.h"
00029 
00030 /**@brief Record Access Control Point opcodes. */
00031 #define RACP_OPCODE_RESERVED                0       /**< Record Access Control Point opcode - Reserved for future use. */
00032 #define RACP_OPCODE_REPORT_RECS             1       /**< Record Access Control Point opcode - Report stored records. */
00033 #define RACP_OPCODE_DELETE_RECS             2       /**< Record Access Control Point opcode - Delete stored records. */
00034 #define RACP_OPCODE_ABORT_OPERATION         3       /**< Record Access Control Point opcode - Abort operation. */
00035 #define RACP_OPCODE_REPORT_NUM_RECS         4       /**< Record Access Control Point opcode - Report number of stored records. */
00036 #define RACP_OPCODE_NUM_RECS_RESPONSE       5       /**< Record Access Control Point opcode - Number of stored records response. */
00037 #define RACP_OPCODE_RESPONSE_CODE           6       /**< Record Access Control Point opcode - Response code. */
00038 
00039 /**@brief Record Access Control Point operators. */
00040 #define RACP_OPERATOR_NULL                  0       /**< Record Access Control Point operator - Null. */
00041 #define RACP_OPERATOR_ALL                   1       /**< Record Access Control Point operator - All records. */
00042 #define RACP_OPERATOR_LESS_OR_EQUAL         2       /**< Record Access Control Point operator - Less than or equal to. */
00043 #define RACP_OPERATOR_GREATER_OR_EQUAL      3       /**< Record Access Control Point operator - Greater than or equal to. */
00044 #define RACP_OPERATOR_RANGE                 4       /**< Record Access Control Point operator - Within range of (inclusive). */
00045 #define RACP_OPERATOR_FIRST                 5       /**< Record Access Control Point operator - First record (i.e. oldest record). */
00046 #define RACP_OPERATOR_LAST                  6       /**< Record Access Control Point operator - Last record (i.e. most recent record). */
00047 #define RACP_OPERATOR_RFU_START             7       /**< Record Access Control Point operator - Start of Reserved for Future Use area. */
00048 
00049 /**@brief Record Access Control Point response codes. */
00050 #define RACP_RESPONSE_RESERVED              0       /**< Record Access Control Point response code - Reserved for future use. */
00051 #define RACP_RESPONSE_SUCCESS               1       /**< Record Access Control Point response code - Successful operation. */
00052 #define RACP_RESPONSE_OPCODE_UNSUPPORTED    2       /**< Record Access Control Point response code - Unsupported op code received. */
00053 #define RACP_RESPONSE_INVALID_OPERATOR      3       /**< Record Access Control Point response code - Operator not valid for service. */
00054 #define RACP_RESPONSE_OPERATOR_UNSUPPORTED  4       /**< Record Access Control Point response code - Unsupported operator. */
00055 #define RACP_RESPONSE_INVALID_OPERAND       5       /**< Record Access Control Point response code - Operand not valid for service. */
00056 #define RACP_RESPONSE_NO_RECORDS_FOUND      6       /**< Record Access Control Point response code - No matching records found. */
00057 #define RACP_RESPONSE_ABORT_FAILED          7       /**< Record Access Control Point response code - Abort could not be completed. */
00058 #define RACP_RESPONSE_PROCEDURE_NOT_DONE    8       /**< Record Access Control Point response code - Procedure could not be completed. */
00059 #define RACP_RESPONSE_OPERAND_UNSUPPORTED   9       /**< Record Access Control Point response code - Unsupported operand. */
00060 
00061 /**@brief Record Access Control Point value structure. */
00062 typedef struct
00063 {
00064     uint8_t   opcode;                               /**< Op Code. */
00065     uint8_t   operator;                             /**< Operator. */
00066     uint8_t   operand_len;                          /**< Length of the operand. */
00067     uint8_t * p_operand;                            /**< Pointer to the operand. */
00068 } ble_racp_value_t;
00069 
00070 /**@brief Function for decoding a Record Access Control Point write.
00071  *
00072  * @details This call decodes a write to the Record Access Control Point.
00073  *
00074  * @param[in]   data_len     Length of data in received write.
00075  * @param[in]   p_data       Pointer to received data.
00076  * @param[out]  p_racp_val   Pointer to decoded Record Access Control Point write.
00077  *                           @note This does not do a data copy. It assumes the data pointed to by
00078  *                                 p_data is persistant until no longer needed.
00079  */
00080 void ble_racp_decode(uint8_t data_len, uint8_t * p_data, ble_racp_value_t * p_racp_val);
00081 
00082 /**@brief Function for encoding a Record Access Control Point response.
00083  *
00084  * @details This call encodes a response from the Record Access Control Point response.
00085  *
00086  * @param[in]   p_racp_val   Pointer to Record Access Control Point to encode.
00087  * @param[out]  p_data       Pointer to where encoded data is written.
00088  *                           NOTE! It is calling routines respsonsibility to make sure.
00089  *
00090  * @return      Length of encoded data.
00091  */
00092 uint8_t ble_racp_encode(const ble_racp_value_t * p_racp_val, uint8_t * p_data);
00093 
00094 #endif // BLE_RACP_H__
00095 
00096 /** @} */
00097 
00098 /** @endcond */