Committer:
jinu
Date:
Thu Feb 09 06:08:17 2017 +0000
Revision:
0:6ba9b94b8997
NRF51 serialization libraries for mDot

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jinu 0:6ba9b94b8997 1 /* Copyright (c) Nordic Semiconductor ASA
jinu 0:6ba9b94b8997 2 * All rights reserved.
jinu 0:6ba9b94b8997 3 *
jinu 0:6ba9b94b8997 4 * Redistribution and use in source and binary forms, with or without modification,
jinu 0:6ba9b94b8997 5 * are permitted provided that the following conditions are met:
jinu 0:6ba9b94b8997 6 *
jinu 0:6ba9b94b8997 7 * 1. Redistributions of source code must retain the above copyright notice, this
jinu 0:6ba9b94b8997 8 * list of conditions and the following disclaimer.
jinu 0:6ba9b94b8997 9 *
jinu 0:6ba9b94b8997 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this
jinu 0:6ba9b94b8997 11 * list of conditions and the following disclaimer in the documentation and/or
jinu 0:6ba9b94b8997 12 * other materials provided with the distribution.
jinu 0:6ba9b94b8997 13 *
jinu 0:6ba9b94b8997 14 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
jinu 0:6ba9b94b8997 15 * contributors to this software may be used to endorse or promote products
jinu 0:6ba9b94b8997 16 * derived from this software without specific prior written permission.
jinu 0:6ba9b94b8997 17 *
jinu 0:6ba9b94b8997 18 * 4. This software must only be used in a processor manufactured by Nordic
jinu 0:6ba9b94b8997 19 * Semiconductor ASA, or in a processor manufactured by a third party that
jinu 0:6ba9b94b8997 20 * is used in combination with a processor manufactured by Nordic Semiconductor.
jinu 0:6ba9b94b8997 21 *
jinu 0:6ba9b94b8997 22 *
jinu 0:6ba9b94b8997 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
jinu 0:6ba9b94b8997 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
jinu 0:6ba9b94b8997 25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jinu 0:6ba9b94b8997 26 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
jinu 0:6ba9b94b8997 27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jinu 0:6ba9b94b8997 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
jinu 0:6ba9b94b8997 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
jinu 0:6ba9b94b8997 30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jinu 0:6ba9b94b8997 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
jinu 0:6ba9b94b8997 32 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jinu 0:6ba9b94b8997 33 */
jinu 0:6ba9b94b8997 34 #ifndef BLE_GAP_APP_H__
jinu 0:6ba9b94b8997 35 #define BLE_GAP_APP_H__
jinu 0:6ba9b94b8997 36
jinu 0:6ba9b94b8997 37 /**@file
jinu 0:6ba9b94b8997 38 *
jinu 0:6ba9b94b8997 39 * @defgroup ble_gap_app GAP Application command request encoders and command response decoders
jinu 0:6ba9b94b8997 40 * @{
jinu 0:6ba9b94b8997 41 * @ingroup ble_sdk_lib_serialization
jinu 0:6ba9b94b8997 42 *
jinu 0:6ba9b94b8997 43 * @brief GAP Application command request encoders and command response decoders.
jinu 0:6ba9b94b8997 44 */
jinu 0:6ba9b94b8997 45 #include "ble.h"
jinu 0:6ba9b94b8997 46 #include "ble_gap.h"
jinu 0:6ba9b94b8997 47
jinu 0:6ba9b94b8997 48 /**
jinu 0:6ba9b94b8997 49 * @brief Encodes @ref sd_ble_gap_address_get command request.
jinu 0:6ba9b94b8997 50 *
jinu 0:6ba9b94b8997 51 * @sa @ref nrf51_address_get_encoding for packet format,
jinu 0:6ba9b94b8997 52 * @ref ble_gap_address_get_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 53 *
jinu 0:6ba9b94b8997 54 * @param[in] p_address Pointer to address.
jinu 0:6ba9b94b8997 55 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 56 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 57 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 58 *
jinu 0:6ba9b94b8997 59 * @note \p p_address will not be updated by the command
jinu 0:6ba9b94b8997 60 * request encoder. Updated values are set by @ref ble_gap_address_get_rsp_dec.
jinu 0:6ba9b94b8997 61 *
jinu 0:6ba9b94b8997 62 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 63 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 64 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 65 */
jinu 0:6ba9b94b8997 66 uint32_t ble_gap_address_get_req_enc(ble_gap_addr_t const * const p_address,
jinu 0:6ba9b94b8997 67 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 68 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 69
jinu 0:6ba9b94b8997 70 /**
jinu 0:6ba9b94b8997 71 * @brief Decodes response to @ref sd_ble_gap_address_get command.
jinu 0:6ba9b94b8997 72 *
jinu 0:6ba9b94b8997 73 * @sa @ref nrf51_address_get_encoding for packet format,
jinu 0:6ba9b94b8997 74 * @ref ble_gap_address_get_req_enc for command request encoder.
jinu 0:6ba9b94b8997 75 *
jinu 0:6ba9b94b8997 76 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 77 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 78 * @param[out] p_address Pointer to address.
jinu 0:6ba9b94b8997 79 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 80 *
jinu 0:6ba9b94b8997 81 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 82 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 83 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 84 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 85 * expected operation code.
jinu 0:6ba9b94b8997 86 */
jinu 0:6ba9b94b8997 87 uint32_t ble_gap_address_get_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 88 uint32_t packet_len,
jinu 0:6ba9b94b8997 89 ble_gap_addr_t * const p_address,
jinu 0:6ba9b94b8997 90 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 91
jinu 0:6ba9b94b8997 92 /**
jinu 0:6ba9b94b8997 93 * @brief Encodes @ref sd_ble_gap_address_set command request.
jinu 0:6ba9b94b8997 94 *
jinu 0:6ba9b94b8997 95 * @sa @ref nrf51_gap_addr_encoding for packet format,
jinu 0:6ba9b94b8997 96 * @ref ble_gap_address_set_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 97 *
jinu 0:6ba9b94b8997 98 * @param[in] addr_cycle_mode Address cycle mode.
jinu 0:6ba9b94b8997 99 * @param[in] p_addr Pointer to address structure.
jinu 0:6ba9b94b8997 100 * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 101 * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 102 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 103 *
jinu 0:6ba9b94b8997 104 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 105 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 106 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 107 */
jinu 0:6ba9b94b8997 108 uint32_t ble_gap_address_set_req_enc(uint8_t addr_cycle_mode,
jinu 0:6ba9b94b8997 109 ble_gap_addr_t const * const p_addr,
jinu 0:6ba9b94b8997 110 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 111 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 112
jinu 0:6ba9b94b8997 113 /**
jinu 0:6ba9b94b8997 114 * @brief Decodes response to @ref sd_ble_gap_address_set command.
jinu 0:6ba9b94b8997 115 *
jinu 0:6ba9b94b8997 116 * @sa @ref nrf51_gap_addr_encoding for packet format,
jinu 0:6ba9b94b8997 117 * @ref ble_gap_address_set_req_enc for command request encoder.
jinu 0:6ba9b94b8997 118 *
jinu 0:6ba9b94b8997 119 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 120 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 121 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 122 *
jinu 0:6ba9b94b8997 123 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 124 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 125 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 126 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 127 * expected operation code.
jinu 0:6ba9b94b8997 128 */
jinu 0:6ba9b94b8997 129 uint32_t ble_gap_address_set_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 130 uint32_t packet_len,
jinu 0:6ba9b94b8997 131 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 132
jinu 0:6ba9b94b8997 133 /**
jinu 0:6ba9b94b8997 134 * @brief Encodes @ref sd_ble_gap_adv_data_set command request.
jinu 0:6ba9b94b8997 135 *
jinu 0:6ba9b94b8997 136 * @sa @ref nrf51_adv_set_encoding for packet format,
jinu 0:6ba9b94b8997 137 * @ref ble_gap_adv_data_set_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 138 *
jinu 0:6ba9b94b8997 139 * @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes
jinu 0:6ba9b94b8997 140 * are made to the current advertisement packet data.
jinu 0:6ba9b94b8997 141 * @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets.
jinu 0:6ba9b94b8997 142 * Should be 0 if p_data is NULL, can be 0 if p_data is not NULL.
jinu 0:6ba9b94b8997 143 * @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL,
jinu 0:6ba9b94b8997 144 * no changes are made to the current scan response packet data.
jinu 0:6ba9b94b8997 145 * @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets.
jinu 0:6ba9b94b8997 146 * Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL.
jinu 0:6ba9b94b8997 147 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 148 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 149 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 150 *
jinu 0:6ba9b94b8997 151 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 152 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 153 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 154 */
jinu 0:6ba9b94b8997 155 uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data,
jinu 0:6ba9b94b8997 156 uint8_t dlen,
jinu 0:6ba9b94b8997 157 uint8_t const * const p_sr_data,
jinu 0:6ba9b94b8997 158 uint8_t srdlen,
jinu 0:6ba9b94b8997 159 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 160 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 161
jinu 0:6ba9b94b8997 162 /**
jinu 0:6ba9b94b8997 163 * @brief Decodes response to @ref sd_ble_gap_adv_data_set command.
jinu 0:6ba9b94b8997 164 *
jinu 0:6ba9b94b8997 165 * @sa @ref nrf51_adv_set_encoding for packet format,
jinu 0:6ba9b94b8997 166 * @ref ble_gap_adv_data_set_req_enc for command request encoder.
jinu 0:6ba9b94b8997 167 *
jinu 0:6ba9b94b8997 168 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 169 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 170 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 171 *
jinu 0:6ba9b94b8997 172 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 173 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 174 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 175 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 176 * expected operation code.
jinu 0:6ba9b94b8997 177 */
jinu 0:6ba9b94b8997 178 uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 179 uint32_t packet_len,
jinu 0:6ba9b94b8997 180 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 181
jinu 0:6ba9b94b8997 182 /**
jinu 0:6ba9b94b8997 183 * @brief Encodes @ref sd_ble_gap_adv_start command request.
jinu 0:6ba9b94b8997 184 *
jinu 0:6ba9b94b8997 185 * @sa @ref nrf51_adv_start_encoding for packet format,
jinu 0:6ba9b94b8997 186 * @ref ble_gap_adv_start_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 187 *
jinu 0:6ba9b94b8997 188 * @param[in] p_adv_params Pointer to advertising parameters structure.
jinu 0:6ba9b94b8997 189 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 190 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 191 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 192 *
jinu 0:6ba9b94b8997 193 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 194 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 195 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 196 */
jinu 0:6ba9b94b8997 197 uint32_t ble_gap_adv_start_req_enc(ble_gap_adv_params_t const * const p_adv_params,
jinu 0:6ba9b94b8997 198 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 199 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 200
jinu 0:6ba9b94b8997 201 /**
jinu 0:6ba9b94b8997 202 * @brief Decodes response to @ref sd_ble_gap_adv_start command.
jinu 0:6ba9b94b8997 203 *
jinu 0:6ba9b94b8997 204 * @sa @ref nrf51_adv_start_encoding for packet format,
jinu 0:6ba9b94b8997 205 * @ref ble_gap_adv_start_req_enc for command request encoder.
jinu 0:6ba9b94b8997 206 *
jinu 0:6ba9b94b8997 207 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 208 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 209 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 210 *
jinu 0:6ba9b94b8997 211 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 212 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 213 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 214 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 215 * expected operation code.
jinu 0:6ba9b94b8997 216 */
jinu 0:6ba9b94b8997 217 uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 218 uint32_t packet_len,
jinu 0:6ba9b94b8997 219 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 220
jinu 0:6ba9b94b8997 221 /**
jinu 0:6ba9b94b8997 222 * @brief Encodes @ref sd_ble_gap_tx_power_set command request.
jinu 0:6ba9b94b8997 223 *
jinu 0:6ba9b94b8997 224 * @sa @ref nrf51_tx_power_set_encoding for packet format,
jinu 0:6ba9b94b8997 225 * @ref ble_gap_tx_power_set_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 226 *
jinu 0:6ba9b94b8997 227 * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
jinu 0:6ba9b94b8997 228 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 229 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 230 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 231 *
jinu 0:6ba9b94b8997 232 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 233 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 234 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 235 */
jinu 0:6ba9b94b8997 236 uint32_t ble_gap_tx_power_set_req_enc(int8_t tx_power,
jinu 0:6ba9b94b8997 237 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 238 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 239
jinu 0:6ba9b94b8997 240 /**
jinu 0:6ba9b94b8997 241 * @brief Decodes response to @ref sd_ble_gap_tx_power_set command.
jinu 0:6ba9b94b8997 242 *
jinu 0:6ba9b94b8997 243 * @sa @ref nrf51_tx_power_set_encoding for packet format,
jinu 0:6ba9b94b8997 244 * @ref ble_gap_adv_start_req_snc for command request encoder.
jinu 0:6ba9b94b8997 245 *
jinu 0:6ba9b94b8997 246 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 247 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 248 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 249 *
jinu 0:6ba9b94b8997 250 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 251 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 252 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 253 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 254 * expected operation code.
jinu 0:6ba9b94b8997 255 */
jinu 0:6ba9b94b8997 256 uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 257 uint32_t packet_len,
jinu 0:6ba9b94b8997 258 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 259
jinu 0:6ba9b94b8997 260 /**
jinu 0:6ba9b94b8997 261 * @brief Encodes @ref sd_ble_gap_appearance_get command request.
jinu 0:6ba9b94b8997 262 *
jinu 0:6ba9b94b8997 263 * @sa @ref nrf51_appearance_get_encoding for packet format,
jinu 0:6ba9b94b8997 264 * @ref ble_gap_appearance_get_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 265 *
jinu 0:6ba9b94b8997 266 * @param[in] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES.
jinu 0:6ba9b94b8997 267 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 268 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 269 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 270 *
jinu 0:6ba9b94b8997 271 * @note \p p_appearance will not be updated by the command
jinu 0:6ba9b94b8997 272 * request encoder. Updated values are set by @ref ble_gap_appearance_get_rsp_dec.
jinu 0:6ba9b94b8997 273 *
jinu 0:6ba9b94b8997 274 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 275 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 276 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 277 */
jinu 0:6ba9b94b8997 278 uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance,
jinu 0:6ba9b94b8997 279 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 280 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 281
jinu 0:6ba9b94b8997 282 /**
jinu 0:6ba9b94b8997 283 * @brief Decodes response to @ref sd_ble_gap_appearance_get command.
jinu 0:6ba9b94b8997 284 *
jinu 0:6ba9b94b8997 285 * @sa @ref nrf51_appearance_get_encoding for packet format,
jinu 0:6ba9b94b8997 286 * @ref ble_gap_appearance_get_req_enc for command request encoder.
jinu 0:6ba9b94b8997 287 *
jinu 0:6ba9b94b8997 288 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 289 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 290 * @param[out] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES.
jinu 0:6ba9b94b8997 291 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 292 *
jinu 0:6ba9b94b8997 293 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 294 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 295 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 296 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 297 * expected operation code.
jinu 0:6ba9b94b8997 298 */
jinu 0:6ba9b94b8997 299 uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 300 uint32_t packet_len,
jinu 0:6ba9b94b8997 301 uint16_t * const p_appearance,
jinu 0:6ba9b94b8997 302 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 303
jinu 0:6ba9b94b8997 304 /**
jinu 0:6ba9b94b8997 305 * @brief Encodes @ref sd_ble_gap_appearance_set command request.
jinu 0:6ba9b94b8997 306 *
jinu 0:6ba9b94b8997 307 * @sa @ref nrf51_appearance_set_encoding for packet format,
jinu 0:6ba9b94b8997 308 * @ref ble_gap_appearance_set_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 309 *
jinu 0:6ba9b94b8997 310 * @param[in] p_appearance Appearance (16-bit), see @ref BLE_APPEARANCES.
jinu 0:6ba9b94b8997 311 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 312 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 313 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 314 *
jinu 0:6ba9b94b8997 315 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 316 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 317 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 318 */
jinu 0:6ba9b94b8997 319 uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance,
jinu 0:6ba9b94b8997 320 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 321 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 322
jinu 0:6ba9b94b8997 323 /**
jinu 0:6ba9b94b8997 324 * @brief Decodes response to @ref sd_ble_gap_appearance_set command.
jinu 0:6ba9b94b8997 325 *
jinu 0:6ba9b94b8997 326 * @sa @ref nrf51_appearance_set_encoding for packet format,
jinu 0:6ba9b94b8997 327 * @ref ble_gap_adv_start_req_snc for command request encoder.
jinu 0:6ba9b94b8997 328 *
jinu 0:6ba9b94b8997 329 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 330 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 331 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 332 *
jinu 0:6ba9b94b8997 333 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 334 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 335 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 336 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 337 * expected operation code.
jinu 0:6ba9b94b8997 338 */
jinu 0:6ba9b94b8997 339 uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 340 uint32_t packet_len,
jinu 0:6ba9b94b8997 341 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 342
jinu 0:6ba9b94b8997 343 /**
jinu 0:6ba9b94b8997 344 * @brief Encodes @ref sd_ble_gap_device_name_get command request.
jinu 0:6ba9b94b8997 345 *
jinu 0:6ba9b94b8997 346 * @sa @ref nrf51_device_name_get_encoding for packet format,
jinu 0:6ba9b94b8997 347 * @ref ble_gap_device_name_get_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 348 *
jinu 0:6ba9b94b8997 349 * @param[in] p_dev_name Pointer to an empty buffer where the UTF-8 <b>non NULL-terminated</b>
jinu 0:6ba9b94b8997 350 * string will be placed. Set to NULL to obtain the complete device
jinu 0:6ba9b94b8997 351 * name length.
jinu 0:6ba9b94b8997 352 * @param[in] p_len Length of the buffer pointed by p_dev_name.
jinu 0:6ba9b94b8997 353 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 354 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 355 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 356 *
jinu 0:6ba9b94b8997 357 * @note \p p_dev_name and \p p_len will not be updated by the command
jinu 0:6ba9b94b8997 358 * request encoder. Updated values are set by @ref ble_gap_device_name_get_rsp_dec.
jinu 0:6ba9b94b8997 359 *
jinu 0:6ba9b94b8997 360 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 361 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 362 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 363 */
jinu 0:6ba9b94b8997 364 uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name,
jinu 0:6ba9b94b8997 365 uint16_t const * const p_dev_name_len,
jinu 0:6ba9b94b8997 366 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 367 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 368
jinu 0:6ba9b94b8997 369 /**
jinu 0:6ba9b94b8997 370 * @brief Decodes response to @ref sd_ble_gap_device_name_get command.
jinu 0:6ba9b94b8997 371 *
jinu 0:6ba9b94b8997 372 * @sa @ref nrf51_device_name_get_encoding for packet format,
jinu 0:6ba9b94b8997 373 * @ref ble_gap_device_name_get_req_enc for command request encoder.
jinu 0:6ba9b94b8997 374 *
jinu 0:6ba9b94b8997 375 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 376 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 377 * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8
jinu 0:6ba9b94b8997 378 * <b>non NULL-terminated</b> string will be placed.
jinu 0:6ba9b94b8997 379 * @param[in,out] p_dev_namelen Length of the buffer pointed by p_dev_name, complete device name
jinu 0:6ba9b94b8997 380 * length on output.
jinu 0:6ba9b94b8997 381 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 382 *
jinu 0:6ba9b94b8997 383 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 384 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 385 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 386 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 387 * expected operation code.
jinu 0:6ba9b94b8997 388 */
jinu 0:6ba9b94b8997 389 uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 390 uint32_t packet_len,
jinu 0:6ba9b94b8997 391 uint8_t * const p_dev_name,
jinu 0:6ba9b94b8997 392 uint16_t * const p_dev_name_len,
jinu 0:6ba9b94b8997 393 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 394
jinu 0:6ba9b94b8997 395 /**
jinu 0:6ba9b94b8997 396 * @brief Encodes @ref sd_ble_gap_device_name_set command request.
jinu 0:6ba9b94b8997 397 *
jinu 0:6ba9b94b8997 398 * @sa @ref nrf51_device_name_set_encoding for packet format,
jinu 0:6ba9b94b8997 399 * @ref ble_gap_device_name_set_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 400 *
jinu 0:6ba9b94b8997 401 * @param[in] p_write_perm Write permissions for the Device Name characteristic see
jinu 0:6ba9b94b8997 402 * @ref ble_gap_conn_sec_mode_t.
jinu 0:6ba9b94b8997 403 * @param[in] p_dev_name Pointer to a UTF-8 encoded, <b>non NULL-terminated</b> string.
jinu 0:6ba9b94b8997 404 * @param[in] len Length of the UTF-8, <b>non NULL-terminated</b> string pointed
jinu 0:6ba9b94b8997 405 * to by p_dev_name in octets (must be smaller or equal
jinu 0:6ba9b94b8997 406 * than @ref BLE_GAP_DEVNAME_MAX_LEN).
jinu 0:6ba9b94b8997 407 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 408 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 409 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 410 *
jinu 0:6ba9b94b8997 411 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 412 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 413 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 414 */
jinu 0:6ba9b94b8997 415 uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm,
jinu 0:6ba9b94b8997 416 uint8_t const * const p_dev_name,
jinu 0:6ba9b94b8997 417 uint16_t len,
jinu 0:6ba9b94b8997 418 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 419 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 420
jinu 0:6ba9b94b8997 421 /**
jinu 0:6ba9b94b8997 422 * @brief Decodes response to @ref sd_ble_gap_device_name_set command.
jinu 0:6ba9b94b8997 423 *
jinu 0:6ba9b94b8997 424 * @sa @ref nrf51_device_name_set_encoding for packet format,
jinu 0:6ba9b94b8997 425 * @ref ble_gap_device_name_get_req_snc for command request encoder.
jinu 0:6ba9b94b8997 426 *
jinu 0:6ba9b94b8997 427 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 428 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 429 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 430 *
jinu 0:6ba9b94b8997 431 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 432 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 433 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 434 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 435 * expected operation code.
jinu 0:6ba9b94b8997 436 */
jinu 0:6ba9b94b8997 437 uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 438 uint32_t packet_len,
jinu 0:6ba9b94b8997 439 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 440
jinu 0:6ba9b94b8997 441 /**
jinu 0:6ba9b94b8997 442 * @brief Encodes @ref sd_ble_gap_ppcp_set command request.
jinu 0:6ba9b94b8997 443 *
jinu 0:6ba9b94b8997 444 * @sa @ref nrf51_ppcp_set_encoding for packet format,
jinu 0:6ba9b94b8997 445 * @ref ble_gap_ppcp_set_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 446 *
jinu 0:6ba9b94b8997 447 * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the
jinu 0:6ba9b94b8997 448 * desired parameters.
jinu 0:6ba9b94b8997 449 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 450 * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
jinu 0:6ba9b94b8997 451 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 452 *
jinu 0:6ba9b94b8997 453 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 454 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 455 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 456 */
jinu 0:6ba9b94b8997 457 uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params,
jinu 0:6ba9b94b8997 458 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 459 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 460
jinu 0:6ba9b94b8997 461 /**
jinu 0:6ba9b94b8997 462 * @brief Decodes response to @ref sd_ble_gap_ppcp_set command.
jinu 0:6ba9b94b8997 463 *
jinu 0:6ba9b94b8997 464 * @sa @ref nrf51_ppcp_set_encoding for packet format,
jinu 0:6ba9b94b8997 465 * @ref ble_gap_ppcp_set_req_enc for command request encoder.
jinu 0:6ba9b94b8997 466 *
jinu 0:6ba9b94b8997 467 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 468 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 469 * @param[out] p_result_code Command result code.
jinu 0:6ba9b94b8997 470 *
jinu 0:6ba9b94b8997 471 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 472 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 473 * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 474 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
jinu 0:6ba9b94b8997 475 * expected operation code.
jinu 0:6ba9b94b8997 476 */
jinu 0:6ba9b94b8997 477 uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 478 uint32_t packet_len,
jinu 0:6ba9b94b8997 479 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 480
jinu 0:6ba9b94b8997 481 /**@brief Encodes @ref sd_ble_gap_conn_param_update command request.
jinu 0:6ba9b94b8997 482 *
jinu 0:6ba9b94b8997 483 * @sa @ref nrf51_gap_conn_param_update_encoding for packet format,
jinu 0:6ba9b94b8997 484 * @ref ble_gap_conn_param_update_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 485 *
jinu 0:6ba9b94b8997 486 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 487 * @param[in] p_conn_params Pointer to desired connection parameters..
jinu 0:6ba9b94b8997 488 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 489 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 490 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 491 *
jinu 0:6ba9b94b8997 492 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 493 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 494 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 495 */
jinu 0:6ba9b94b8997 496 uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 497 ble_gap_conn_params_t const * const p_conn_params,
jinu 0:6ba9b94b8997 498 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 499 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 500
jinu 0:6ba9b94b8997 501 /**@brief Decodes response to @ref sd_ble_gap_conn_param_update command.
jinu 0:6ba9b94b8997 502 *
jinu 0:6ba9b94b8997 503 * @sa @ref nrf51_gap_conn_param_update_encoding for packet format,
jinu 0:6ba9b94b8997 504 * @ref ble_gap_conn_param_update_req_enc for command request encoder.
jinu 0:6ba9b94b8997 505 *
jinu 0:6ba9b94b8997 506 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 507 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 508 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 509 *
jinu 0:6ba9b94b8997 510 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 511 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 512 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 513 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 514 * operation code.
jinu 0:6ba9b94b8997 515 */
jinu 0:6ba9b94b8997 516 uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 517 uint32_t packet_len,
jinu 0:6ba9b94b8997 518 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 519
jinu 0:6ba9b94b8997 520 /**@brief Encodes @ref sd_ble_gap_disconnect command request.
jinu 0:6ba9b94b8997 521 *
jinu 0:6ba9b94b8997 522 * @sa @ref nrf51_disconnect_encoding for packet format,
jinu 0:6ba9b94b8997 523 * @ref ble_gap_disconnect_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 524 *
jinu 0:6ba9b94b8997 525 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 526 * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES.
jinu 0:6ba9b94b8997 527 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 528 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 529 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 530 *
jinu 0:6ba9b94b8997 531 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 532 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 533 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 534 */
jinu 0:6ba9b94b8997 535 uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 536 uint8_t hci_status_code,
jinu 0:6ba9b94b8997 537 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 538 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 539
jinu 0:6ba9b94b8997 540 /**@brief Decodes response to @ref sd_ble_gap_disconnect command.
jinu 0:6ba9b94b8997 541 *
jinu 0:6ba9b94b8997 542 * @sa @ref nrf51_disconnect_encoding for packet format,
jinu 0:6ba9b94b8997 543 * @ref ble_gap_disconnect_req_enc for command request encoder.
jinu 0:6ba9b94b8997 544 *
jinu 0:6ba9b94b8997 545 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 546 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 547 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 548 *
jinu 0:6ba9b94b8997 549 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 550 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 551 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 552 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 553 * operation code.
jinu 0:6ba9b94b8997 554 */
jinu 0:6ba9b94b8997 555 uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 556 uint32_t packet_len,
jinu 0:6ba9b94b8997 557 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 558
jinu 0:6ba9b94b8997 559
jinu 0:6ba9b94b8997 560 /**@brief Encodes @ref sd_ble_gap_rssi_stop command request.
jinu 0:6ba9b94b8997 561 *
jinu 0:6ba9b94b8997 562 * @sa @ref nrf51_rssi_stop for packet format,
jinu 0:6ba9b94b8997 563 * @ref ble_gap_rssi_stop_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 564 *
jinu 0:6ba9b94b8997 565 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 566 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 567 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 568 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 569 *
jinu 0:6ba9b94b8997 570 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 571 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 572 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 573 */
jinu 0:6ba9b94b8997 574 uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 575 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 576 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 577
jinu 0:6ba9b94b8997 578 /**@brief Decodes response to @ref sd_ble__rssi_stop command.
jinu 0:6ba9b94b8997 579 *
jinu 0:6ba9b94b8997 580 * @sa @ref nrf51_rssi_stop for packet format,
jinu 0:6ba9b94b8997 581 * @ref ble_gap_rssi_stop_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 582 *
jinu 0:6ba9b94b8997 583 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 584 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 585 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 586 *
jinu 0:6ba9b94b8997 587 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 588 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 589 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 590 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 591 * operation code.
jinu 0:6ba9b94b8997 592 */
jinu 0:6ba9b94b8997 593 uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 594 uint32_t packet_len,
jinu 0:6ba9b94b8997 595 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 596
jinu 0:6ba9b94b8997 597
jinu 0:6ba9b94b8997 598
jinu 0:6ba9b94b8997 599
jinu 0:6ba9b94b8997 600 /**@brief Encodes @ref sd_ble_gap_ppcp_get command request.
jinu 0:6ba9b94b8997 601 *
jinu 0:6ba9b94b8997 602 * @sa @ref nrf51_gap_ppcp_get_encoding for packet format,
jinu 0:6ba9b94b8997 603 * @ref ble_gap_ppcp_get_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 604 *
jinu 0:6ba9b94b8997 605 * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the
jinu 0:6ba9b94b8997 606 * parameters will be stored.
jinu 0:6ba9b94b8997 607 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 608 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 609 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 610 *
jinu 0:6ba9b94b8997 611 * @note \p p_conn_params will not be updated by the command request encoder. Updated values are
jinu 0:6ba9b94b8997 612 * set by @ref ble_gap_ppcp_get_rsp_dec.
jinu 0:6ba9b94b8997 613 *
jinu 0:6ba9b94b8997 614 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 615 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 616 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 617 */
jinu 0:6ba9b94b8997 618 uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params,
jinu 0:6ba9b94b8997 619 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 620 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 621
jinu 0:6ba9b94b8997 622 /**@brief Decodes response to @ref sd_ble_gap_ppcp_get command.
jinu 0:6ba9b94b8997 623 *
jinu 0:6ba9b94b8997 624 * @sa @ref nrf51_gap_ppcp_get_encoding for packet format,
jinu 0:6ba9b94b8997 625 * @ref ble_gap_ppcp_get_req_enc for command request encoder.
jinu 0:6ba9b94b8997 626 *
jinu 0:6ba9b94b8997 627 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 628 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 629 * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters
jinu 0:6ba9b94b8997 630 * will be stored.
jinu 0:6ba9b94b8997 631 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 632 *
jinu 0:6ba9b94b8997 633 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 634 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 635 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 636 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 637 * operation code.
jinu 0:6ba9b94b8997 638 */
jinu 0:6ba9b94b8997 639 uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 640 uint32_t packet_len,
jinu 0:6ba9b94b8997 641 ble_gap_conn_params_t * const p_conn_params,
jinu 0:6ba9b94b8997 642 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 643
jinu 0:6ba9b94b8997 644 /**@brief Encodes @ref sd_ble_gap_auth_key_reply command request.
jinu 0:6ba9b94b8997 645 *
jinu 0:6ba9b94b8997 646 * @sa @ref nrf51_gap_auth_key_reply_encoding for packet format,
jinu 0:6ba9b94b8997 647 * @ref ble_gap_auth_key_reply_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 648 *
jinu 0:6ba9b94b8997 649 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 650 * @param[in] key_type Key type which defines length of key data as defined for
jinu 0:6ba9b94b8997 651 * @ref sd_ble_gap_auth_key_reply .
jinu 0:6ba9b94b8997 652 * @param[in] p_key Pointer to a buffer which contains key
jinu 0:6ba9b94b8997 653 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 654 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 655 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 656 *
jinu 0:6ba9b94b8997 657 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 658 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 659 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 660 * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect param provided (key_type).
jinu 0:6ba9b94b8997 661 */
jinu 0:6ba9b94b8997 662 uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 663 uint8_t key_type,
jinu 0:6ba9b94b8997 664 uint8_t const * const p_key,
jinu 0:6ba9b94b8997 665 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 666 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 667
jinu 0:6ba9b94b8997 668 /**@brief Decodes response to @ref sd_ble_gap_auth_key_reply command.
jinu 0:6ba9b94b8997 669 *
jinu 0:6ba9b94b8997 670 * @sa @ref nrf51_gap_auth_key_reply_encoding for packet format,
jinu 0:6ba9b94b8997 671 * @ref ble_gap_sec_auth_key_req_enc for command request encoder.
jinu 0:6ba9b94b8997 672 *
jinu 0:6ba9b94b8997 673 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 674 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 675 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 676 *
jinu 0:6ba9b94b8997 677 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 678 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 679 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 680 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 681 * operation code.
jinu 0:6ba9b94b8997 682 */
jinu 0:6ba9b94b8997 683 uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 684 uint32_t packet_len,
jinu 0:6ba9b94b8997 685 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 686
jinu 0:6ba9b94b8997 687 /**@brief Encodes @ref sd_ble_gap_sec_info_reply command request.
jinu 0:6ba9b94b8997 688 *
jinu 0:6ba9b94b8997 689 * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format,
jinu 0:6ba9b94b8997 690 * @ref ble_gap_sec_info_reply_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 691 *
jinu 0:6ba9b94b8997 692 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 693 * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information
jinu 0:6ba9b94b8997 694 * structure.
jinu 0:6ba9b94b8997 695 * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information
jinu 0:6ba9b94b8997 696 * structure.
jinu 0:6ba9b94b8997 697 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 698 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 699 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 700 *
jinu 0:6ba9b94b8997 701 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 702 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 703 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 704 */
jinu 0:6ba9b94b8997 705 uint32_t ble_gap_sec_info_reply_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 706 ble_gap_enc_info_t const * const p_enc_info,
jinu 0:6ba9b94b8997 707 ble_gap_sign_info_t const * const p_sign_info,
jinu 0:6ba9b94b8997 708 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 709 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 710
jinu 0:6ba9b94b8997 711 /**@brief Decodes response to @ref sd_ble_gap_sec_info_reply command.
jinu 0:6ba9b94b8997 712 *
jinu 0:6ba9b94b8997 713 * @sa @ref nrf51_gap_sec_info_reply_encoding for packet format,
jinu 0:6ba9b94b8997 714 * @ref ble_gap_sec_info_reply_req_enc for command request encoder.
jinu 0:6ba9b94b8997 715 *
jinu 0:6ba9b94b8997 716 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 717 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 718 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 719 *
jinu 0:6ba9b94b8997 720 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 721 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 722 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 723 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 724 * operation code.
jinu 0:6ba9b94b8997 725 */
jinu 0:6ba9b94b8997 726 uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 727 uint32_t packet_len,
jinu 0:6ba9b94b8997 728 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 729
jinu 0:6ba9b94b8997 730 /**@brief Encodes @ref sd_ble_gap_sec_params_reply command request.
jinu 0:6ba9b94b8997 731 *
jinu 0:6ba9b94b8997 732 * @sa @ref nrf51_sec_params_reply_encoding for packet format,
jinu 0:6ba9b94b8997 733 * @ref ble_gap_sec_params_reply_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 734 *
jinu 0:6ba9b94b8997 735 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 736 * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS.
jinu 0:6ba9b94b8997 737 * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters
jinu 0:6ba9b94b8997 738 * structure.
jinu 0:6ba9b94b8997 739 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 740 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 741 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 742 *
jinu 0:6ba9b94b8997 743 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 744 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 745 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 746 */
jinu 0:6ba9b94b8997 747 uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 748 uint8_t sec_status,
jinu 0:6ba9b94b8997 749 ble_gap_sec_params_t const * const p_sec_params,
jinu 0:6ba9b94b8997 750 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 751 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 752
jinu 0:6ba9b94b8997 753 /**@brief Decodes response to @ref sd_ble_gap_sec_params_reply command.
jinu 0:6ba9b94b8997 754 *
jinu 0:6ba9b94b8997 755 * @sa @ref nrf51_sec_params_reply_encoding for packet format,
jinu 0:6ba9b94b8997 756 * @ref ble_gap_sec_params_reply_req_enc for command request encoder.
jinu 0:6ba9b94b8997 757 *
jinu 0:6ba9b94b8997 758 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 759 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 760 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 761 *
jinu 0:6ba9b94b8997 762 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 763 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 764 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 765 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 766 * operation code.
jinu 0:6ba9b94b8997 767 */
jinu 0:6ba9b94b8997 768 uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 769 uint32_t packet_len,
jinu 0:6ba9b94b8997 770 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 771
jinu 0:6ba9b94b8997 772 /**@brief Encodes @ref sd_ble_gap_authenticate command request.
jinu 0:6ba9b94b8997 773 *
jinu 0:6ba9b94b8997 774 * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format,
jinu 0:6ba9b94b8997 775 * @ref ble_gap_authenticate_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 776 *
jinu 0:6ba9b94b8997 777 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 778 * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters
jinu 0:6ba9b94b8997 779 * structure.
jinu 0:6ba9b94b8997 780 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 781 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 782 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 783 *
jinu 0:6ba9b94b8997 784 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 785 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 786 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 787 */
jinu 0:6ba9b94b8997 788 uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 789 ble_gap_sec_params_t const * const p_sec_params,
jinu 0:6ba9b94b8997 790 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 791 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 792
jinu 0:6ba9b94b8997 793 /**@brief Decodes response to @ref sd_ble_gap_authenticate command.
jinu 0:6ba9b94b8997 794 *
jinu 0:6ba9b94b8997 795 * @sa @ref nrf51_ble_gap_authenticate_encoding for packet format,
jinu 0:6ba9b94b8997 796 * @ref ble_gap_authenticate_req_enc for command request encoder.
jinu 0:6ba9b94b8997 797 *
jinu 0:6ba9b94b8997 798 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 799 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 800 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 801 *
jinu 0:6ba9b94b8997 802 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 803 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 804 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 805 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 806 * operation code.
jinu 0:6ba9b94b8997 807 */
jinu 0:6ba9b94b8997 808 uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 809 uint32_t packet_len,
jinu 0:6ba9b94b8997 810 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 811
jinu 0:6ba9b94b8997 812 /**@brief Encodes @ref sd_ble_gap_adv_stop command request.
jinu 0:6ba9b94b8997 813 *
jinu 0:6ba9b94b8997 814 * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format,
jinu 0:6ba9b94b8997 815 * @ref ble_gap_adv_stop_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 816 *
jinu 0:6ba9b94b8997 817 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 818 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 819 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 820 *
jinu 0:6ba9b94b8997 821 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 822 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 823 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 824 */
jinu 0:6ba9b94b8997 825 uint32_t ble_gap_adv_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 826
jinu 0:6ba9b94b8997 827 /**@brief Decodes response to @ref sd_ble_gap_adv_stop command.
jinu 0:6ba9b94b8997 828 *
jinu 0:6ba9b94b8997 829 * @sa @ref nrf51_sd_ble_gap_adv_stop for packet format,
jinu 0:6ba9b94b8997 830 * @ref ble_gap_adv_stop_req_enc for command request encoder.
jinu 0:6ba9b94b8997 831 *
jinu 0:6ba9b94b8997 832 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 833 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 834 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 835 *
jinu 0:6ba9b94b8997 836 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 837 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 838 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 839 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 840 * operation code.
jinu 0:6ba9b94b8997 841 */
jinu 0:6ba9b94b8997 842 uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 843 uint32_t packet_len,
jinu 0:6ba9b94b8997 844 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 845
jinu 0:6ba9b94b8997 846 /**@brief Encodes @ref sd_ble_gap_conn_sec_get command request.
jinu 0:6ba9b94b8997 847 *
jinu 0:6ba9b94b8997 848 * @sa @ref nrf51_conn_sec_get_encoding for packet format,
jinu 0:6ba9b94b8997 849 * @ref ble_gap_conn_sec_get_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 850 *
jinu 0:6ba9b94b8997 851 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 852 * @param[in] p_conn_sec Pointer to \ref ble_gap_conn_sec_t which will be filled in
jinu 0:6ba9b94b8997 853 * response.
jinu 0:6ba9b94b8997 854 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 855 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 856 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 857 *
jinu 0:6ba9b94b8997 858 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 859 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 860 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 861 */
jinu 0:6ba9b94b8997 862 uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 863 ble_gap_conn_sec_t const * const p_conn_sec,
jinu 0:6ba9b94b8997 864 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 865 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 866
jinu 0:6ba9b94b8997 867 /**@brief Decodes response to @ref sd_ble_gap_conn_sec_get command.
jinu 0:6ba9b94b8997 868 *
jinu 0:6ba9b94b8997 869 * @sa @ref nrf51_conn_sec_get_encoding for packet format,
jinu 0:6ba9b94b8997 870 * @ref ble_gap_conn_sec_get_req_enc for command request encoder.
jinu 0:6ba9b94b8997 871 *
jinu 0:6ba9b94b8997 872 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 873 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 874 * @param[out] pp_conn_sec Pointer to pointer to \ref ble_gap_conn_sec_t which will be filled by
jinu 0:6ba9b94b8997 875 * the decoded data (if present).
jinu 0:6ba9b94b8997 876 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 877 *
jinu 0:6ba9b94b8997 878 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 879 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 880 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 881 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 882 * operation code.
jinu 0:6ba9b94b8997 883 */
jinu 0:6ba9b94b8997 884 uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 885 uint32_t packet_len,
jinu 0:6ba9b94b8997 886 ble_gap_conn_sec_t * * const pp_conn_sec,
jinu 0:6ba9b94b8997 887 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 888
jinu 0:6ba9b94b8997 889 /**@brief Encodes @ref sd_ble_gap_rssi_start command request.
jinu 0:6ba9b94b8997 890 *
jinu 0:6ba9b94b8997 891 * @sa @ref nrf51_rssi_start_encoding for packet format,
jinu 0:6ba9b94b8997 892 * @ref ble_gap_rssi_start_rsp_dec for command response decoder.
jinu 0:6ba9b94b8997 893 *
jinu 0:6ba9b94b8997 894 * @param[in] conn_handle Connection handle of the connection.
jinu 0:6ba9b94b8997 895 * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
jinu 0:6ba9b94b8997 896 * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
jinu 0:6ba9b94b8997 897 * \c out: Length of encoded command packet.
jinu 0:6ba9b94b8997 898 *
jinu 0:6ba9b94b8997 899 * @retval NRF_SUCCESS Encoding success.
jinu 0:6ba9b94b8997 900 * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 901 * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 902 */
jinu 0:6ba9b94b8997 903 uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle,
jinu 0:6ba9b94b8997 904 uint8_t * const p_buf,
jinu 0:6ba9b94b8997 905 uint32_t * const p_buf_len);
jinu 0:6ba9b94b8997 906
jinu 0:6ba9b94b8997 907 /**@brief Decodes response to @ref sd_ble_gap_rssi_start command.
jinu 0:6ba9b94b8997 908 *
jinu 0:6ba9b94b8997 909 * @sa @ref nrf51_rssi_start_encoding for packet format,
jinu 0:6ba9b94b8997 910 * @ref ble_gap_rssi_start_req_enc for command request encoder.
jinu 0:6ba9b94b8997 911 *
jinu 0:6ba9b94b8997 912 * @param[in] p_buf Pointer to beginning of command response packet.
jinu 0:6ba9b94b8997 913 * @param[in] packet_len Length (in bytes) of response packet.
jinu 0:6ba9b94b8997 914 * @param[out] result_code Command response result code.
jinu 0:6ba9b94b8997 915 *
jinu 0:6ba9b94b8997 916 * @retval NRF_SUCCESS Decoding success.
jinu 0:6ba9b94b8997 917 * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
jinu 0:6ba9b94b8997 918 * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
jinu 0:6ba9b94b8997 919 * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
jinu 0:6ba9b94b8997 920 * operation code.
jinu 0:6ba9b94b8997 921 */
jinu 0:6ba9b94b8997 922 uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf,
jinu 0:6ba9b94b8997 923 uint32_t packet_len,
jinu 0:6ba9b94b8997 924 uint32_t * const p_result_code);
jinu 0:6ba9b94b8997 925
jinu 0:6ba9b94b8997 926 /** @} */
jinu 0:6ba9b94b8997 927 #endif
jinu 0:6ba9b94b8997 928