http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h deleted file mode 100644 index d379807..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_app.h +++ /dev/null @@ -1,319 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ -#ifndef BLE_GATTC_EVT_APP_H__ -#define BLE_GATTC_EVT_APP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup ser_codecs Serialization codecs - * @ingroup ble_sdk_lib_serialization - */ - -/** - * @addtogroup ser_app_s130_codecs Application s130 codecs - * @ingroup ser_codecs - */ - -/**@file - * - * @defgroup ble_gattc_evt_app GATTC Application event decoders - * @{ - * @ingroup ser_app_s130_codecs - * - * @brief GATTC Application event decoders. - */ -#include "ble.h" - -/** - * @brief Decodes ble_gattc_evt_char_disc_rsp event. - * - * @sa @ref nrf51_gattc_evt_char_disc_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_char_val_by_uuid_read_rsp event. - * - * @sa @ref nrf51_gattc_evt_char_val_by_uuid_read_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_char_vals_read_rsp event. - * - * @sa @ref nrf51_gattc_evt_char_vals_read_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_desc_disc_rsp event. - * - * @sa @ref nrf51_gattc_evt_desc_disc_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_hvx event. - * - * @sa @ref nrf51_gattc_evt_hvx_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_prim_srvc_disc_rsp event. - * - * @sa @ref nrf51_gattc_evt_prim_srvc_disc_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_read_rsp event. - * - * @sa @ref nrf51_gattc_evt_read_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_rel_disc_rsp_dec event. - * - * @sa @ref nrf51_gattc_evt_rel_disc_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_timeout event. - * - * @sa @ref nrf51_gattc_evt_timeout_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_write_rsp event. - * - * @sa @ref nrf51_gattc_evt_write_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** - * @brief Decodes ble_gattc_evt_attr_info_disc_rsp event. - * - * @sa @ref nrf51_gattc_evt_attr_info_disc_rsp_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_gattc_evt_attr_info_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c deleted file mode 100644 index 7e1ad6b..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_attr_info_disc_rsp.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "ble_gattc_struct_serialization.h" -#include "app_util.h" - -uint32_t ble_gattc_evt_attr_info_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - uint32_t err_code; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - uint16_t conn_handle; - uint16_t gatt_status; - uint16_t error_handle; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &conn_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint16_t_dec(p_buf, packet_len, &index, &gatt_status); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint16_t_dec(p_buf, packet_len, &index, &error_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - uint32_t temp_index = index; - err_code = ble_gattc_evt_attr_info_disc_rsp_t_dec(p_buf, packet_len, &temp_index, NULL); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - uint32_t event_length = offsetof(ble_gattc_evt_t, params.attr_info_disc_rsp) + temp_index; - - if (p_event != NULL) - { - SER_ASSERT(event_length <= *p_event_len, NRF_ERROR_DATA_SIZE); - p_event->evt.gattc_evt.conn_handle = conn_handle; - p_event->evt.gattc_evt.gatt_status = gatt_status; - p_event->evt.gattc_evt.error_handle = error_handle; - - err_code = ble_gattc_evt_attr_info_disc_rsp_t_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.attr_info_disc_rsp); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - } - *p_event_len = event_length; - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c deleted file mode 100644 index 8ea82b2..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_disc_rsp.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" -#include "nordic_common.h" - - -uint32_t ble_gattc_evt_char_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(2 + 2 + 2 + 2, packet_len); - - uint16_t tmp_conn_handle; - uint16_t tmp_gatt_status; - uint16_t tmp_error_handle; - uint16_t tmp_service_count; - uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); - uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); - uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); - uint16_dec(p_buf, packet_len, &index, &tmp_service_count); - - - uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.char_disc_rsp) + - sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_char_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_CHAR_DISC_RSP; - p_event->header.evt_len = event_len; - p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; - p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; - p_event->evt.gattc_evt.error_handle = tmp_error_handle; - p_event->evt.gattc_evt.params.char_disc_rsp.count = tmp_service_count; - - SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 9), packet_len); - - for (uint16_t i = 0; i < tmp_service_count; i++) - { - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.uuid); - uint8_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].uuid.type); - - uint8_t characteristic_props; - uint8_dec(p_buf, packet_len, &index, &characteristic_props); - - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.broadcast = - !!(characteristic_props & BIT_0); - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.read = - !!(characteristic_props & BIT_1); - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write_wo_resp = - !!(characteristic_props & BIT_2); - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.write = - !!(characteristic_props & BIT_3); - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.notify = - !!(characteristic_props & BIT_4); - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.indicate = - !!(characteristic_props & BIT_5); - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_props.auth_signed_wr = - !!(characteristic_props & BIT_6); - - uint8_t characteristic_ext_props; - uint8_dec(p_buf, packet_len, &index, &characteristic_ext_props); - - p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].char_ext_props = - characteristic_ext_props & BIT_0; - - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_decl); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.char_disc_rsp.chars[i].handle_value); - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c deleted file mode 100644 index 4c8d107..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_val_by_uuid_read_rsp.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "app_util.h" -#include "ble.h" -#include "ble_serialization.h" -#include "ble_gattc_struct_serialization.h" -#include "ble_gattc_evt_app.h" - - -uint32_t ble_gattc_evt_char_val_by_uuid_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - uint32_t index = 0; - uint32_t err_code; - uint16_t conn_handle; - uint16_t gatt_status; - uint16_t error_handle; - - SER_ASSERT_LENGTH_LEQ(6, packet_len - index); - - uint32_t in_event_len = *p_event_len; - - *p_event_len = (offsetof(ble_evt_t, evt.gattc_evt.params)) - sizeof (ble_evt_hdr_t); - - uint16_dec(p_buf, packet_len, &index, &conn_handle); - uint16_dec(p_buf, packet_len, &index, &gatt_status); - uint16_dec(p_buf, packet_len, &index, &error_handle); - - void * p_data = NULL; - - if (p_event) - { - SER_ASSERT_LENGTH_LEQ(*p_event_len, in_event_len); - - p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP; - p_event->evt.gattc_evt.conn_handle = conn_handle; - p_event->evt.gattc_evt.gatt_status = gatt_status; - p_event->evt.gattc_evt.error_handle = error_handle; - - p_data = &p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp; - } - else - { - p_data = NULL; - } - - //call struct decoder with remaining size of event struct - uint32_t temp_event_len = in_event_len - *p_event_len; - err_code = ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec(p_buf, packet_len, &index, - &temp_event_len, p_data); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - //update event length with the amount processed by struct decoder - *p_event_len += temp_event_len; - - if (p_event) - { - p_event->header.evt_len = *p_event_len; - } - SER_ASSERT_LENGTH_EQ(index, packet_len); - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c deleted file mode 100644 index 258bf23..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_char_vals_read_rsp.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include "ble_gattc_struct_serialization.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - -#define BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION 6 - - -uint32_t ble_gattc_evt_char_vals_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - uint32_t event_len = 0; - - uint32_t error_code = NRF_SUCCESS; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(10, packet_len); - - event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.char_vals_read_rsp.values)) - - sizeof (ble_evt_hdr_t) + - uint16_decode(&p_buf[BLE_GATTC_EVT_CHAR_VALS_READ_RSP_LEN_POSITION]); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - else - { - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - *p_event_len = event_len; - } - - p_event->header.evt_id = BLE_GATTC_EVT_CHAR_VALS_READ_RSP; - - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); - - //Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP - error_code = - ble_gattc_evt_char_vals_read_rsp_t_dec(p_buf, packet_len, &index, - &(p_event->evt.gattc_evt.params.char_vals_read_rsp)); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - return error_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c deleted file mode 100644 index 77af946..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_desc_disc_rsp.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright (c) Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of other - * contributors to this software may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * 4. This software must only be used in a processor manufactured by Nordic - * Semiconductor ASA, or in a processor manufactured by a third party that - * is used in combination with a processor manufactured by Nordic Semiconductor. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ble_gattc_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_evt_desc_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); - - uint16_t tmp_conn_handle; - uint16_t tmp_gatt_status; - uint16_t tmp_error_handle; - uint16_t tmp_service_count; - uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); - uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); - uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); - uint16_dec(p_buf, packet_len, &index, &tmp_service_count); - - uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.desc_disc_rsp) + - sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_desc_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_DESC_DISC_RSP; - p_event->header.evt_len = event_len; - p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; - p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; - p_event->evt.gattc_evt.error_handle = tmp_error_handle; - p_event->evt.gattc_evt.params.desc_disc_rsp.count = tmp_service_count; - - SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 5), packet_len); - - for (uint16_t i = 0; i < tmp_service_count; i++) - { - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].handle); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.uuid); - uint8_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.desc_disc_rsp.descs[i].uuid.type); - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c deleted file mode 100644 index d8bdf19..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_hvx.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - -uint32_t ble_gattc_evt_hvx_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - uint16_t tmp_attr_len; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(11, packet_len); - - tmp_attr_len = uint16_decode(&(p_buf[9])); - - uint32_t event_len = offsetof(ble_gattc_evt_t, params.hvx) + - offsetof (ble_gattc_evt_hvx_t, data) + tmp_attr_len; - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_HVX; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.handle)); - uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.type)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.hvx.len)); - - SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); - - if (tmp_attr_len > 0) - { - memcpy(&(p_event->evt.gattc_evt.params.hvx.data[0]), &(p_buf[index]), tmp_attr_len); - index += tmp_attr_len; - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c deleted file mode 100644 index ab8c63e..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_prim_srvc_disc_rsp.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_evt_prim_srvc_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); - - uint16_t tmp_conn_handle; - uint16_t tmp_gatt_status; - uint16_t tmp_error_handle; - uint16_t tmp_service_count; - uint16_dec(p_buf, packet_len, &index, &tmp_conn_handle); - uint16_dec(p_buf, packet_len, &index, &tmp_gatt_status); - uint16_dec(p_buf, packet_len, &index, &tmp_error_handle); - uint16_dec(p_buf, packet_len, &index, &tmp_service_count); - - uint32_t event_len = offsetof(ble_evt_t, evt.gattc_evt.params.prim_srvc_disc_rsp) + - sizeof (uint16_t) + tmp_service_count * sizeof (ble_gattc_service_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP; - p_event->header.evt_len = event_len; - p_event->evt.gattc_evt.conn_handle = tmp_conn_handle; - p_event->evt.gattc_evt.gatt_status = tmp_gatt_status; - p_event->evt.gattc_evt.error_handle = tmp_error_handle; - p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.count = tmp_service_count; - - SER_ASSERT_LENGTH_LEQ(index + (tmp_service_count * 7), packet_len); - - for (uint16_t i = 0; i < tmp_service_count; i++) - { - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.uuid); - uint8_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].uuid.type); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. - start_handle); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gattc_evt.params.prim_srvc_disc_rsp.services[i].handle_range. - end_handle); - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c deleted file mode 100644 index 2dc198c..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_read_rsp.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_evt_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - uint16_t tmp_attr_len; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(12, packet_len); - - tmp_attr_len = uint16_decode(&(p_buf[10])); - - uint32_t event_len = offsetof(ble_gattc_evt_t, params.read_rsp) + - offsetof(ble_gattc_evt_read_rsp_t, data) + tmp_attr_len; - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_READ_RSP; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.offset)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.read_rsp.len)); - - SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); - - if (tmp_attr_len > 0) - { - memcpy(&(p_event->evt.gattc_evt.params.read_rsp.data[0]), &(p_buf[index]), tmp_attr_len); - index += tmp_attr_len; - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c deleted file mode 100644 index abfd611..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_rel_disc_rsp.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include "ble_gattc_struct_serialization.h" -#include "ble_serialization.h" -#include "app_util.h" - -#define BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION 6 - - -uint32_t ble_gattc_evt_rel_disc_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - uint32_t event_len = 0; - uint16_t include_count = 0; - - uint32_t error_code = NRF_SUCCESS; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(8, packet_len); - - include_count = uint16_decode(&p_buf[BLE_GATTC_EVT_REL_DISC_RSP_COUNT_POSITION]); - event_len = (uint16_t) (offsetof(ble_evt_t, evt.gattc_evt.params.rel_disc_rsp.includes)) - - sizeof (ble_evt_hdr_t) + (include_count * sizeof (ble_gattc_include_t)); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_REL_DISC_RSP; - error_code = - uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); - SER_ASSERT(error_code == NRF_SUCCESS, error_code); - error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); - SER_ASSERT(error_code == NRF_SUCCESS, error_code); - error_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); - SER_ASSERT(error_code == NRF_SUCCESS, error_code); - error_code = - ble_gattc_evt_rel_disc_rsp_t_dec(p_buf, packet_len, &index, - &(p_event->evt.gattc_evt.params.rel_disc_rsp)); - SER_ASSERT(error_code == NRF_SUCCESS, error_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - return error_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c deleted file mode 100644 index 0194709..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_timeout.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) Nordic Semiconductor ASA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this - * list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * 3. Neither the name of Nordic Semiconductor ASA nor the names of other - * contributors to this software may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * 4. This software must only be used in a processor manufactured by Nordic - * Semiconductor ASA, or in a processor manufactured by a third party that - * is used in combination with a processor manufactured by Nordic Semiconductor. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "ble_gattc_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_evt_timeout_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - uint32_t event_len; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); - - event_len = offsetof(ble_evt_t, evt.gattc_evt.params.timeout) + - sizeof (ble_gattc_evt_timeout_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_TIMEOUT; - p_event->header.evt_len = event_len; - - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.conn_handle); - uint8_dec(p_buf, packet_len, &index, &p_event->evt.gattc_evt.params.timeout.src); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c deleted file mode 100644 index 6605121..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_evt_write_rsp.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_evt_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_evt_write_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - ble_evt_t * const p_event, - uint32_t * const p_event_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(13, packet_len); - - uint16_t tmp_attr_len = uint16_decode(&(p_buf[11])); - - uint32_t event_len = offsetof(ble_gattc_evt_t, params.write_rsp) + - offsetof(ble_gattc_evt_write_rsp_t, data) + tmp_attr_len; - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GATTC_EVT_WRITE_RSP; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.conn_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.gatt_status)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.error_handle)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.handle)); - uint8_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.write_op)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.offset)); - uint16_dec(p_buf, packet_len, &index, &(p_event->evt.gattc_evt.params.write_rsp.len)); - - SER_ASSERT_LENGTH_LEQ(index + tmp_attr_len, packet_len); - - if (tmp_attr_len > 0) - { - memcpy(&(p_event->evt.gattc_evt.params.write_rsp.data[0]), &(p_buf[index]), tmp_attr_len); - index += tmp_attr_len; - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c deleted file mode 100644 index 12a709e..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_hv_confirm.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_app.h" -#include "ble_serialization.h" -#include "app_util.h" - -uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle, - uint16_t handle, - uint8_t * const p_buf, - uint32_t * const p_buf_len) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - uint8_t op_code = SD_BLE_GATTC_HV_CONFIRM; - uint32_t err_code = NRF_SUCCESS; - uint32_t buf_len = *p_buf_len; - uint32_t index = 0; - - err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint16_t_enc(&handle, p_buf, buf_len, &index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - *p_buf_len = index; - - return NRF_SUCCESS; -} - -uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - uint32_t * const p_result_code) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_HV_CONFIRM, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c deleted file mode 100644 index c5d5a86..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_primary_services_discover.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle, - uint16_t start_handle, - ble_uuid_t const * const p_srvc_uuid, - uint8_t * const p_buf, - uint32_t * p_buf_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(index + 5, *p_buf_len); - - p_buf[index++] = SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER; - index += uint16_encode(conn_handle, &p_buf[index]); - index += uint16_encode(start_handle, &p_buf[index]); - - SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); - - p_buf[index++] = (p_srvc_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_srvc_uuid != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); - - index += uint16_encode(p_srvc_uuid->uuid, &p_buf[index]); - p_buf[index++] = p_srvc_uuid->type; - } - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - uint32_t * const p_result_code) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, - p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c deleted file mode 100644 index c30d592..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_read.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_read_req_enc(uint16_t conn_handle, - uint16_t handle, - uint16_t offset, - uint8_t * const p_buf, - uint32_t * p_buf_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(index + 7, *p_buf_len); - - p_buf[index++] = SD_BLE_GATTC_READ; - index += uint16_encode(conn_handle, &p_buf[index]); - index += uint16_encode(handle, &p_buf[index]); - index += uint16_encode(offset, &p_buf[index]); - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - uint32_t * const p_result_code) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_READ, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c deleted file mode 100644 index dbc5bdc..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_relationships_discover.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -uint32_t ble_gattc_relationships_discover_req_enc( - uint16_t conn_handle, - ble_gattc_handle_range_t const * const p_handle_range, - uint8_t * const p_buf, - uint32_t * p_buf_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); - - p_buf[index++] = SD_BLE_GATTC_RELATIONSHIPS_DISCOVER; - index += uint16_encode(conn_handle, &p_buf[index]); - - SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); - p_buf[index++] = (p_handle_range != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_handle_range != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); - - index += uint16_encode(p_handle_range->start_handle, &p_buf[index]); - index += uint16_encode(p_handle_range->end_handle, &p_buf[index]); - } - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - uint32_t * const p_result_code) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, - p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c deleted file mode 100644 index d192c24..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gattc_write.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gattc_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - -uint32_t ble_gattc_write_req_enc(uint16_t conn_handle, - ble_gattc_write_params_t const * const p_write_params, - uint8_t * const p_buf, - uint32_t * p_buf_len) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); - - p_buf[index++] = SD_BLE_GATTC_WRITE; - index += uint16_encode(conn_handle, &p_buf[index]); - p_buf[index++] = (p_write_params == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; - - if (p_write_params != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + 9, *p_buf_len); - p_buf[index++] = p_write_params->write_op; - p_buf[index++] = p_write_params->flags; - index += uint16_encode(p_write_params->handle, &p_buf[index]); - index += uint16_encode(p_write_params->offset, &p_buf[index]); - index += uint16_encode(p_write_params->len, &p_buf[index]); - - SER_ERROR_CHECK(p_write_params->len <= BLE_GATTC_WRITE_P_VALUE_LEN_MAX, - NRF_ERROR_INVALID_PARAM); - - p_buf[index++] = (p_write_params->p_value == NULL) ? - SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT; - - if (p_write_params->p_value != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + p_write_params->len, *p_buf_len); - memcpy(&p_buf[index], p_write_params->p_value, p_write_params->len); - index += p_write_params->len; - } - } - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf, - uint32_t packet_len, - uint32_t * const p_result_code) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTC_WRITE, p_result_code); -}
