aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application')
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/middleware/app_mw_ant.c1868
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_acknowledge_message_tx.c90
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_get.c96
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_set.c78
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_adv_burst_config_set.c86
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_app.h1652
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_broadcast_message_tx.c90
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_capabilities_get.c93
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_assign.c83
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_close.c76
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_get.c103
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_set.c83
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_low_priority_rx_search_timeout_set.c79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_open_with_offset.c79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_get.c94
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_set.c78
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_get.c95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_set.c78
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_tx_power_set.c81
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_rx_search_timeout_set.c79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_status_get.c95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_unassign.c76
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_get.c130
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_set.c109
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_channel_enable.c82
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_get.c123
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_set.c90
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_key_set.c85
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode.c82
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode_init.c74
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_enable.c79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.c74
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.h81
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_add.c91
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_config.c81
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_clear.c76
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_get.c93
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_set.c76
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_network_address_set.c85
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_prox_search_set.c81
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_rx_scan_mode_start.c76
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_channel_priority_set.c78
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_waveform_set.c79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_stack_reset.c74
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_version_get.c93
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble.c621
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gap.c2025
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gattc.c566
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gatts.c773
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_l2cap.c453
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_nrf_soc.c171
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.c182
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.h151
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.c101
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.h109
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.c513
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.h523
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_event.c316
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.c129
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.h157
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.c1019
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.h1667
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.c415
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.h546
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.c286
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.h491
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.c262
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.h364
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.c439
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.h677
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.c190
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.h249
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.c279
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.h242
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.c183
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.h126
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.c95
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.h147
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.c100
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.h126
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_init.c83
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.c69
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.h79
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal.h116
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal_nrf5x.c163
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.c62
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.h60
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.c325
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.h193
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.c311
-rw-r--r--thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.h80
91 files changed, 23458 insertions, 0 deletions
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/middleware/app_mw_ant.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/middleware/app_mw_ant.c
new file mode 100644
index 0000000..016fa67
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/middleware/app_mw_ant.c
@@ -0,0 +1,1868 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdint.h>
+#include "ant_interface.h"
+#include "ble_serialization.h"
+#include "ant_app.h"
+#include "ser_sd_transport.h"
+#include "app_error.h"
+
+static void * mp_out_params[3];
+
+static void tx_buf_alloc(uint8_t * * p_data, uint32_t * p_len)
+{
+ uint32_t err_code;
+ uint16_t len16;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, &len16);
+ }
+ while (err_code != NRF_SUCCESS);
+
+ *p_data[0] = SER_PKT_TYPE_ANT_CMD;
+ *p_len = (uint32_t)len16 - 1;
+}
+
+/**@brief Command response callback function for @ref sd_ant_enable ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t enable_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_enable_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_enable(ANT_ENABLE * const p_ant_enable)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_enable_req_enc(p_ant_enable,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ enable_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_assign ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_assign_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_assign_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_assign(uint8_t channel, uint8_t channel_type, uint8_t network, uint8_t ext_assign)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_assign_req_enc(channel,
+ channel_type,
+ network,
+ ext_assign,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_assign_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_open_with_offset ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_open_with_offset_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_open_with_offset_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_open_with_offset(uint8_t channel, uint16_t usOffset)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_open_with_offset_req_enc(channel,
+ usOffset,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_open_with_offset_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_id_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_id_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_id_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_id_set (uint8_t channel, uint16_t device_number, uint8_t device_type, uint8_t transmit_type)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_id_set_req_enc(channel,
+ device_number,
+ device_type,
+ transmit_type,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_id_set_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_period_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_period_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_period_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_period_set(uint8_t channel, uint16_t period)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_period_set_req_enc(channel,
+ period,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_period_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_radio_freq_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_radio_freq_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_radio_freq_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_radio_freq_set (uint8_t channel, uint8_t freq)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_radio_freq_set_req_enc(channel,
+ freq,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_radio_freq_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_broadcast_message_tx ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t broadcast_message_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_broadcast_message_tx_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_broadcast_message_tx(uint8_t channel, uint8_t size, uint8_t * p_mesg)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_broadcast_message_tx_req_enc(channel,
+ size,
+ p_mesg,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ broadcast_message_tx_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_acknowledge_message_tx ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t acknowledge_message_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_acknowledge_message_tx_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_acknowledge_message_tx(uint8_t channel, uint8_t size, uint8_t * p_mesg)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_acknowledge_message_tx_req_enc(channel,
+ size,
+ p_mesg,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ acknowledge_message_tx_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_unassign ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_unassign_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_unassign_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_unassign(uint8_t channel)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_unassign_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_unassign_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_close ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_close_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_close_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_close(uint8_t channel)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_close_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_close_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_network_address_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t network_address_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_network_address_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_network_address_set(uint8_t network, const uint8_t * p_network_key)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_network_address_set_req_enc(network,
+ p_network_key,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ network_address_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_radio_tx_power_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_radio_tx_power_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_radio_tx_power_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_radio_tx_power_set(uint8_t channel, uint8_t tx_power, uint8_t custom_tx_power)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_radio_tx_power_set_req_enc(channel,
+ tx_power,
+ custom_tx_power,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_radio_tx_power_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_rx_search_timeout_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_rx_search_timeout_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_rx_search_timeout_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_rx_search_timeout_set(uint8_t channel, uint8_t timeout)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_rx_search_timeout_set_req_enc(channel,
+ timeout,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_rx_search_timeout_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_low_priority_rx_search_timeout_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_low_priority_rx_search_timeout_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_low_priority_rx_search_timeout_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_low_priority_rx_search_timeout_set(uint8_t channel, uint8_t timeout)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_channel_low_priority_rx_search_timeout_set_req_enc(channel,
+ timeout,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_low_priority_rx_search_timeout_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_prox_search_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t prox_search_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_prox_search_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_prox_search_set(uint8_t channel, uint8_t prox_threshold, uint8_t custom_prox_threshold)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_prox_search_set_req_enc(channel,
+ prox_threshold,
+ custom_prox_threshold,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ prox_search_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_search_waveform_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t search_waveform_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_search_waveform_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_search_waveform_set(uint8_t channel, uint16_t waveform)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_search_waveform_set_req_enc(channel,
+ waveform,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ search_waveform_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_id_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_id_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_id_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ mp_out_params[1],
+ mp_out_params[2],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_id_get(uint8_t channel, uint16_t * p_device_number, uint8_t * p_device_type, uint8_t * p_transmit_type)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_device_number;
+ mp_out_params[1] = p_device_type;
+ mp_out_params[2] = p_transmit_type;
+
+ const uint32_t err_code = ant_channel_id_get_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_id_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_radio_freq_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_radio_freq_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_radio_freq_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_radio_freq_get(uint8_t channel, uint8_t * p_r_freq)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_r_freq;
+
+ const uint32_t err_code = ant_channel_radio_freq_get_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_radio_freq_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_period_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_period_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_period_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_period_get(uint8_t channel, uint16_t * p_period)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_period;
+
+ const uint32_t err_code = ant_channel_period_get_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_period_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_search_channel_priority_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t search_channel_priority_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_search_channel_priority_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_search_channel_priority_set(uint8_t channel, uint8_t search_priority)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_search_channel_priority_set_req_enc(channel,
+ search_priority,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ search_channel_priority_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_active_search_sharing_cycles_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t active_search_sharing_cycles_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_active_search_sharing_cycles_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_active_search_sharing_cycles_set(uint8_t channel, uint8_t cycles)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_active_search_sharing_cycles_set_req_enc(channel,
+ cycles,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ active_search_sharing_cycles_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_lib_config_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t lib_config_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_lib_config_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_lib_config_set(uint8_t ant_lib_config)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_lib_config_set_req_enc(ant_lib_config,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ lib_config_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_active_search_sharing_channels_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t active_search_sharing_cycles_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_active_search_sharing_cycles_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_active_search_sharing_cycles_get(uint8_t channel, uint8_t * p_cycles)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_cycles;
+
+ const uint32_t err_code = ant_active_search_sharing_cycles_get_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ active_search_sharing_cycles_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_lib_config_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t lib_config_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_lib_config_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_lib_config_get(uint8_t * p_ant_lib_config)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_ant_lib_config;
+
+ const uint32_t err_code = ant_lib_config_get_req_enc(&(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ lib_config_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_lib_config_clear ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t lib_config_clear_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_lib_config_clear_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_lib_config_clear(uint8_t ant_lib_config)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_lib_config_clear_req_enc(ant_lib_config,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ lib_config_clear_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_stack_reset ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t stack_reset_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_stack_reset_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_stack_reset()
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_stack_reset_req_enc(&(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ stack_reset_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_rx_scan_mode_start ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t rx_scan_mode_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_rx_scan_mode_start_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_rx_scan_mode_start(uint8_t sync_channel_packets_only)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_rx_scan_mode_start_req_enc(sync_channel_packets_only,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ rx_scan_mode_start_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_id_list_add ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t id_list_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_id_list_add_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_id_list_add(uint8_t channel, uint8_t * p_dev_id, uint8_t list_index)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_id_list_add_req_enc(channel,
+ p_dev_id,
+ list_index,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ id_list_add_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_id_list_config ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t id_list_config_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_id_list_config_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_id_list_config(uint8_t channel, uint8_t id_list_size, uint8_t inc_exc_flag)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_id_list_config_req_enc(channel,
+ id_list_size,
+ inc_exc_flag,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ id_list_config_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_channel_status_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t channel_status_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_channel_status_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_channel_status_get(uint8_t channel, uint8_t * p_status)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_status;
+
+ const uint32_t err_code = ant_channel_status_get_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ channel_status_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_cw_test_mode_init ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t cw_test_mode_init_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_cw_test_mode_init_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_cw_test_mode_init()
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_cw_test_mode_init_req_enc(&(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ cw_test_mode_init_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_cw_test_mode ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t cw_test_mode_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_cw_test_mode_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_cw_test_mode(uint8_t radio_freq, uint8_t tx_power, uint8_t custom_tx_power, uint8_t mode)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_cw_test_mode_req_enc(radio_freq,
+ tx_power,
+ custom_tx_power,
+ mode,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ cw_test_mode_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_version_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t version_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_version_get_rsp_dec(p_buffer,
+ length,
+ &mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_version_get(uint8_t * p_version)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_version;
+
+ const uint32_t err_code = ant_version_get_req_enc(&(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ version_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_capabilities_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t capabilities_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_capabilities_get_rsp_dec(p_buffer,
+ length,
+ &mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_capabilities_get(uint8_t * p_capabilities)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_capabilities;
+
+ const uint32_t err_code = ant_capabilities_get_req_enc(&(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ capabilities_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_crypto_channel_enable ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t crypto_channel_enable_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_crypto_channel_enable_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_crypto_channel_enable(uint8_t channel, uint8_t enable, uint8_t key_num, uint8_t decimation_rate)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_crypto_channel_enable_req_enc(channel,
+ enable,
+ key_num,
+ decimation_rate,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ crypto_channel_enable_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_adv_burst_config_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t adv_burst_config_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_adv_burst_config_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_adv_burst_config_set(uint8_t * p_config, uint8_t size)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_adv_burst_config_set_req_enc(p_config,
+ size,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ adv_burst_config_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_crypto_key_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t crypto_key_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_crypto_key_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_crypto_key_set(uint8_t key_num, uint8_t * p_key)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_crypto_key_set_req_enc(key_num,
+ p_key,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ crypto_key_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_crypto_info_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t crypto_info_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_crypto_info_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_crypto_info_set(uint8_t type, uint8_t * p_info)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_crypto_info_set_req_enc(type,
+ p_info,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ crypto_info_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_crypto_info_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t crypto_info_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_crypto_info_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_crypto_info_get(uint8_t type, uint8_t * p_info)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_info;
+
+ const uint32_t err_code = ant_crypto_info_get_req_enc(type,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ crypto_info_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_coex_config_set ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t coex_config_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_coex_config_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_coex_config_set(uint8_t channel, ANT_BUFFER_PTR * p_coex_config, ANT_BUFFER_PTR * p_adv_coex_config)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ant_coex_config_set_req_enc(channel,
+ p_coex_config,
+ p_adv_coex_config,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ coex_config_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ant_coex_config_get ANT command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t coex_config_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ant_coex_config_get_rsp_dec(p_buffer,
+ length,
+ mp_out_params[0],
+ mp_out_params[1],
+ &result_code);
+
+ //@note: Should never fail
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ant_coex_config_get(uint8_t channel, ANT_BUFFER_PTR * p_coex_config, ANT_BUFFER_PTR * p_adv_coex_config)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_coex_config;
+ mp_out_params[1] = p_adv_coex_config;
+
+ const uint32_t err_code = ant_coex_config_get_req_enc(channel,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ coex_config_get_rsp_dec);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_acknowledge_message_tx.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_acknowledge_message_tx.c
new file mode 100644
index 0000000..ee4e763
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_acknowledge_message_tx.c
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_acknowledge_message_tx_req_enc(uint8_t channel,
+ uint8_t size,
+ uint8_t const * const p_mesg,
+ 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 svc_number = SVC_ANT_TX_ACKNOWLEDGED_MESSAGE;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&channel, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_enc(p_mesg, size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_acknowledge_message_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_TX_ACKNOWLEDGED_MESSAGE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_get.c
new file mode 100644
index 0000000..f0312f3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_get.c
@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_active_search_sharing_cycles_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_active_search_sharing_cycles_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_cycles,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, p_cycles);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_set.c
new file mode 100644
index 0000000..a0e27d8
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_active_search_sharing_cycles_set.c
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_active_search_sharing_cycles_set_req_enc(uint8_t channel,
+ uint8_t cycles,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = cycles;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_active_search_sharing_cycles_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_adv_burst_config_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_adv_burst_config_set.c
new file mode 100644
index 0000000..74020ee
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_adv_burst_config_set.c
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_adv_burst_config_set_req_enc(uint8_t const * const p_config,
+ uint8_t size,
+ 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 svc_number = SVC_ANT_ADV_BURST_CONFIG_SET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_enc(p_config, size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_adv_burst_config_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_ADV_BURST_CONFIG_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_app.h
new file mode 100644
index 0000000..c3c7fd2
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_app.h
@@ -0,0 +1,1652 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef ANT_APP_H__
+#define ANT_APP_H__
+
+/**
+ * @addtogroup ser_app_s212_codecs Application codecs for S212
+ * @ingroup ser_codecs_app
+ */
+
+/**@file
+ *
+ * @defgroup ant_app Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s212_codecs
+ *
+ * @brief Application command request encoders and command response decoders.
+ */
+//#include "ble.h"
+#include "ant_interface.h"
+
+/**@brief Encodes @ref sd_ant_enable command request.
+ *
+ * @sa @ref ant_enable_rsp_dec for command response decoder.
+ *
+ * @param[in] p_ant_enable_params Pointer to an @ref ANT_ENABLE structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be
+ * returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_enable_req_enc(ANT_ENABLE * p_ant_enable_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_enable command.
+ *
+ * @sa @ref ant_enable_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_enable_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_assign command request.
+ *
+ * @sa @ref ant_channel_assign_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * to assign.
+ * @param[in] channel_type Channel Type is an unsigned char (1 octet) denoting the
+ * channel type. See Assign Channel Parameters/Assign Channel
+ * Types in ant_parameters.h.
+ * @param[in] network Network is an unsigned char (1 octet) denoting the network
+ * key to associate with the channel.
+ * @param[in] ext_assign Ext Assign is a bit field (1 octet) for an extended
+ * assign. See Ext. Assign Channel Parameters in
+ * ant_parameters.h.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be
+ * returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_assign_req_enc(uint8_t channel,
+ uint8_t channel_type,
+ uint8_t network,
+ uint8_t ext_assign,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_assign command.
+ *
+ * @sa @ref ant_channel_assign_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_assign_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_open command request.
+ *
+ * @sa @ref ant_channel_open_with_offset_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
+ * open.
+ * @param[in] usOffset Denote the offset from which to start the channel.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_open_with_offset_req_enc(uint8_t channel,
+ uint16_t usOffset,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_open command.
+ *
+ * @sa @ref ant_channel_open_with_offset_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_open_with_offset_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_id_set command request.
+ *
+ * @sa @ref ant_channel_id_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to set.
+ * @param[in] device_number Device Number is an unsigned short (2 octets) denoting the
+ * device number.
+ * @param[in] device_type Device Type is an unsigned char (1 octet) denoting the device
+ * type.
+ * @param[in] transmit_type Transmit Type is an unsigned char (1 octet) denoting the
+ * transmission type.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_id_set_req_enc(uint8_t channel,
+ uint16_t device_number,
+ uint8_t device_type,
+ uint8_t transmit_type,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_id_set command.
+ *
+ * @sa @ref ant_channel_id_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_id_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_period_set command request.
+ *
+ * @sa @ref ant_channel_period_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to set the period to.
+ * @param[in] period Period is an unsigned short (2 octets) denoting the period in
+ * 32 kHz counts (usPeriod/32768 s).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_period_set_req_enc(uint8_t channel,
+ uint16_t period,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_period_set command.
+ *
+ * @sa @ref ant_channel_period_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_period_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_radio_freq_set command request.
+ *
+ * @sa @ref ant_channel_radio_freq_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to set to.
+ * @param[in] freq Freq is an unsigned char (1 octet) denoting the radio
+ * frequency offset from 2400 MHz (eg. 2466 MHz, ucFreq = 66).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_radio_freq_set_req_enc(uint8_t channel,
+ uint8_t freq,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_radio_freq_set command.
+ *
+ * @sa @ref ant_channel_radio_freq_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_radio_freq_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_broadcast_message_tx command request.
+ *
+ * @sa @ref ant_broadcast_message_tx_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
+ * send the data on.
+ * @param[in] size Size is an unsigned char (1 octet) denoting the size of the
+ * message, ucSize must be 8.
+ * @param[in] p_mesg Mesg is the buffer where the message is located (array must be
+ * 8 octets).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_broadcast_message_tx_req_enc(uint8_t channel,
+ uint8_t size,
+ uint8_t const * const p_mesg,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_broadcast_message_tx command.
+ *
+ * @sa @ref ant_broadcast_message_tx_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_broadcast_message_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes @ref sd_ant_acknowledge_message_tx command request.
+ *
+ * @sa @ref ant_acknowledge_message_tx_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
+ * send the data on.
+ * @param[in] size Size is an unsigned char (1 octet) denoting the size of the
+ * message, ucSize must be 8.
+ * @param[in] p_mesg Mesg is the buffer where the message is located (array must be
+ * 8 octets).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_acknowledge_message_tx_req_enc(uint8_t channel,
+ uint8_t size,
+ uint8_t const * const p_mesg,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_acknowledge_message_tx command.
+ *
+ * @sa @ref ant_acknowledge_message_tx_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_acknowledge_message_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_unassign command request.
+ *
+ * @sa @ref ant_channel_unassign_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * to unassign.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be
+ * returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_unassign_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_unassign command.
+ *
+ * @sa @ref ant_channel_unassign_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_unassign_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_close command request.
+ *
+ * @sa @ref ant_channel_close_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * to close.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_close_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_close command.
+ *
+ * @sa @ref ant_channel_close_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_close_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_network_address_set command request.
+ *
+ * @sa @ref ant_network_address_set_rsp_dec for command response decoder.
+ *
+ * @param[in] network Network is an unsigned char (1 octet) denoting the network
+ * number to assign the network address to.
+ * @param[in] p_network_key Network key is the pointer to location of the Network Key (8
+ * octets in length).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_network_address_set_req_enc(uint8_t network,
+ uint8_t const * const p_network_key,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_network_address_set command.
+ *
+ * @sa @ref ant_network_address_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_network_address_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_radio_tx_power_set command request.
+ *
+ * @sa @ref ant_channel_radio_tx_power_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to assign the radio TX power.
+ * @param[in] tx_power TX Power is an unsigned char (1 octet) denoting the ANT
+ * transmit power index. See Radio TX Power Definitions in
+ * ant_parameters.h.
+ * @param[in] custom_tx_power Custom TX Power is an unsigned char (1 octet) denoting the
+ * custom nRF transmit power as defined in nrf51_bitfields.h.
+ * Only applicable if tx_power is set to custom TX power
+ * selection.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_radio_tx_power_set_req_enc(uint8_t channel,
+ uint8_t tx_power,
+ uint8_t custom_tx_power,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_radio_tx_power_set command.
+ *
+ * @sa @ref ant_channel_radio_tx_power_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_radio_tx_power_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_rx_search_timeout_set command request.
+ *
+ * @sa @ref ant_channel_rx_search_timeout_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to set.
+ * @param[in] timeout Timeout is an unsigned char (1 octet) denoting the time-out
+ * value.
+ * When applied to an assigned slave channel, ucTimeout is in 2.5
+ * second increments. Default = 10 (25 s) at channel assignment.
+ * When applied to an assigned master channel, ucTimeout is in
+ * 250 ms increments. Default = 0 (disabled) at channel assignment
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_rx_search_timeout_set_req_enc(uint8_t channel,
+ uint8_t timeout,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_rx_search_timeout_set command.
+ *
+ * @sa @ref ant_channel_rx_search_timeout_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_rx_search_timeout_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_low_priority_rx_search_timeout_set command request.
+ *
+ * @sa @ref ant_channel_low_priority_rx_search_timeout_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to set.
+ * @param[in] timeout Timeout is an unsigned char (1 octet) denoting the time-out
+ * value in 2.5 seconds increments. Default = 2 (5s).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_low_priority_rx_search_timeout_set_req_enc(uint8_t channel,
+ uint8_t timeout,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_low_priority_rx_search_timeout_set command.
+ *
+ * @sa @ref ant_channel_low_priority_rx_search_timeout_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_low_priority_rx_search_timeout_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_prox_search_set command request.
+ *
+ * @sa @ref ant_prox_search_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] prox_threshold Prox threshold is an unsigned char (1 octet) denoting the
+ * minimum RSSI threshold required for acquisition during a
+ * search. See Radio Proximity Search Threshold in
+ * ant_parameters.h.
+ * @param[in] custom_prox_threshold Custom prox threshold is an unsigned char (1 octet) denoting
+ * the custom minimum RSSI threshold for acquisition during a
+ * search. Only applicable if ucProxThreshold is set to custom
+ * proximity selection.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_prox_search_set_req_enc(uint8_t channel,
+ uint8_t prox_threshold,
+ uint8_t custom_prox_threshold,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_prox_search_set command.
+ *
+ * @sa @ref ant_prox_search_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_prox_search_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_search_waveform_set command request.
+ *
+ * @sa @ref ant_search_waveform_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] waveform Waveform is an unsigned short (2 octets) denoting the channel
+ * waveform period (usWaveform/32768 s). Default = 316.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_search_waveform_set_req_enc(uint8_t channel,
+ uint16_t waveform,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_search_waveform_set command.
+ *
+ * @sa @ref ant_search_waveform_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_search_waveform_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_id_get command request.
+ *
+ * @sa @ref ant_channel_id_get_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_id_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_id_get command.
+ *
+ * @sa @ref ant_channel_id_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_device_number Pointer to device number.
+ * @param[in] p_device_type Pointer to device type.
+ * @param[in] p_transmit_type Pointer to transmit type.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_id_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_device_number,
+ void * const p_device_type,
+ void * const p_transmit_type,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_radio_freq_get command request.
+ *
+ * @sa @ref ant_channel_radio_freq_get_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_radio_freq_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_radio_freq_get command.
+ *
+ * @sa @ref ant_channel_radio_freq_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_r_freq Pointer to radio frequency.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_radio_freq_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_r_freq,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_period_get command request.
+ *
+ * @sa @ref ant_channel_period_get_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_period_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_period_get command.
+ *
+ * @sa @ref ant_channel_period_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_period Pointer to period
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_period_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * p_period,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_search_channel_priority_set command request.
+ *
+ * @sa @ref ant_search_channel_priority_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] search_priority Search Priority is an unsigned char (1 octet) denoting the
+ * search priority value. 0 to 7 (Default = 0).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_search_channel_priority_set_req_enc(uint8_t channel,
+ uint8_t search_priority,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_search_channel_priority_set command.
+ *
+ * @sa @ref ant_search_channel_priority_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_search_channel_priority_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes @ref sd_ant_active_search_sharing_cycles_set command request.
+ *
+ * @sa @ref ant_active_search_sharing_cycles_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] cycles Cycles is an unsigned char (1 octet) denoting the number of
+ * cycles to set.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_active_search_sharing_cycles_set_req_enc(uint8_t channel,
+ uint8_t cycles,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_active_search_sharing_cycles_set command.
+ *
+ * @sa @ref ant_active_search_sharing_cycles_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_active_search_sharing_cycles_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_lib_config_set command request.
+ *
+ * @sa @ref ant_lib_config_set_rsp_dec for command response decoder.
+ *
+ * @param[in] ant_lib_config ANT Lib Config an unsigned char (1 octet) denoting the ANT lib
+ * config bit flags. See ANT Library Config in ant_parameters.h.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_lib_config_set_req_enc(uint8_t ant_lib_config,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_lib_config_set command.
+ *
+ * @sa @ref ant_lib_config_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_lib_config_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_active_search_sharing_cycles_get command request.
+ *
+ * @sa @ref ant_active_search_sharing_cycles_get_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_active_search_sharing_cycles_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_active_search_sharing_cycles_get command.
+ *
+ * @sa @ref ant_active_search_sharing_cycles_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_cycles Pointer to cycles.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_active_search_sharing_cycles_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_cycles,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_lib_config_get command request.
+ *
+ * @sa @ref ant_lib_config_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_lib_config_get_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_lib_config_get command.
+ *
+ * @sa @ref ant_lib_config_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_ant_lib_config Pointer to the ANT library configuration.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_lib_config_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_ant_lib_config,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_lib_config_clear command request.
+ *
+ * @sa @ref ant_lib_config_clear_rsp_dec for command response decoder.
+ *
+ * @param[in] ant_lib_config ANT lib config is an unsigned char (1 octet) denoting the
+ * ANT lib config bit(s) to clear. See ANT Library Config in
+ * ant_parameters.h.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_lib_config_clear_req_enc(uint8_t ant_lib_config,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_lib_config_clear command.
+ *
+ * @sa @ref ant_lib_config_clear_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_lib_config_clear_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_stack_reset command request.
+ *
+ * @sa @ref ant_stack_reset_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_stack_reset_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_stack_reset command.
+ *
+ * @sa @ref ant_stack_reset_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_stack_reset_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_rx_scan_mode_start command request.
+ *
+ * @sa @ref ant_rx_scan_mode_start_rsp_dec for command response decoder.
+ *
+ * @param[in] sync_channel_packets_only Sync channel packets only is an unsigned char (1 octet)
+ * denoting synchronous channel only scanning mode.
+ * 0 = disable, 1 = enable.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be
+ * returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_rx_scan_mode_start_req_enc(uint8_t sync_channel_packets_only,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_rx_scan_mode_start command.
+ *
+ * @sa @ref ant_rx_scan_mode_start_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_rx_scan_mode_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_id_list_add command request.
+ *
+ * @sa @ref ant_id_list_add_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number to add the list entry to.
+ * @param[in] p_dev_id Dev ID is the pointer to the buffer (4 octets) containing
+ * device ID information with the following format:
+ * Byte0 = DeviceNumber_LSB
+ * Byte1 = DeviceNumber_MSB
+ * Byte2 = DeviceType
+ * Byte3 = TransType
+ * @param[in] list_index List index is an unsigned char (1 octet) denoting the index
+ * where the specified channel ID is to be placed in the list (0-3).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_id_list_add_req_enc(uint8_t channel,
+ uint8_t const * const p_dev_id,
+ uint8_t list_index,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_id_list_add command.
+ *
+ * @sa @ref ant_id_list_add_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_id_list_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_id_list_config command request.
+ *
+ * @sa @ref ant_id_list_config_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the
+ * channel number of the device ID list.
+ * @param[in] id_list_size ID list size is an unsigned char (1 octet) denoting the size of
+ * the inclusion or exclusion list (0-4).
+ * @param[in] inc_exc_flag Inc exc flag is an unsigned char (1 octet) denoting the type of
+ * list as Include(0) or Exclude(1).
+ * @param[in] channel
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_id_list_config_req_enc(uint8_t channel,
+ uint8_t id_list_size,
+ uint8_t inc_exc_flag,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_id_list_config command.
+ *
+ * @sa @ref ant_id_list_config_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_id_list_config_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_channel_status_get command request.
+ *
+ * @sa @ref ant_channel_status_get_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
+ * number.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_channel_status_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_channel_status_get command.
+ *
+ * @sa @ref ant_channel_status_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_status Pointer to status
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_channel_status_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_status,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_cw_test_mode_init command request.
+ *
+ * @sa @ref ant_cw_test_mode_init_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_cw_test_mode_init_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_cw_test_mode_init command.
+ *
+ * @sa @ref ant_cw_test_mode_init_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_cw_test_mode_init_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_cw_test_mode command request.
+ *
+ * @sa @ref ant_cw_test_mode_rsp_dec for command response decoder.
+ *
+ * @param[in] radio_freq Radio freq is an unsigned char (1 octet) denoting the radio
+ * frequency offset from 2400 MHz for continuous wave mode.
+ * (eg. 2466 MHz, ucRadioFreq = 66).
+ * @param[in] tx_power TX Power is an unsigned char (1 octet) denoting the ANT transmit
+ * power index for continuous wave mode. See Radio TX Power
+ * Definitions in ant_parameters.h
+ * @param[in] custom_tx_power Custom TX power is an unsigned char (1 octet) denoting the
+ * custom nRF transmit power as defined in nrf51_bitfields.h. Only
+ * applicable if ucTxPower is set to custom TX power selection.
+ * @param[in] mode Mode is an unsigned char (1 octet) denoting test mode type where
+ * 0 = cw tx carrier transmission, 1 = cw tx modulated transmission.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_cw_test_mode_req_enc(uint8_t radio_freq,
+ uint8_t tx_power,
+ uint8_t custom_tx_power,
+ uint8_t mode,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_cw_test_mode command.
+ *
+ * @sa @ref ant_cw_test_mode_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_cw_test_mode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_version_get command request.
+ *
+ * @sa @ref ant_version_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_version_get_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_version_get command.
+ *
+ * @sa @ref ant_version_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_version Pointer to version string buffer.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_version_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * * const p_version,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_capabilities_get command request.
+ *
+ * @sa @ref ant_capabilities_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_capabilities_get_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_capabilities_get command.
+ *
+ * @sa @ref ant_capabilities_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] pp_capabilities Pointer to pointer to capabilities buffer.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_capabilities_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * * const pp_capabilities,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_crypto_channel_enable command request.
+ *
+ * @sa @ref ant_crypto_channel_enable_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel in
+ * which encryption mode is set.
+ * @param[in] enable Enable is an unsigned char (1 octet) denoting the encryption
+ * mode. See Encrypted Channel Defines in ant_parameters.h.
+ * @param[in] key_num Key num is an unsigned char (1 octet) denoting the key index of
+ * the 128-bit key to be used for encryption. The key index range
+ * is bound by the number of encrypted channels configured by
+ * sd_ant_enable(). If sd_ant_enable() is not used then by default
+ * key num is 0. Range is [0 to (num encrypted channels - 1)], if
+ * 1 or more encrypted channels are configured.
+ * @param[in] decimation_rate Decimation rate is an unsigned char (1 octet) denoting the
+ * decimate rate to apply for encrypted slave channel. Must be > 0.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_crypto_channel_enable_req_enc(uint8_t channel,
+ uint8_t enable,
+ uint8_t key_num,
+ uint8_t decimation_rate,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_crypto_channel_enable command.
+ *
+ * @sa @ref ant_crypto_channel_enable_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_crypto_channel_enable_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_adv_burst_config_set command request.
+ *
+ * @sa @ref ant_adv_burst_config_set_rsp_dec for command response decoder.
+ *
+ * @param[in] p_config Config is a buffer containing the advanced burst
+ * configuration to be set.
+ * @param[in] size Size is an unsigned char (1 octet) denoting the size of the
+ * configuration parameter buffer.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_adv_burst_config_set_req_enc(uint8_t const * const p_config,
+ uint8_t size,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_adv_burst_config_set command.
+ *
+ * @sa @ref ant_adv_burst_config_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_adv_burst_config_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_crypto_key_set command request.
+ *
+ * @sa @ref ant_crypto_key_set_rsp_dec for command response decoder.
+ *
+ * @param[in] key_num Key num is an unsigned char (1 octet) denoting the key index for
+ * assignment.
+ * @param[in] p_key Buffer (16 octets) containing the 128-bit AES key to be
+ * assigned to the key index.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_crypto_key_set_req_enc(uint8_t key_num,
+ uint8_t const * const p_key,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_crypto_key_set command.
+ *
+ * @sa @ref ant_crypto_key_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_crypto_key_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_crypto_info_set command request.
+ *
+ * @sa @ref ant_crypto_info_set_rsp_dec for command response decoder.
+ *
+ * @param[in] type Type is an unsigned char (1 octet) denoting the type of
+ * information being set.
+ * @param[in] p_info Pointer to a buffer buffer containing the information being set.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_crypto_info_set_req_enc(uint8_t type,
+ uint8_t const * const p_info,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_crypto_info_set command.
+ *
+ * @sa @ref ant_crypto_info_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_crypto_info_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_crypto_info_get command request.
+ *
+ * @sa @ref ant_crypto_info_get_rsp_dec for command response decoder.
+ *
+ * @param[in] type Type is an unsigned char (1 octet) denoting the type of
+ * information being set.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_crypto_info_get_req_enc(uint8_t type,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_crypto_info_get command.
+ *
+ * @sa @ref ant_crypto_info_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_info Pointer to the info buffer.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_crypto_info_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_info,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_coex_config_set command request.
+ *
+ * @sa @ref ant_coex_config_set_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel for
+ * which the coexistence configuration is to be set
+ * @param[in] p_config Pointer to a buffer containing the configuration to be set.
+ * @param[in] p_adv_coex_config Pointer to a buffer containing the advanced coexistence configuration
+ * to be set.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_coex_config_set_req_enc(uint8_t channel,
+ ANT_BUFFER_PTR const * const p_config,
+ ANT_BUFFER_PTR const * const p_adv_coex_config,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_coex_config_set command.
+ *
+ * @sa @ref ant_coex_config_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_coex_config_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ant_coex_config_get command request.
+ *
+ * @sa @ref ant_coex_config_get_rsp_dec for command response decoder.
+ *
+ * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
+ * query.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ant_coex_config_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ant_coex_config_get command.
+ *
+ * @sa @ref ant_coex_config_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_coex_config Pointer to the coexistence configuration buffer.
+ * @param[in] p_adv_coex_config Pointer to the advanced coexistence configuration buffer.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 ant_coex_config_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_coex_config,
+ void * const p_adv_coex_config,
+ uint32_t * const p_result_code);
+/** @} */
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_broadcast_message_tx.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_broadcast_message_tx.c
new file mode 100644
index 0000000..86548e0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_broadcast_message_tx.c
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_broadcast_message_tx_req_enc(uint8_t channel,
+ uint8_t size,
+ uint8_t const * const p_mesg,
+ 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 svc_number = SVC_ANT_TX_BROADCAST_MESSAGE;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&channel, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_enc(p_mesg, size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_broadcast_message_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_TX_BROADCAST_MESSAGE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_capabilities_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_capabilities_get.c
new file mode 100644
index 0000000..9d47722
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_capabilities_get.c
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_capabilities_get_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CAPABILITIES;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_capabilities_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * * const pp_capabilities,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_CAPABILITIES, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint8_vector_dec(p_buf, packet_len, &index, (uint8_t *)*pp_capabilities, MESG_CAPABILITIES_SIZE);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_assign.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_assign.c
new file mode 100644
index 0000000..ca4a44a
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_assign.c
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_assign_req_enc(uint8_t channel,
+ uint8_t channel_type,
+ uint8_t network,
+ uint8_t ext_assign,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_ASSIGN;
+ p_buf[index++] = channel;
+ p_buf[index++] = channel_type;
+ p_buf[index++] = network;
+ p_buf[index++] = ext_assign;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_channel_assign_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_ASSIGN, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_close.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_close.c
new file mode 100644
index 0000000..bd3995d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_close.c
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_close_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_CLOSE;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_close_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_CLOSE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_get.c
new file mode 100644
index 0000000..a4b11cd
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_get.c
@@ -0,0 +1,103 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_id_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_ID_GET;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_id_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_device_number,
+ void * const p_device_type,
+ void * const p_transmit_type,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_CHANNEL_ID_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint16_t_dec(p_buf, packet_len, &index, p_device_number);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, p_device_type);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, p_transmit_type);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_set.c
new file mode 100644
index 0000000..09563b3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_id_set.c
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_id_set_req_enc(uint8_t channel,
+ uint16_t device_number,
+ uint8_t device_type,
+ uint8_t transmit_type,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_ID_SET;
+ p_buf[index++] = channel;
+ index += uint16_encode(device_number, &p_buf[index]);
+ p_buf[index++] = device_type;
+ p_buf[index++] = transmit_type;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_channel_id_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_ID_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_low_priority_rx_search_timeout_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_low_priority_rx_search_timeout_set.c
new file mode 100644
index 0000000..135f470
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_low_priority_rx_search_timeout_set.c
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_low_priority_rx_search_timeout_set_req_enc(uint8_t channel,
+ uint8_t timeout,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = timeout;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_channel_low_priority_rx_search_timeout_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_open_with_offset.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_open_with_offset.c
new file mode 100644
index 0000000..c4e30ef
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_open_with_offset.c
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_open_with_offset_req_enc(uint8_t channel,
+ uint16_t usOffset,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_OPEN;
+ p_buf[index++] = channel;
+ index += uint16_encode(usOffset, &p_buf[index]);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_channel_open_with_offset_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_OPEN, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_get.c
new file mode 100644
index 0000000..09576fe
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_get.c
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_period_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_PERIOD_GET;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_period_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * p_period,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_CHANNEL_PERIOD_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint16_t_dec(p_buf, packet_len, &index, p_period);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_set.c
new file mode 100644
index 0000000..292f8f9
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_period_set.c
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_period_set_req_enc(uint8_t channel,
+ uint16_t period,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_PERIOD_SET;
+ p_buf[index++] = channel;
+ index += uint16_encode(period, &p_buf[index]);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_period_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_PERIOD_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_get.c
new file mode 100644
index 0000000..6651862
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_get.c
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_radio_freq_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_RADIO_FREQ_GET;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_radio_freq_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_r_freq,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_CHANNEL_RADIO_FREQ_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, p_r_freq);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_set.c
new file mode 100644
index 0000000..5638e97
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_freq_set.c
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_radio_freq_set_req_enc(uint8_t channel,
+ uint8_t freq,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_RADIO_FREQ_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = freq;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_radio_freq_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_RADIO_FREQ_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_tx_power_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_tx_power_set.c
new file mode 100644
index 0000000..c7ea273
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_radio_tx_power_set.c
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_radio_tx_power_set_req_enc(uint8_t channel,
+ uint8_t tx_power,
+ uint8_t custom_tx_power,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_RADIO_TX_POWER_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = tx_power;
+ p_buf[index++] = custom_tx_power;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_channel_radio_tx_power_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_RADIO_TX_POWER_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_rx_search_timeout_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_rx_search_timeout_set.c
new file mode 100644
index 0000000..1ac542d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_rx_search_timeout_set.c
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_rx_search_timeout_set_req_enc(uint8_t channel,
+ uint8_t timeout,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_SEARCH_TIMEOUT_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = timeout;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_channel_rx_search_timeout_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_SEARCH_TIMEOUT_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_status_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_status_get.c
new file mode 100644
index 0000000..2ed53eb
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_status_get.c
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_status_get_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_STATUS_GET;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_status_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_status,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_CHANNEL_STATUS_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, p_status);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_unassign.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_unassign.c
new file mode 100644
index 0000000..1c82fe9
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_channel_unassign.c
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_channel_unassign_req_enc(uint8_t channel,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CHANNEL_UNASSIGN;
+ p_buf[index++] = channel;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_channel_unassign_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CHANNEL_UNASSIGN, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_get.c
new file mode 100644
index 0000000..a38f497
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_get.c
@@ -0,0 +1,130 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+#include "ant_interface.h"
+
+uint32_t ant_coex_config_get_req_enc(uint8_t channel,
+ 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 svc_number = SVC_ANT_COEX_CONFIG_GET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&channel, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_coex_config_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_coex_config,
+ void * const p_adv_coex_config,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_COEX_CONFIG_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ uint8_t coex_config_size;
+ uint8_t coex_config_buffer[(MESG_BUFFER_SIZE / 2) - 1];
+
+ uint8_t adv_coex_config_size;
+ uint8_t adv_coex_config_buffer[(MESG_BUFFER_SIZE / 2) - 1];
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, &coex_config_size);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_dec(p_buf, packet_len, &index, coex_config_buffer, coex_config_size);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, &(adv_coex_config_size));
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_dec(p_buf, packet_len, &index, adv_coex_config_buffer, adv_coex_config_size);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+
+ if (p_coex_config)
+ {
+ ((ANT_BUFFER_PTR *)p_coex_config)->ucBufferSize = coex_config_size;
+ memcpy(((ANT_BUFFER_PTR *)p_coex_config)->pucBuffer, coex_config_buffer,((ANT_BUFFER_PTR *)p_coex_config)->ucBufferSize);
+ }
+
+ if (p_adv_coex_config)
+ {
+ ((ANT_BUFFER_PTR *)p_adv_coex_config)->ucBufferSize = coex_config_size;
+ memcpy(((ANT_BUFFER_PTR *)p_adv_coex_config)->pucBuffer, coex_config_buffer,((ANT_BUFFER_PTR *)p_adv_coex_config)->ucBufferSize);
+ }
+
+ SER_ASSERT_LENGTH_LEQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_set.c
new file mode 100644
index 0000000..4465abc
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_coex_config_set.c
@@ -0,0 +1,109 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_coex_config_set_req_enc(uint8_t channel,
+ ANT_BUFFER_PTR const * const p_coex_config,
+ ANT_BUFFER_PTR const * const p_adv_coex_config,
+ 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 svc_number = SVC_ANT_COEX_CONFIG_SET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&channel, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ // Encode coex config buffer size
+ uint8_t coex_config_buffer_size = p_coex_config -> ucBufferSize;
+ err_code = uint8_t_enc(&coex_config_buffer_size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ // Encode coex config buffer
+ err_code = uint8_vector_enc(p_coex_config -> pucBuffer,
+ coex_config_buffer_size,
+ p_buf,
+ buf_len,
+ &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ // Encode advanced coex config buffer size
+ uint8_t adv_coex_config_buffer_size = p_adv_coex_config -> ucBufferSize;
+ err_code = uint8_t_enc(&adv_coex_config_buffer_size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ // Encode advanced coex config buffer
+ err_code = uint8_vector_enc(p_adv_coex_config -> pucBuffer,
+ adv_coex_config_buffer_size,
+ p_buf,
+ buf_len,
+ &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_coex_config_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_COEX_CONFIG_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_channel_enable.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_channel_enable.c
new file mode 100644
index 0000000..9071c89
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_channel_enable.c
@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_crypto_channel_enable_req_enc(uint8_t channel,
+ uint8_t enable,
+ uint8_t key_num,
+ uint8_t decimation_rate,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CRYPTO_CHANNEL_ENABLE;
+ p_buf[index++] = channel;
+ p_buf[index++] = enable;
+ p_buf[index++] = key_num;
+ p_buf[index++] = decimation_rate;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_crypto_channel_enable_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CRYPTO_CHANNEL_ENABLE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_get.c
new file mode 100644
index 0000000..6a2b5a4
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_get.c
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_crypto_info_get_req_enc(uint8_t type,
+ 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 svc_number = SVC_ANT_CRYPTO_INFO_GET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&type, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_crypto_info_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_info,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_CRYPTO_INFO_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ uint8_t type;
+ uint8_t crypto_info_size;
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, &type);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ switch (type)
+ {
+ case ENCRYPTION_INFO_GET_SUPPORTED_MODE:
+ crypto_info_size = MESG_CONFIG_ENCRYPT_REQ_CAPABILITIES_SIZE - MESG_CHANNEL_NUM_SIZE;
+ break;
+ case ENCRYPTION_INFO_GET_CRYPTO_ID:
+ crypto_info_size = MESG_CONFIG_ENCRYPT_REQ_CONFIG_ID_SIZE - MESG_CHANNEL_NUM_SIZE;
+ break;
+ case ENCRYPTION_INFO_GET_CUSTOM_USER_DATA:
+ crypto_info_size = (MESG_CONFIG_ENCRYPT_REQ_CONFIG_USER_DATA_SIZE -
+ MESG_CHANNEL_NUM_SIZE);
+ break;
+ default:
+ crypto_info_size = 0;
+ break;
+ }
+
+ err_code = uint8_vector_dec(p_buf, packet_len, &index, (uint8_t *)p_info, crypto_info_size);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_set.c
new file mode 100644
index 0000000..b56987a
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_info_set.c
@@ -0,0 +1,90 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_crypto_info_set_req_enc(uint8_t type,
+ uint8_t const * const p_config,
+ 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 svc_number = SVC_ANT_CRYPTO_INFO_SET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&type, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ uint8_t crypto_info_size = (MESG_CONFIG_ENCRYPT_REQ_CONFIG_USER_DATA_SIZE -
+ MESG_CHANNEL_NUM_SIZE) +
+ (MESG_CONFIG_ENCRYPT_REQ_CONFIG_ID_SIZE -
+ MESG_CHANNEL_NUM_SIZE);
+
+ err_code = uint8_vector_enc(p_config, crypto_info_size, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_crypto_info_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CRYPTO_INFO_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_key_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_key_set.c
new file mode 100644
index 0000000..4c1b05c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_crypto_key_set.c
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_crypto_key_set_req_enc(uint8_t key_num,
+ uint8_t const * const p_key,
+ 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 svc_number = SVC_ANT_CRYPTO_KEY_SET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&key_num, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_enc(p_key, SIZE_OF_ENCRYPTED_KEY, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_crypto_key_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CRYPTO_KEY_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode.c
new file mode 100644
index 0000000..c149907
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode.c
@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_cw_test_mode_req_enc(uint8_t radio_freq,
+ uint8_t tx_power,
+ uint8_t custom_tx_power,
+ uint8_t mode,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_CW_TEST_MODE;
+ p_buf[index++] = radio_freq;
+ p_buf[index++] = tx_power;
+ p_buf[index++] = custom_tx_power;
+ p_buf[index++] = mode;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_cw_test_mode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_CW_TEST_MODE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode_init.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode_init.c
new file mode 100644
index 0000000..706fd3b
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_cw_test_mode_init.c
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_cw_test_mode_init_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_INIT_CW_TEST_MODE;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_cw_test_mode_init_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_INIT_CW_TEST_MODE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_enable.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_enable.c
new file mode 100644
index 0000000..e8b9f20
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_enable.c
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_enable_req_enc(ANT_ENABLE * const p_channel_enable,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_ENABLE;
+
+ err_code = cond_field_enc(p_channel_enable, p_buf, *p_buf_len, &index, ANT_ENABLE_enc);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_enable_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_ENABLE, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.c
new file mode 100644
index 0000000..afad594
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.c
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_app.h"
+//#include "ble_evt_app.h"
+//#include "ble_gap_evt_app.h"
+//#include "ble_gattc_evt_app.h"
+//#include "ble_gatts_evt_app.h"
+//#include "ble_l2cap_evt_app.h"
+#include "ble_serialization.h"
+#include "app_util.h"
+#include "nrf_sdh_ant.h"
+#include "ant_struct_serialization.h"
+#include "ant_parameters.h"
+
+uint32_t ant_event_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ant_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ uint32_t index = SER_ANT_EVT_ID_POS;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_event_len);
+ SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE, packet_len);
+ SER_ASSERT_NOT_NULL(p_event);
+
+ err_code = ant_evt_t_dec(p_buf, packet_len, &index, p_event);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ *p_event_len = index;
+
+ SER_ASSERT_LENGTH_LEQ(p_event->channel, MAX_ANT_CHANNELS);
+
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.h
new file mode 100644
index 0000000..da62571
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_event.h
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+
+#ifndef __ANT_EVENT_H__
+#define __ANT_EVENT_H__
+
+#include "ble_serialization.h"
+#include "app_util.h"
+#include "nrf_sdh_ant.h"
+
+/**
+ * @addtogroup ser_app_s212_codecs
+ * @{
+ */
+
+
+/**@brief Event decoding dispatcher.
+ *
+ * The event decoding dispatcher will route the event packet to the correct decoder, which in turn
+ * decodes the contents of the event and updates the \p p_event struct.
+ *
+ * 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 the event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to the \ref ant_evt_t buffer where the decoded event will be
+ * stored. If NULL, the 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 the 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 the decoded event.
+ * @retval NRF_ERROR_NOT_FOUND Decoding failure. No event decoder is available.
+ */
+uint32_t ant_event_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ant_evt_t * const p_event,
+ uint32_t * const p_event_len);
+/** @} */
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_add.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_add.c
new file mode 100644
index 0000000..ef318e0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_add.c
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+#include "ant_parameters.h"
+
+uint32_t ant_id_list_add_req_enc(uint8_t channel,
+ uint8_t const * const p_dev_id,
+ uint8_t list_index,
+ 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 svc_number = SVC_ANT_ID_LIST_ADD;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&channel, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_enc(p_dev_id, ANT_ID_SIZE, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&list_index, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_id_list_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_ID_LIST_ADD, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_config.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_config.c
new file mode 100644
index 0000000..305dec8
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_id_list_config.c
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_id_list_config_req_enc(uint8_t channel,
+ uint8_t id_list_size,
+ uint8_t inc_exc_flag,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_ID_LIST_CONFIG;
+ p_buf[index++] = channel;
+ p_buf[index++] = id_list_size;
+ p_buf[index++] = inc_exc_flag;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_id_list_config_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_ID_LIST_CONFIG, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_clear.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_clear.c
new file mode 100644
index 0000000..0a703b2
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_clear.c
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_lib_config_clear_req_enc(uint8_t ant_lib_config,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_LIB_CONFIG_CLEAR;
+ p_buf[index++] = ant_lib_config;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_lib_config_clear_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_LIB_CONFIG_CLEAR, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_get.c
new file mode 100644
index 0000000..93f8819
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_get.c
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_lib_config_get_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_LIB_CONFIG_GET;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_lib_config_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * const p_ant_lib_config,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_LIB_CONFIG_GET, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint8_t_dec(p_buf, packet_len, &index, p_ant_lib_config);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_set.c
new file mode 100644
index 0000000..3f00546
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_lib_config_set.c
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_lib_config_set_req_enc(uint8_t ant_lib_config,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_LIB_CONFIG_SET;
+ p_buf[index++] = ant_lib_config;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_lib_config_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_LIB_CONFIG_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_network_address_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_network_address_set.c
new file mode 100644
index 0000000..fade1d4
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_network_address_set.c
@@ -0,0 +1,85 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_network_address_set_req_enc(uint8_t network,
+ uint8_t const * const p_network_key,
+ 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 svc_number = SVC_ANT_NETWORK_KEY_SET;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t index = 0;
+
+ err_code = uint8_t_enc(&svc_number, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&network, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_vector_enc(p_network_key, MESG_NETWORK_KEY_SIZE - MESG_CHANNEL_NUM_SIZE, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_network_address_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_NETWORK_KEY_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_prox_search_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_prox_search_set.c
new file mode 100644
index 0000000..45b5415
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_prox_search_set.c
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_prox_search_set_req_enc(uint8_t channel,
+ uint8_t prox_threshold,
+ uint8_t custom_prox_threshold,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_PROX_SEARCH_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = prox_threshold;
+ p_buf[index++] = custom_prox_threshold;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_prox_search_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_PROX_SEARCH_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_rx_scan_mode_start.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_rx_scan_mode_start.c
new file mode 100644
index 0000000..6cdefe7
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_rx_scan_mode_start.c
@@ -0,0 +1,76 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_rx_scan_mode_start_req_enc(uint8_t sync_scan_channel_packets_only,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_RX_SCAN_MODE_START;
+ p_buf[index++] = sync_scan_channel_packets_only;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_rx_scan_mode_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_RX_SCAN_MODE_START, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_channel_priority_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_channel_priority_set.c
new file mode 100644
index 0000000..0ad7a55
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_channel_priority_set.c
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_search_channel_priority_set_req_enc(uint8_t channel,
+ uint8_t search_priority,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET;
+ p_buf[index++] = channel;
+ p_buf[index++] = search_priority;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_search_channel_priority_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_waveform_set.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_waveform_set.c
new file mode 100644
index 0000000..6204445
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_search_waveform_set.c
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_search_waveform_set_req_enc(uint8_t channel,
+ uint16_t waveform,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_SEARCH_WAVEFORM_SET;
+ p_buf[index++] = channel;
+ index += uint16_encode(waveform, &p_buf[index]);
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ant_search_waveform_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_SEARCH_WAVEFORM_SET, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_stack_reset.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_stack_reset.c
new file mode 100644
index 0000000..15fb65d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_stack_reset.c
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_stack_reset_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_STACK_INIT;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_stack_reset_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ // Use the ble cmd rsp dec function because it is adequte to decode
+ // the command response as it is the same for both ant and ble.
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SVC_ANT_STACK_INIT, p_result_code);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_version_get.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_version_get.c
new file mode 100644
index 0000000..f0159de
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ant/serializers/ant_version_get.c
@@ -0,0 +1,93 @@
+/**
+ * Copyright (c) 2017 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ant_app.h"
+#include "ble_serialization.h"
+#include "ant_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+uint32_t ant_version_get_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SVC_ANT_VERSION;
+
+ SER_ASSERT_LENGTH_LEQ(index, *p_buf_len);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ant_version_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ void * * const p_version,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SVC_ANT_VERSION, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+ }
+
+ err_code = uint8_vector_dec(p_buf, packet_len, &index, (uint8_t *)*p_version, MESG_BUFFER_SIZE);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble.c
new file mode 100644
index 0000000..5aa5571
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble.c
@@ -0,0 +1,621 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.h"
+#include "ble_serialization.h"
+#include <stdint.h>
+#include "ble_app.h"
+#include "ser_sd_transport.h"
+#include "app_error.h"
+#include "app_ble_user_mem.h"
+
+extern ser_ble_user_mem_t m_app_user_mem_table[];
+
+/**@brief Structure containing @ref sd_ble_uuid_encode output parameters. */
+typedef struct
+{
+ uint8_t * p_uuid_le_len; /**< @ref sd_ble_uuid_encode appearance p_uuid_le_len output parameter. */
+ uint8_t * p_uuid_le; /**< @ref sd_ble_uuid_encode appearance p_uuid_le output parameter. */
+} ble_uuid_encode_out_params_t;
+
+/**@brief Structure containing @ref sd_ble_user_mem_reply output parameters. */
+typedef struct
+{
+ uint16_t conn_handle; /**< @ref sd_ble_user_mem_reply conn_handle. */
+ uint8_t context_allocated; /**< @ref sd_ble_user_mem_reply user memory context allocated flag. */
+} ble_user_mem_reply_out_params_t;
+
+/**@brief Union containing BLE command output parameters. */
+typedef union
+{
+ ble_uuid_encode_out_params_t ble_uuid_encode_out_params; /**< @ref sd_ble_uuid_encode output parameters. */
+ ble_user_mem_reply_out_params_t ble_user_mem_reply_out_params; /**< @ref sd_ble_user_mem_reply output parameters. */
+} ble_command_output_params_t;
+
+static ble_command_output_params_t m_output_params; /**< BLE command output parameters. */
+
+static void * mp_out_params[3];
+static uint32_t m_uint32_param;
+
+static void tx_buf_alloc(uint8_t * * p_data, uint32_t * p_len)
+{
+ uint32_t err_code;
+ uint16_t len16;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, &len16);
+ }
+ while (err_code != NRF_SUCCESS);
+
+ *p_data[0] = SER_PKT_TYPE_CMD;
+ *p_len = (uint32_t)len16 - 1;
+}
+
+/**@brief Command response callback function for @ref sd_ble_uuid_encode BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t uuid_encode_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_uuid_encode_rsp_dec(p_buffer,
+ length,
+ m_output_params.ble_uuid_encode_out_params.p_uuid_le_len,
+ m_output_params.ble_uuid_encode_out_params.p_uuid_le,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_uuid_encode
+#define _sd_ble_uuid_encode sd_ble_uuid_encode
+#endif
+uint32_t _sd_ble_uuid_encode(ble_uuid_t const * const p_uuid,
+ uint8_t * const p_uuid_le_len,
+ uint8_t * const p_uuid_le)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ m_output_params.ble_uuid_encode_out_params.p_uuid_le_len = p_uuid_le_len;
+ m_output_params.ble_uuid_encode_out_params.p_uuid_le = p_uuid_le;
+
+ uint32_t err_code = ble_uuid_encode_req_enc(p_uuid,
+ p_uuid_le_len,
+ p_uuid_le,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ uuid_encode_rsp_dec);
+
+}
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**@brief Command response callback function for @ref sd_ble_tx_packet_count_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t tx_packet_count_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_tx_packet_count_get_rsp_dec(p_buffer,
+ length,
+ (uint8_t * *)&mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_tx_packet_count_get
+#define _sd_ble_tx_packet_count_get sd_ble_tx_packet_count_get
+#endif
+uint32_t _sd_ble_tx_packet_count_get(uint16_t conn_handle, uint8_t * p_count)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_count;
+
+ const uint32_t err_code = ble_tx_packet_count_get_req_enc(conn_handle,
+ p_count,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ tx_packet_count_get_rsp_dec);
+
+}
+#endif
+/**@brief Command response callback function for @ref sd_ble_uuid_vs_add BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t uuid_vs_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_uuid_vs_add_rsp_dec(p_buffer,
+ length,
+ (uint8_t * *)&mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_uuid_vs_add
+#define _sd_ble_uuid_vs_add sd_ble_uuid_vs_add
+#endif
+uint32_t _sd_ble_uuid_vs_add(ble_uuid128_t const * const p_vs_uuid, uint8_t * const p_uuid_type)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_uuid_type;
+
+ const uint32_t err_code = ble_uuid_vs_add_req_enc(p_vs_uuid, p_uuid_type,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ uuid_vs_add_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_uuid_decode BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t uuid_decode_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_uuid_decode_rsp_dec(p_buffer,
+ length,
+ (ble_uuid_t * *)&mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_uuid_decode
+#define _sd_ble_uuid_decode sd_ble_uuid_decode
+#endif
+uint32_t _sd_ble_uuid_decode(uint8_t uuid_le_len,
+ uint8_t const * const p_uuid_le,
+ ble_uuid_t * const p_uuid)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_uuid;
+
+ const uint32_t err_code = ble_uuid_decode_req_enc(uuid_le_len, p_uuid_le, p_uuid,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ uuid_decode_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_version_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t version_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_version_get_rsp_dec(p_buffer,
+ length,
+ (ble_version_t *)mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_version_get
+#define _sd_ble_version_get sd_ble_version_get
+#endif
+uint32_t _sd_ble_version_get(ble_version_t * p_version)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_version;
+
+ const uint32_t err_code = ble_version_get_req_enc(p_version,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ version_get_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ble_opt_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t opt_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+ uint32_t uint32_param;
+ uint32_t err_code = ble_opt_get_rsp_dec(p_buffer,
+ length,
+ &uint32_param,
+ (ble_opt_t *)mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+ if ((result_code == NRF_SUCCESS) && (m_uint32_param != uint32_param)) // decoded id should be the same as encoded one
+ {
+ err_code = NRF_ERROR_INVALID_PARAM;
+ }
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_opt_get
+#define _sd_ble_opt_get sd_ble_opt_get
+#endif
+uint32_t _sd_ble_opt_get(uint32_t opt_id, ble_opt_t *p_opt)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_opt;
+ m_uint32_param = opt_id;
+
+ const uint32_t err_code = ble_opt_get_req_enc(opt_id,
+ p_opt,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ opt_get_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ble_opt_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t opt_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_opt_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_opt_set
+#define _sd_ble_opt_set sd_ble_opt_set
+#endif
+uint32_t _sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ble_opt_set_req_enc(opt_id,
+ p_opt,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ opt_set_rsp_dec);
+
+}
+
+/**@brief Command response callback function for @ref sd_ble_enable BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t enable_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_enable_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_enable
+#define _sd_ble_enable sd_ble_enable
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+uint32_t _sd_ble_enable(ble_enable_params_t * p_params, uint32_t * p_app_ram_base)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ //Ignore ram_base parameter
+ (void)p_app_ram_base;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+ mp_out_params[0] = p_params;
+
+ const uint32_t err_code = ble_enable_req_enc(p_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ enable_rsp_dec);
+
+}
+#else
+uint32_t _sd_ble_enable(uint32_t * p_app_ram_base)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ //Ignore ram_base parameter
+ (void)p_app_ram_base;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ble_enable_req_enc(&(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ enable_rsp_dec);
+
+}
+#endif
+/**@brief Command response callback function for @ref sd_ble_user_mem_reply BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t user_mem_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ uint32_t err_code = ble_user_mem_reply_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ APP_ERROR_CHECK(err_code);
+
+ if ((result_code != NRF_SUCCESS) &&
+ (m_output_params.ble_user_mem_reply_out_params.context_allocated))
+ {
+ err_code = app_ble_user_mem_context_destroy(
+ m_output_params.ble_user_mem_reply_out_params.conn_handle);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+
+ return result_code;
+}
+
+#ifndef _sd_ble_user_mem_reply
+#define _sd_ble_user_mem_reply sd_ble_user_mem_reply
+#endif
+uint32_t _sd_ble_user_mem_reply(uint16_t conn_handle, ble_user_mem_block_t const *p_block)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length, user_mem_table_index;
+ uint32_t err_code = NRF_SUCCESS;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ // Prepare User Memory Block context for later synchronization when SoftDevice updates
+ // the data in the memory block
+ if (p_block != NULL)
+ {
+ err_code = app_ble_user_mem_context_create(conn_handle, &user_mem_table_index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ m_app_user_mem_table[user_mem_table_index].mem_block.len = p_block->len;
+ m_app_user_mem_table[user_mem_table_index].mem_block.p_mem = p_block->p_mem;
+ // Save connection handle and context allocation flag for case if context destroy was needed
+ m_output_params.ble_user_mem_reply_out_params.conn_handle = conn_handle;
+ m_output_params.ble_user_mem_reply_out_params.context_allocated = 1;
+ }
+ else
+ {
+ m_output_params.ble_user_mem_reply_out_params.context_allocated = 0;
+ }
+
+ err_code = ble_user_mem_reply_req_enc(conn_handle,
+ p_block,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ user_mem_reply_rsp_dec);
+}
+#if NRF_SD_BLE_API_VERSION >= 4
+/**@brief Command response callback function for @ref sd_ble_cfg_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t cfg_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_cfg_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_cfg_set
+#define _sd_ble_cfg_set sd_ble_cfg_set
+#endif
+uint32_t _sd_ble_cfg_set(uint32_t cfg_id, ble_cfg_t const * p_cfg, uint32_t app_ram_base)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length;
+
+ //Ignore ram_base parameter
+ (void)app_ram_base;
+
+ tx_buf_alloc(&p_buffer, &buffer_length);
+
+ const uint32_t err_code = ble_cfg_set_req_enc(cfg_id, p_cfg,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ cfg_set_rsp_dec);
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gap.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gap.c
new file mode 100644
index 0000000..55cc2fa
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gap.c
@@ -0,0 +1,2025 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gap.h"
+#include <stdint.h>
+#include <string.h>
+#include "ble_serialization.h"
+#include "ser_sd_transport.h"
+#include "ble_gap_app.h"
+#include "app_error.h"
+#include "app_ble_gap_sec_keys.h"
+#include "ser_config.h"
+
+extern ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS];
+
+/**@brief Structure containing @ref sd_ble_gap_device_name_get output parameters. */
+typedef struct
+{
+ uint8_t * p_dev_name; /**< @ref sd_ble_gap_device_name_get p_dev_name output parameter. */
+ uint16_t * p_len; /**< @ref sd_ble_gap_device_name_get p_len output parameter. */
+} gap_device_name_get_output_params_t;
+
+/**@brief Structure containing @ref sd_ble_gap_appearance_get output parameters. */
+typedef struct
+{
+ uint16_t * p_appearance; /**< @ref sd_ble_gap_appearance_get p_appearance output parameter. */
+} gap_appearance_get_output_params_t;
+
+/**@brief Structure containing @ref sd_ble_gap_ppcp_get output parameters. */
+typedef struct
+{
+ ble_gap_conn_params_t * p_conn_params; /**< @ref sd_ble_gap_ppcp_get p_conn_params output parameter. */
+} gap_ppcp_get_out_params_t;
+
+/**@brief Structure containing @ref sd_ble_gap_sec_params_reply output parameters. */
+typedef struct
+{
+ ble_gap_sec_keyset_t const * p_sec_keyset; /**< @ref sd_ble_gap_sec_params_reply p_sec_keyset output parameter. */
+ uint16_t conn_handle; /**< @ref sd_ble_gap_sec_params_reply p_conn_handle output parameter. */
+} gap_sec_params_reply_out_params_t;
+
+/**@brief Union containing BLE command output parameters. */
+typedef union
+{
+ gap_device_name_get_output_params_t gap_device_name_get_out_params; /**< @ref sd_ble_gap_device_name_get output parameters. */
+ gap_appearance_get_output_params_t gap_appearance_get_out_params; /**< @ref sd_ble_gap_appearance_get output parameters. */
+ gap_ppcp_get_out_params_t gap_ppcp_get_out_params; /**< @ref sd_ble_gap_ppcp_get output parameters. */
+ gap_sec_params_reply_out_params_t gap_sec_params_reply_out_params;/**< @ref sd_ble_sec_params_reply output parameters. */
+} gap_command_output_params_t;
+
+static gap_command_output_params_t m_output_params; /**< BLE command output parameters. */
+
+static void * mp_out_params[3];
+
+static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
+{
+ uint32_t err_code;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, p_len);
+ }
+ while (err_code != NRF_SUCCESS);
+ *p_data[0] = SER_PKT_TYPE_CMD;
+ *p_len -= 1;
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_adv_start BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_adv_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_adv_start_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_adv_start
+#define _sd_ble_gap_adv_start sd_ble_gap_adv_start
+#endif
+uint32_t _sd_ble_gap_adv_start(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t adv_handle
+#else
+ ble_gap_adv_params_t const * const p_adv_params
+#endif
+#if NRF_SD_BLE_API_VERSION >= 4
+ ,uint8_t conn_cfg_tag
+#endif
+)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gap_adv_start_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ adv_handle,
+#else
+ p_adv_params,
+#endif
+#if NRF_SD_BLE_API_VERSION >= 4
+ conn_cfg_tag,
+#endif
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_adv_start_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref ble_gap_device_name_get_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_device_name_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_gap_device_name_get_rsp_dec(p_buffer,
+ length,
+ m_output_params.gap_device_name_get_out_params.p_dev_name,
+ m_output_params.gap_device_name_get_out_params.p_len,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_device_name_get
+#define _sd_ble_gap_device_name_get sd_ble_gap_device_name_get
+#endif
+uint32_t _sd_ble_gap_device_name_get(uint8_t * const p_dev_name, uint16_t * const p_len)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ m_output_params.gap_device_name_get_out_params.p_dev_name = p_dev_name;
+ m_output_params.gap_device_name_get_out_params.p_len = p_len;
+
+ const uint32_t err_code = ble_gap_device_name_get_req_enc(p_dev_name,
+ p_len,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_device_name_get_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_appearance_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_appearance_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_gap_appearance_get_rsp_dec(p_buffer,
+ length,
+ m_output_params.gap_appearance_get_out_params.p_appearance,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_appearance_get
+#define _sd_ble_gap_appearance_get sd_ble_gap_appearance_get
+#endif
+uint32_t _sd_ble_gap_appearance_get(uint16_t * const p_appearance)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ m_output_params.gap_appearance_get_out_params.p_appearance = p_appearance;
+
+ const uint32_t err_code = ble_gap_appearance_get_req_enc(p_appearance,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_appearance_get_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_device_name_set BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_device_name_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_device_name_set_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_device_name_set
+#define _sd_ble_gap_device_name_set sd_ble_gap_device_name_set
+#endif
+uint32_t _sd_ble_gap_device_name_set(ble_gap_conn_sec_mode_t const * const p_write_perm,
+ uint8_t const * const p_dev_name,
+ uint16_t len)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_device_name_set_req_enc(p_write_perm,
+ p_dev_name,
+ len,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_device_name_set_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_appearance_set BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_appearance_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_appearance_set_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_appearance_set
+#define _sd_ble_gap_appearance_set sd_ble_gap_appearance_set
+#endif
+uint32_t _sd_ble_gap_appearance_set(uint16_t appearance)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_appearance_set_req_enc(appearance,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_appearance_set_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_ppcp_set BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_ppcp_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_ppcp_set_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_ppcp_set
+#define _sd_ble_gap_ppcp_set sd_ble_gap_ppcp_set
+#endif
+uint32_t _sd_ble_gap_ppcp_set(ble_gap_conn_params_t const * const p_conn_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_ppcp_set_req_enc(p_conn_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_ppcp_set_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_adv_data_set BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+#if NRF_SD_BLE_API_VERSION <= 5
+static uint32_t gap_adv_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_adv_data_set_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+#ifndef _sd_ble_gap_adv_data_set
+#define _sd_ble_gap_adv_data_set sd_ble_gap_adv_data_set
+#endif
+uint32_t _sd_ble_gap_adv_data_set(uint8_t const * const p_data,
+ uint8_t dlen,
+ uint8_t const * const p_sr_data,
+ uint8_t srdlen)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_adv_data_set_req_enc(p_data,
+ dlen,
+ p_sr_data,
+ srdlen,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_adv_data_set_rsp_dec);
+}
+#endif
+
+/**@brief Command response callback function for @ref sd_ble_gap_conn_param_update BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_conn_param_update_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_conn_param_update_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_conn_param_update
+#define _sd_ble_gap_conn_param_update sd_ble_gap_conn_param_update
+#endif
+uint32_t _sd_ble_gap_conn_param_update(uint16_t conn_handle,
+ ble_gap_conn_params_t const * const p_conn_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_conn_param_update_req_enc(conn_handle,
+ p_conn_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_conn_param_update_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_disconnect BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_disconnect_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_disconnect_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_disconnect
+#define _sd_ble_gap_disconnect sd_ble_gap_disconnect
+#endif
+uint32_t _sd_ble_gap_disconnect(uint16_t conn_handle, uint8_t hci_status_code)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_disconnect_req_enc(conn_handle,
+ hci_status_code,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_disconnect_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_sec_info_reply BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_sec_info_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gap_sec_info_reply_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_sec_info_reply
+#define _sd_ble_gap_sec_info_reply sd_ble_gap_sec_info_reply
+#endif
+uint32_t _sd_ble_gap_sec_info_reply(uint16_t conn_handle,
+ ble_gap_enc_info_t const * p_enc_info,
+ ble_gap_irk_t const * p_id_info,
+ ble_gap_sign_info_t const * p_sign_info)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_sec_info_reply_req_enc(conn_handle,
+ p_enc_info,
+ p_id_info,
+ p_sign_info,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_sec_info_reply_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_sec_params_reply BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_sec_params_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ uint32_t err_code = ble_gap_sec_params_reply_rsp_dec(p_buffer, length,
+ m_output_params.gap_sec_params_reply_out_params.p_sec_keyset, &result_code);
+ APP_ERROR_CHECK(err_code);
+
+ // If soft device returned error free security context
+ if (result_code)
+ {
+ err_code = app_ble_gap_sec_context_destroy(m_output_params.gap_sec_params_reply_out_params.conn_handle);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_sec_params_reply
+#define _sd_ble_gap_sec_params_reply sd_ble_gap_sec_params_reply
+#endif
+uint32_t _sd_ble_gap_sec_params_reply(uint16_t conn_handle,
+ uint8_t sec_status,
+ ble_gap_sec_params_t const * p_sec_params,
+ ble_gap_sec_keyset_t const * p_sec_keyset)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+ uint32_t sec_tab_index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ m_output_params.gap_sec_params_reply_out_params.p_sec_keyset = p_sec_keyset;
+ m_output_params.gap_sec_params_reply_out_params.conn_handle = conn_handle;
+
+ // First allocate security context for serialization
+ if (p_sec_keyset)
+ {
+ err_code = app_ble_gap_sec_context_create(conn_handle, &sec_tab_index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ memcpy(&(m_app_keys_table[sec_tab_index].keyset), p_sec_keyset, sizeof(ble_gap_sec_keyset_t));
+ }
+
+ err_code = ble_gap_sec_params_reply_req_enc(conn_handle,
+ sec_status,
+ p_sec_params,
+ p_sec_keyset,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_sec_params_reply_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_ppcp_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_ppcp_get_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_ppcp_get_rsp_dec(
+ p_buffer,
+ length,
+ m_output_params.gap_ppcp_get_out_params.
+ p_conn_params,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_ppcp_get
+#define _sd_ble_gap_ppcp_get sd_ble_gap_ppcp_get
+#endif
+uint32_t _sd_ble_gap_ppcp_get(ble_gap_conn_params_t * const p_conn_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ m_output_params.gap_ppcp_get_out_params.p_conn_params = p_conn_params;
+
+ const uint32_t err_code = ble_gap_ppcp_get_req_enc(p_conn_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_ppcp_get_reply_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gap_adv_stop BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_adv_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_adv_stop_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_adv_stop
+#define _sd_ble_gap_adv_stop sd_ble_gap_adv_stop
+#endif
+uint32_t _sd_ble_gap_adv_stop(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t adv_handle
+#else
+ void
+#endif
+ )
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_adv_stop_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ adv_handle,
+#endif
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_adv_stop_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_auth_key_reply BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_auth_key_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_auth_key_reply_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+
+#ifndef _sd_ble_gap_auth_key_reply
+#define _sd_ble_gap_auth_key_reply sd_ble_gap_auth_key_reply
+#endif
+uint32_t _sd_ble_gap_auth_key_reply(uint16_t conn_handle,
+ uint8_t key_type,
+ uint8_t const * const key)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_auth_key_reply_req_enc(conn_handle, key_type, key,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_auth_key_reply_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_authenticate BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_authenticate_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_authenticate_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_authenticate
+#define _sd_ble_gap_authenticate sd_ble_gap_authenticate
+#endif
+uint32_t _sd_ble_gap_authenticate(uint16_t conn_handle,
+ ble_gap_sec_params_t const * const p_sec_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_authenticate_req_enc(conn_handle, p_sec_params,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_authenticate_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_conn_sec_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_conn_sec_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_conn_sec_get_rsp_dec(
+ p_buffer,
+ length,
+ (ble_gap_conn_sec_t * *)&mp_out_params[0
+ ],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_conn_sec_get
+#define _sd_ble_gap_conn_sec_get sd_ble_gap_conn_sec_get
+#endif
+uint32_t _sd_ble_gap_conn_sec_get(uint16_t conn_handle, ble_gap_conn_sec_t * const p_conn_sec)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_conn_sec;
+
+ const uint32_t err_code = ble_gap_conn_sec_get_req_enc(conn_handle, p_conn_sec,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_conn_sec_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_rssi_start BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_rssi_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_rssi_start_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_rssi_start
+#define _sd_ble_gap_rssi_start sd_ble_gap_rssi_start
+#endif
+uint32_t _sd_ble_gap_rssi_start(uint16_t conn_handle, uint8_t threshold_dbm, uint8_t skip_count)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_rssi_start_req_enc(conn_handle,
+ threshold_dbm,
+ skip_count,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_rssi_start_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_rssi_stop BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_rssi_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_rssi_stop_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_rssi_stop
+#define _sd_ble_gap_rssi_stop sd_ble_gap_rssi_stop
+#endif
+uint32_t _sd_ble_gap_rssi_stop(uint16_t conn_handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_rssi_stop_req_enc(conn_handle,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_rssi_stop_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_tx_power_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_tx_power_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_tx_power_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_tx_power_set
+#define _sd_ble_gap_tx_power_set sd_ble_gap_tx_power_set
+#endif
+uint32_t _sd_ble_gap_tx_power_set(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t role, uint16_t handle,
+#endif
+ int8_t tx_power)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+#if NRF_SD_BLE_API_VERSION > 5
+ const uint32_t err_code = ble_gap_tx_power_set_req_enc(role, handle, tx_power,
+ &(p_buffer[1]), &buffer_length);
+#else
+ const uint32_t err_code = ble_gap_tx_power_set_req_enc(tx_power,
+ &(p_buffer[1]), &buffer_length);
+#endif
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_tx_power_set_rsp_dec);
+}
+
+#ifndef S112
+/**@brief Command response callback function for @ref sd_ble_gap_scan_stop BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_scan_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_scan_stop_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_scan_stop
+#define _sd_ble_gap_scan_stop sd_ble_gap_scan_stop
+#endif
+uint32_t _sd_ble_gap_scan_stop(void)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_scan_stop_req_enc(&(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_scan_stop_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_connect BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_connect_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_connect_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_connect
+#define _sd_ble_gap_connect sd_ble_gap_connect
+#endif
+uint32_t _sd_ble_gap_connect(ble_gap_addr_t const * const p_addr,
+ ble_gap_scan_params_t const * const p_scan_params,
+ ble_gap_conn_params_t const * const p_conn_params
+#if NRF_SD_BLE_API_VERSION >= 4
+ ,uint8_t conn_cfg_tag
+#endif
+ )
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_connect_req_enc(p_addr,
+ p_scan_params,
+ p_conn_params,
+#if NRF_SD_BLE_API_VERSION >= 4
+ conn_cfg_tag,
+#endif
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_connect_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_connect_cancel BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_connect_cancel_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_connect_cancel_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_connect_cancel
+#define _sd_ble_gap_connect_cancel sd_ble_gap_connect_cancel
+#endif
+uint32_t _sd_ble_gap_connect_cancel(void)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_connect_cancel_req_enc(&(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_connect_cancel_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_scan_start BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_scan_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_scan_start_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_scan_start
+#define _sd_ble_gap_scan_start sd_ble_gap_scan_start
+#endif
+uint32_t _sd_ble_gap_scan_start(ble_gap_scan_params_t const * const p_scan_params
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ ,ble_data_t const * p_adv_report_buffer
+#endif
+ )
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+ uint32_t err_code;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ if (p_adv_report_buffer)
+ {
+ err_code = app_ble_gap_scan_data_set(p_adv_report_buffer);
+ APP_ERROR_CHECK(err_code);
+ }
+#endif
+ err_code = ble_gap_scan_start_req_enc(p_scan_params,
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ p_adv_report_buffer,
+#endif
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_scan_start_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_encrypt BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_encrypt_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_encrypt
+#define _sd_ble_gap_encrypt sd_ble_gap_encrypt
+#endif
+uint32_t _sd_ble_gap_encrypt( uint16_t conn_handle,
+ ble_gap_master_id_t const * p_master_id,
+ ble_gap_enc_info_t const * p_enc_info)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_encrypt_req_enc( conn_handle, p_master_id, p_enc_info, &(p_buffer[1]), &buffer_length );
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_encrypt_rsp_dec);
+}
+#endif //!S112
+
+/**@brief Command response callback function for @ref sd_ble_gap_rssi_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_rssi_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_rssi_get_rsp_dec(p_buffer,
+ length,
+ (int8_t *) mp_out_params[0],
+#if NRF_SD_BLE_API_VERSION > 5
+ (uint8_t *) mp_out_params[1],
+#endif
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_rssi_get
+#define _sd_ble_gap_rssi_get sd_ble_gap_rssi_get
+#endif
+uint32_t _sd_ble_gap_rssi_get(uint16_t conn_handle,
+ int8_t * p_rssi
+#if NRF_SD_BLE_API_VERSION > 5
+ ,uint8_t * p_ch_index
+#endif
+)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_rssi;
+
+#if NRF_SD_BLE_API_VERSION > 5
+ mp_out_params[1] = p_ch_index;
+ const uint32_t err_code = ble_gap_rssi_get_req_enc(conn_handle, p_rssi, p_ch_index, &(p_buffer[1]), &buffer_length);
+#else
+ const uint32_t err_code = ble_gap_rssi_get_req_enc(conn_handle, p_rssi, &(p_buffer[1]), &buffer_length);
+#endif
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_rssi_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_keypress_notify BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_keypress_notify_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_keypress_notify_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_keypress_notify
+#define _sd_ble_gap_keypress_notify sd_ble_gap_keypress_notify
+#endif
+uint32_t _sd_ble_gap_keypress_notify( uint16_t conn_handle, uint8_t kp_not)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_keypress_notify_req_enc( conn_handle, kp_not, &p_buffer[1], &buffer_length );
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_keypress_notify_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_lesc_dhkey_reply BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_lesc_dhkey_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_lesc_dhkey_reply_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_lesc_dhkey_reply
+#define _sd_ble_gap_lesc_dhkey_reply sd_ble_gap_lesc_dhkey_reply
+#endif
+uint32_t _sd_ble_gap_lesc_dhkey_reply( uint16_t conn_handle, ble_gap_lesc_dhkey_t const *p_dhkey)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_lesc_dhkey_reply_req_enc( conn_handle, p_dhkey, &(p_buffer[1]), &buffer_length );
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_lesc_dhkey_reply_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_lesc_oob_data_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_lesc_oob_data_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_lesc_oob_data_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_lesc_oob_data_set
+#define _sd_ble_gap_lesc_oob_data_set sd_ble_gap_lesc_oob_data_set
+#endif
+uint32_t _sd_ble_gap_lesc_oob_data_set(uint16_t conn_handle,
+ ble_gap_lesc_oob_data_t const *p_oobd_own,
+ ble_gap_lesc_oob_data_t const *p_oobd_peer)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_lesc_oob_data_set_req_enc(conn_handle, p_oobd_own, p_oobd_peer,
+ &(p_buffer[1]), &buffer_length );
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_lesc_oob_data_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_lesc_oob_data_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_lesc_oob_data_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_lesc_oob_data_get_rsp_dec(p_buffer,
+ length,
+ (ble_gap_lesc_oob_data_t **) &mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_lesc_oob_data_get
+#define _sd_ble_gap_lesc_oob_data_get sd_ble_gap_lesc_oob_data_get
+#endif
+uint32_t _sd_ble_gap_lesc_oob_data_get(uint16_t conn_handle,
+ ble_gap_lesc_p256_pk_t const *p_pk_own,
+ ble_gap_lesc_oob_data_t *p_oobd_own)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_oobd_own;
+ const uint32_t err_code = ble_gap_lesc_oob_data_get_req_enc(conn_handle, p_pk_own, p_oobd_own,
+ &(p_buffer[1]), &buffer_length );
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_lesc_oob_data_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_addr_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_addr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_addr_get_rsp_dec(p_buffer,
+ length,
+ (ble_gap_addr_t *)mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_addr_get
+#define _sd_ble_gap_addr_get sd_ble_gap_addr_get
+#endif
+uint32_t _sd_ble_gap_addr_get(ble_gap_addr_t * const p_addr)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_addr;
+
+ const uint32_t err_code = ble_gap_addr_get_req_enc(p_addr,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_addr_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_addr_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_addr_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_addr_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_addr_set
+#define _sd_ble_gap_addr_set sd_ble_gap_addr_set
+#endif
+uint32_t _sd_ble_gap_addr_set(ble_gap_addr_t const * const p_addr)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_addr_set_req_enc(p_addr,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_addr_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_privacy_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_privacy_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_privacy_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_privacy_set
+#define _sd_ble_gap_privacy_set sd_ble_gap_privacy_set
+#endif
+uint32_t _sd_ble_gap_privacy_set(ble_gap_privacy_params_t const *p_privacy_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gap_privacy_set_req_enc(p_privacy_params,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_privacy_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_privacy_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_privacy_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_privacy_get_rsp_dec(p_buffer,
+ length,
+ (ble_gap_privacy_params_t *)mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_privacy_get
+#define _sd_ble_gap_privacy_get sd_ble_gap_privacy_get
+#endif
+uint32_t _sd_ble_gap_privacy_get(ble_gap_privacy_params_t *p_privacy_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_privacy_params;
+
+ const uint32_t err_code = ble_gap_privacy_get_req_enc(p_privacy_params,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_privacy_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_whitelist_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_whitelist_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_whitelist_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_whitelist_set
+#define _sd_ble_gap_whitelist_set sd_ble_gap_whitelist_set
+#endif
+uint32_t _sd_ble_gap_whitelist_set(ble_gap_addr_t const * const * pp_wl_addrs, uint8_t len)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gap_whitelist_set_req_enc(pp_wl_addrs, len,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_whitelist_set_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_device_identities_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_device_identities_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_device_identities_set_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_device_identities_set
+#define _sd_ble_gap_device_identities_set sd_ble_gap_device_identities_set
+#endif
+uint32_t _sd_ble_gap_device_identities_set(ble_gap_id_key_t const * const * pp_id_keys, ble_gap_irk_t const * const * pp_local_irks, uint8_t len)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gap_device_identities_set_req_enc(pp_id_keys,
+ pp_local_irks,
+ len,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_device_identities_set_rsp_dec);
+}
+
+#if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
+/**@brief Command response callback function for @ref sd_ble_gap_data_length_update BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_data_length_update_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_data_length_update_rsp_dec(p_buffer,
+ length,
+ (ble_gap_data_length_limitation_t *)mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_data_length_update
+#define _sd_ble_gap_data_length_update sd_ble_gap_data_length_update
+#endif
+uint32_t _sd_ble_gap_data_length_update(uint16_t conn_handle,
+ ble_gap_data_length_params_t const *p_dl_params,
+ ble_gap_data_length_limitation_t *p_dl_limitation)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_dl_limitation;
+
+ const uint32_t err_code = ble_gap_data_length_update_req_enc(conn_handle, p_dl_params,p_dl_limitation,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_data_length_update_rsp_dec);
+}
+
+#endif // NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
+
+#if NRF_SD_BLE_API_VERSION >= 5
+/**@brief Command response callback function for @ref sd_ble_gap_phy_update BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_phy_update_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ const uint32_t err_code = ble_gap_phy_update_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_phy_update
+#define _sd_ble_gap_phy_update sd_ble_gap_phy_update
+#endif
+uint32_t _sd_ble_gap_phy_update(uint16_t conn_handle,
+ ble_gap_phys_t const * const p_gap_phys)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gap_phy_update_req_enc(conn_handle, p_gap_phys,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_phy_update_rsp_dec);
+}
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 6
+/**@brief Command response callback function for @ref sd_ble_gap_adv_set_configure BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_adv_set_configure_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ uint32_t err_code = ble_gap_adv_set_configure_rsp_dec(p_buffer,
+ length,
+ (uint8_t *)mp_out_params[0],
+ &result_code);
+
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ err_code = app_ble_gap_adv_set_register(*(uint8_t *)mp_out_params[0],
+ (uint8_t *)mp_out_params[1],
+ (uint8_t *)mp_out_params[2]);
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_adv_set_configure
+#define _sd_ble_gap_adv_set_configure sd_ble_gap_adv_set_configure
+#endif
+uint32_t _sd_ble_gap_adv_set_configure(uint8_t *p_adv_handle,
+ ble_gap_adv_data_t const *p_adv_data,
+ ble_gap_adv_params_t const *p_adv_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ mp_out_params[0] = p_adv_handle;
+ mp_out_params[1] = p_adv_data ? p_adv_data->adv_data.p_data : NULL;
+ mp_out_params[2] = p_adv_data ? p_adv_data->scan_rsp_data.p_data : NULL;
+ const uint32_t err_code = ble_gap_adv_set_configure_req_enc(p_adv_handle, p_adv_data, p_adv_params,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_adv_set_configure_rsp_dec);
+}
+
+#ifndef S112
+/**@brief Command response callback function for @ref sd_ble_gap_qos_channel_survey_start BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_qos_channel_survey_start_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ uint32_t err_code = ble_gap_qos_channel_survey_start_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_qos_channel_survey_start
+#define _sd_ble_gap_qos_channel_survey_start sd_ble_gap_qos_channel_survey_start
+#endif
+uint32_t _sd_ble_gap_qos_channel_survey_start(uint32_t interval_us)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gap_qos_channel_survey_start_req_enc(interval_us,
+ &(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_qos_channel_survey_start_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gap_qos_channel_survey_stop BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gap_qos_channel_survey_stop_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = 0;
+
+ uint32_t err_code = ble_gap_qos_channel_survey_stop_rsp_dec(p_buffer,
+ length,
+ &result_code);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gap_qos_channel_survey_stop
+#define _sd_ble_gap_qos_channel_survey_stop sd_ble_gap_qos_channel_survey_stop
+#endif
+uint32_t _sd_ble_gap_qos_channel_survey_stop(void)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gap_qos_channel_survey_stop_req_enc(&(p_buffer[1]), &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gap_qos_channel_survey_stop_rsp_dec);
+}
+#endif //!S112
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gattc.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gattc.c
new file mode 100644
index 0000000..7edf6ee
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gattc.c
@@ -0,0 +1,566 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdint.h>
+#include "ble_gattc.h"
+#include "ble_gattc_app.h"
+#include "ble_serialization.h"
+#include "ser_sd_transport.h"
+#include "app_error.h"
+
+static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
+{
+ uint32_t err_code;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, p_len);
+ }
+ while (err_code != NRF_SUCCESS);
+ *p_data[0] = SER_PKT_TYPE_CMD;
+ *p_len -= 1;
+}
+/**@brief Command response callback function for @ref sd_ble_gattc_primary_services_discover BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_primary_services_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_primary_services_discover_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_primary_services_discover
+#define _sd_ble_gattc_primary_services_discover sd_ble_gattc_primary_services_discover
+#endif
+uint32_t _sd_ble_gattc_primary_services_discover(uint16_t conn_handle,
+ uint16_t start_handle,
+ ble_uuid_t const * const p_srvc_uuid)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_primary_services_discover_req_enc(conn_handle,
+ start_handle,
+ p_srvc_uuid,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_primary_services_discover_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_relationships_discover BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_relationships_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_relationships_discover_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_relationships_discover
+#define _sd_ble_gattc_relationships_discover sd_ble_gattc_relationships_discover
+#endif
+uint32_t _sd_ble_gattc_relationships_discover(uint16_t conn_handle,
+ ble_gattc_handle_range_t const * const p_handle_range)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_relationships_discover_req_enc(conn_handle,
+ p_handle_range,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_relationships_discover_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_characteristics_discover BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_characteristics_discover_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_characteristics_discover
+#define _sd_ble_gattc_characteristics_discover sd_ble_gattc_characteristics_discover
+#endif
+uint32_t _sd_ble_gattc_characteristics_discover(
+ uint16_t conn_handle,
+ ble_gattc_handle_range_t const * const
+ p_handle_range)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_characteristics_discover_req_enc(conn_handle,
+ p_handle_range,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_characteristics_discover_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_descriptors_discover BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_descriptors_discover_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_descriptors_discover
+#define _sd_ble_gattc_descriptors_discover sd_ble_gattc_descriptors_discover
+#endif
+uint32_t _sd_ble_gattc_descriptors_discover(uint16_t conn_handle,
+ ble_gattc_handle_range_t const * const p_handle_range)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_descriptors_discover_req_enc(conn_handle,
+ p_handle_range,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_descriptors_discover_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_char_value_by_uuid_read BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_char_value_by_uuid_read_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_char_value_by_uuid_read_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_char_value_by_uuid_read
+#define _sd_ble_gattc_char_value_by_uuid_read sd_ble_gattc_char_value_by_uuid_read
+#endif
+uint32_t _sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle,
+ ble_uuid_t const * const p_uuid,
+ ble_gattc_handle_range_t const * const p_handle_range)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_char_value_by_uuid_read_req_enc(conn_handle,
+ p_uuid,
+ p_handle_range,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_char_value_by_uuid_read_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_read BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_read_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_read_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_read
+#define _sd_ble_gattc_read sd_ble_gattc_read
+#endif
+uint32_t _sd_ble_gattc_read(uint16_t conn_handle,
+ uint16_t handle,
+ uint16_t offset)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_read_req_enc(conn_handle,
+ handle,
+ offset,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_read_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_char_values_read BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_char_values_read_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_char_values_read_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_char_values_read
+#define _sd_ble_gattc_char_values_read sd_ble_gattc_char_values_read
+#endif
+uint32_t _sd_ble_gattc_char_values_read(uint16_t conn_handle,
+ uint16_t const * const p_handles,
+ uint16_t handle_count)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_char_values_read_req_enc(conn_handle,
+ p_handles,
+ handle_count,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_char_values_read_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_write BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_write_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_write_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_write
+#define _sd_ble_gattc_write sd_ble_gattc_write
+#endif
+uint32_t _sd_ble_gattc_write(uint16_t conn_handle,
+ ble_gattc_write_params_t const * const p_write_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_write_req_enc(conn_handle,
+ p_write_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_write_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_hv_confirm BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_hv_confirm_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_hv_confirm_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_hv_confirm
+#define _sd_ble_gattc_hv_confirm sd_ble_gattc_hv_confirm
+#endif
+uint32_t _sd_ble_gattc_hv_confirm(uint16_t conn_handle,
+ uint16_t handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_hv_confirm_req_enc(conn_handle,
+ handle,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_hv_confirm_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gattc_info_discover BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_attr_info_discover_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_attr_info_discover_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_attr_info_discover
+#define _sd_ble_gattc_attr_info_discover sd_ble_gattc_attr_info_discover
+#endif
+uint32_t _sd_ble_gattc_attr_info_discover(uint16_t conn_handle,
+ ble_gattc_handle_range_t const * const p_handle_range)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_attr_info_discover_req_enc(conn_handle,
+ p_handle_range,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_attr_info_discover_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gattc_write BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gattc_exchange_mtu_request_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gattc_exchange_mtu_request_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+ return result_code;
+}
+
+#ifndef _sd_ble_gattc_exchange_mtu_request
+#define _sd_ble_gattc_exchange_mtu_request sd_ble_gattc_exchange_mtu_request
+#endif
+uint32_t _sd_ble_gattc_exchange_mtu_request(uint16_t conn_handle,
+ uint16_t client_rx_mtu)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gattc_exchange_mtu_request_req_enc(conn_handle,
+ client_rx_mtu,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gattc_exchange_mtu_request_rsp_dec);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gatts.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gatts.c
new file mode 100644
index 0000000..e4b3002
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_gatts.c
@@ -0,0 +1,773 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gatts.h"
+#include <stdint.h>
+#include "ble_serialization.h"
+#include "ser_sd_transport.h"
+#include "ble_gatts_app.h"
+#include "app_error.h"
+
+
+//Pointer for sd calls output params
+static void * mp_out_params[3];
+
+static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
+{
+ uint32_t err_code;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, p_len);
+ }
+ while (err_code != NRF_SUCCESS);
+ *p_data[0] = SER_PKT_TYPE_CMD;
+ *p_len -= 1;
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_set BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_sys_attr_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_sys_attr_set_rsp_dec(p_buffer, length, &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_sys_attr_set
+#define _sd_ble_gatts_sys_attr_set sd_ble_gatts_sys_attr_set
+#endif
+uint32_t _sd_ble_gatts_sys_attr_set(uint16_t conn_handle,
+ uint8_t const * const p_sys_attr_data,
+ uint16_t len,
+ uint32_t flags)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gatts_sys_attr_set_req_enc(conn_handle,
+ p_sys_attr_data,
+ len,
+ flags,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_sys_attr_set_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gatts_hvx BLE command.
+ *
+ * Callback for decoding the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_hvx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_hvx_rsp_dec(p_buffer, length, &result_code,
+ (uint16_t * *)&mp_out_params[0]);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_hvx
+#define _sd_ble_gatts_hvx sd_ble_gatts_hvx
+#endif
+uint32_t _sd_ble_gatts_hvx(uint16_t conn_handle, ble_gatts_hvx_params_t const * const p_hvx_params)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = (p_hvx_params) ? p_hvx_params->p_len : NULL;
+
+ const uint32_t err_code = ble_gatts_hvx_req_enc(conn_handle,
+ p_hvx_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_hvx_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_service_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_gatts_service_add_rsp_dec(p_buffer,
+ length,
+ (uint16_t *)mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_service_add
+#define _sd_ble_gatts_service_add sd_ble_gatts_service_add
+#endif
+uint32_t _sd_ble_gatts_service_add(uint8_t type,
+ ble_uuid_t const * const p_uuid,
+ uint16_t * const p_handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_handle;
+
+ const uint32_t err_code = ble_gatts_service_add_req_enc(type,
+ p_uuid,
+ p_handle,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_service_add_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_service_add BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_service_changed_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = NRF_SUCCESS;
+
+ const uint32_t err_code = ble_gatts_service_changed_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_service_changed
+#define _sd_ble_gatts_service_changed sd_ble_gatts_service_changed
+#endif
+uint32_t _sd_ble_gatts_service_changed(uint16_t conn_handle,
+ uint16_t start_handle,
+ uint16_t end_handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_gatts_service_changed_req_enc(conn_handle,
+ start_handle,
+ end_handle,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_service_changed_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_include_add BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_include_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = NRF_SUCCESS;
+
+ const uint32_t err_code =
+ ble_gatts_include_add_rsp_dec(p_buffer,
+ length,
+ (uint16_t *) mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_include_add
+#define _sd_ble_gatts_include_add sd_ble_gatts_include_add
+#endif
+uint32_t _sd_ble_gatts_include_add(uint16_t service_handle,
+ uint16_t inc_serv_handle,
+ uint16_t * const p_include_handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_include_handle;
+
+ const uint32_t err_code = ble_gatts_include_add_req_enc(service_handle,
+ inc_serv_handle,
+ p_include_handle,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_include_add_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_characteristic_add BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_characteristic_add_rsp_dec(
+ p_buffer,
+ length,
+ (uint16_t * *)&mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_characteristic_add
+#define _sd_ble_gatts_characteristic_add sd_ble_gatts_characteristic_add
+#endif
+uint32_t _sd_ble_gatts_characteristic_add(uint16_t service_handle,
+ ble_gatts_char_md_t const * const p_char_md,
+ ble_gatts_attr_t const * const p_attr_char_value,
+ ble_gatts_char_handles_t * const p_handles)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_handles;
+
+ const uint32_t err_code = ble_gatts_characteristic_add_req_enc(service_handle,
+ p_char_md,
+ p_attr_char_value,
+ p_handles,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_characteristic_add_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_descriptor_add BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_descriptor_add_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = NRF_SUCCESS;
+
+ const uint32_t err_code =
+ ble_gatts_descriptor_add_rsp_dec(p_buffer,
+ length,
+ (uint16_t *) mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_descriptor_add
+#define _sd_ble_gatts_descriptor_add sd_ble_gatts_descriptor_add
+#endif
+uint32_t _sd_ble_gatts_descriptor_add(uint16_t char_handle,
+ ble_gatts_attr_t const * const p_attr,
+ uint16_t * const p_handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_handle;
+
+ const uint32_t err_code = ble_gatts_descriptor_add_req_enc(char_handle,
+ p_attr,
+ p_handle,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_descriptor_add_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_rw_authorize_reply BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_rw_authorize_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code = NRF_SUCCESS;
+
+ const uint32_t err_code = ble_gatts_rw_authorize_reply_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_rw_authorize_reply
+#define _sd_ble_gatts_rw_authorize_reply sd_ble_gatts_rw_authorize_reply
+#endif
+uint32_t _sd_ble_gatts_rw_authorize_reply(
+ uint16_t conn_handle,
+ ble_gatts_rw_authorize_reply_params_t const * const
+ p_rw_authorize_reply_params)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gatts_rw_authorize_reply_req_enc(conn_handle,
+ p_rw_authorize_reply_params,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_rw_authorize_reply_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_value_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_value_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_value_get_rsp_dec(p_buffer,
+ length,
+ (ble_gatts_value_t *)mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_value_get
+#define _sd_ble_gatts_value_get sd_ble_gatts_value_get
+#endif
+uint32_t _sd_ble_gatts_value_get(uint16_t conn_handle,
+ uint16_t handle,
+ ble_gatts_value_t * p_value)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_value;
+
+ const uint32_t err_code = ble_gatts_value_get_req_enc(conn_handle,
+ handle,
+ p_value,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_value_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_value_set BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_value_set_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_value_set_rsp_dec(
+ p_buffer,
+ length,
+ (ble_gatts_value_t *)mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_value_set
+#define _sd_ble_gatts_value_set sd_ble_gatts_value_set
+#endif
+uint32_t _sd_ble_gatts_value_set(uint16_t conn_handle,
+ uint16_t handle,
+ ble_gatts_value_t * p_value)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_value;
+
+ const uint32_t err_code = ble_gatts_value_set_req_enc(conn_handle,
+ handle,
+ p_value,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_value_set_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref sd_ble_gatts_sys_attr_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_sys_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_sys_attr_get_rsp_dec(
+ p_buffer,
+ length,
+ (uint8_t * *) &mp_out_params[0],
+ (uint16_t * *) &mp_out_params[1],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_sys_attr_get
+#define _sd_ble_gatts_sys_attr_get sd_ble_gatts_sys_attr_get
+#endif
+uint32_t _sd_ble_gatts_sys_attr_get(uint16_t conn_handle,
+ uint8_t * const p_sys_attr_data,
+ uint16_t * const p_len,
+ uint32_t flags)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_sys_attr_data;
+ mp_out_params[1] = p_len;
+
+ const uint32_t err_code = ble_gatts_sys_attr_get_req_enc(conn_handle,
+ p_sys_attr_data,
+ p_len,
+ flags,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_sys_attr_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_attr_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_attr_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_attr_get_rsp_dec(
+ p_buffer,
+ length,
+ (ble_uuid_t **)&mp_out_params[0],
+ (ble_gatts_attr_md_t **)&mp_out_params[1],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_attr_get
+#define _sd_ble_gatts_attr_get sd_ble_gatts_attr_get
+#endif
+uint32_t _sd_ble_gatts_attr_get(uint16_t handle,
+ ble_uuid_t * p_uuid,
+ ble_gatts_attr_md_t * p_md)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_uuid;
+ mp_out_params[1] = p_md;
+
+ const uint32_t err_code = ble_gatts_attr_get_req_enc(handle,
+ p_uuid,
+ p_md,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_attr_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_initial_user_handle_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_initial_user_handle_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_initial_user_handle_get_rsp_dec(
+ p_buffer,
+ length,
+ (uint16_t **)&mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_initial_user_handle_get
+#define _sd_ble_gatts_initial_user_handle_get sd_ble_gatts_initial_user_handle_get
+#endif
+uint32_t _sd_ble_gatts_initial_user_handle_get(uint16_t * p_handle)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_handle;
+
+ const uint32_t err_code = ble_gatts_initial_user_handle_get_req_enc(p_handle,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_initial_user_handle_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ble_gatts_exchange_mtu_reply BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t gatts_exchange_mtu_reply_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_gatts_exchange_mtu_reply_rsp_dec(
+ p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_gatts_exchange_mtu_reply
+#define _sd_ble_gatts_exchange_mtu_reply sd_ble_gatts_exchange_mtu_reply
+#endif
+uint32_t _sd_ble_gatts_exchange_mtu_reply(uint16_t conn_handle, uint16_t server_rx_mtu)
+{
+
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+
+ const uint32_t err_code = ble_gatts_exchange_mtu_reply_req_enc(conn_handle,
+ server_rx_mtu,
+ &(p_buffer[1]),
+ &buffer_length);
+
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ gatts_exchange_mtu_reply_rsp_dec);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_l2cap.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_l2cap.c
new file mode 100644
index 0000000..41aa555
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_ble_l2cap.c
@@ -0,0 +1,453 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gap.h"
+#include <stdint.h>
+#include "ble_serialization.h"
+#include "ser_sd_transport.h"
+#include "ble_l2cap_app.h"
+#include "app_error.h"
+
+#if defined(NRF_SD_BLE_API_VERSION) && ((NRF_SD_BLE_API_VERSION < 4) || (NRF_SD_BLE_API_VERSION >=5))
+static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
+{
+ uint32_t err_code;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, p_len);
+ }
+ while (err_code != NRF_SUCCESS);
+ *p_data[0] = SER_PKT_TYPE_CMD;
+ *p_len -= 1;
+}
+
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**@brief Command response callback function for @ref ble_l2cap_cid_register_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_cid_register_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_cid_register_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_cid_register
+#define _sd_ble_l2cap_cid_register sd_ble_l2cap_cid_register
+#endif
+uint32_t _sd_ble_l2cap_cid_register(uint16_t cid)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_l2cap_cid_register_req_enc(cid,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_cid_register_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref ble_l2cap_cid_unregister_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_cid_unregister_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_cid_unregister_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_cid_unregister
+#define _sd_ble_l2cap_cid_unregister sd_ble_l2cap_cid_unregister
+#endif
+uint32_t _sd_ble_l2cap_cid_unregister(uint16_t cid)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_l2cap_cid_unregister_req_enc(cid,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_cid_unregister_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref ble_l2cap_tx_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_tx_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_tx
+#define _sd_ble_l2cap_tx sd_ble_l2cap_tx
+#endif
+uint32_t _sd_ble_l2cap_tx(uint16_t conn_handle,
+ ble_l2cap_header_t const * const p_header,
+ uint8_t const * const p_data)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_l2cap_tx_req_enc(conn_handle, p_header, p_data,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_tx_rsp_dec);
+}
+
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 5
+static void * mp_out_params[1];
+/**@brief Command response callback function for @ref ble_l2cap_ch_setup_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_ch_setup_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_ch_setup_rsp_dec(p_buffer,
+ length,
+ (uint16_t *)mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_ch_setup
+#define _sd_ble_l2cap_ch_setup sd_ble_l2cap_ch_setup
+#endif
+uint32_t _sd_ble_l2cap_ch_setup(uint16_t conn_handle,
+ uint16_t * p_local_cid,
+ ble_l2cap_ch_setup_params_t const *p_params)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_local_cid;
+ const uint32_t err_code = ble_l2cap_ch_setup_req_enc(conn_handle, p_local_cid, p_params,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_ch_setup_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref ble_l2cap_ch_release_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_ch_release_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_ch_release_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_ch_release
+#define _sd_ble_l2cap_ch_release sd_ble_l2cap_ch_release
+#endif
+uint32_t _sd_ble_l2cap_ch_release(uint16_t conn_handle,
+ uint16_t local_cid)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_l2cap_ch_release_req_enc(conn_handle, local_cid,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_ch_release_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref ble_l2cap_ch_rx_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_ch_rx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_ch_rx_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_ch_rx
+#define _sd_ble_l2cap_ch_rx sd_ble_l2cap_ch_rx
+#endif
+uint32_t _sd_ble_l2cap_ch_rx(uint16_t conn_handle, uint16_t local_cid, ble_data_t const *p_sdu_buf)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_l2cap_ch_rx_req_enc(conn_handle, local_cid, p_sdu_buf,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_ch_rx_rsp_dec);
+}
+
+
+/**@brief Command response callback function for @ref ble_l2cap_ch_tx_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_ch_tx_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_ch_tx_rsp_dec(p_buffer,
+ length,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_ch_tx
+#define _sd_ble_l2cap_ch_tx sd_ble_l2cap_ch_tx
+#endif
+uint32_t _sd_ble_l2cap_ch_tx(uint16_t conn_handle, uint16_t local_cid, ble_data_t const *p_sdu_buf)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = ble_l2cap_ch_tx_req_enc(conn_handle, local_cid, p_sdu_buf,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_ch_tx_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref ble_l2cap_ch_flow_control_req_enc BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+static uint32_t l2cap_ch_flow_control_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code =
+ ble_l2cap_ch_flow_control_rsp_dec(p_buffer,
+ length,
+ (uint16_t *)mp_out_params[0],
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+
+
+ return result_code;
+}
+
+#ifndef _sd_ble_l2cap_ch_flow_control
+#define _sd_ble_l2cap_ch_flow_control sd_ble_l2cap_ch_flow_control
+#endif
+uint32_t _sd_ble_l2cap_ch_flow_control(uint16_t conn_handle,
+ uint16_t local_cid,
+ uint16_t credits,
+ uint16_t *p_credits)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_params[0] = p_credits;
+ const uint32_t err_code = ble_l2cap_ch_flow_control_req_enc(conn_handle, local_cid, credits, p_credits,
+ &(p_buffer[1]),
+ &buffer_length);
+ //@note: Should never fail.
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ l2cap_ch_flow_control_rsp_dec);
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_nrf_soc.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_nrf_soc.c
new file mode 100644
index 0000000..0b0158e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/middleware/app_mw_nrf_soc.c
@@ -0,0 +1,171 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 "nrf_soc.h"
+#include <stdint.h>
+#include <string.h>
+#include "ser_sd_transport.h"
+#include "nrf_soc_app.h"
+#include "nrf_error_soc.h"
+#include "app_error.h"
+#include "ble_serialization.h"
+
+#include "ser_app_power_system_off.h"
+
+static void * mp_out_param;
+
+static void tx_buf_alloc(uint8_t * * p_data, uint16_t * p_len)
+{
+ uint32_t err_code;
+
+ do
+ {
+ err_code = ser_sd_transport_tx_alloc(p_data, p_len);
+ }
+ while (err_code != NRF_SUCCESS);
+ *p_data[0] = SER_PKT_TYPE_CMD;
+ *p_len -= 1;
+}
+
+
+uint32_t sd_power_system_off(void)
+{
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ const uint32_t err_code = power_system_off_req_enc(&(p_buffer[1]), &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ ser_app_power_system_off_set();
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ NULL);
+}
+
+
+/**@brief Command response callback function for @ref sd_temp_get BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+
+static uint32_t mw_temp_get_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = temp_get_rsp_dec(p_buffer,
+ length,
+ &result_code,
+ (int32_t * *) &mp_out_param);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_temp_get(int32_t * p_temp)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_param = p_temp;
+
+ const uint32_t err_code = temp_get_req_enc(p_temp,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ mw_temp_get_rsp_dec);
+}
+
+/**@brief Command response callback function for @ref sd_ecb_block_encrypt BLE command.
+ *
+ * Callback for decoding the output parameters and the command response return code.
+ *
+ * @param[in] p_buffer Pointer to begin of command response buffer.
+ * @param[in] length Length of data in bytes.
+ *
+ * @return Decoded command response return code.
+ */
+
+static uint32_t mw_ecb_block_encrypt_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ecb_block_encrypt_rsp_dec(p_buffer,
+ length,
+ (nrf_ecb_hal_data_t * *)&mp_out_param,
+ &result_code);
+
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+uint32_t sd_ecb_block_encrypt(nrf_ecb_hal_data_t * p_ecb_data)
+{
+
+ uint8_t * p_buffer;
+ uint32_t buffer_length = 0;
+
+ tx_buf_alloc(&p_buffer, (uint16_t *)&buffer_length);
+ mp_out_param = p_ecb_data;
+
+ const uint32_t err_code = ecb_block_encrypt_req_enc(p_ecb_data,
+ &(p_buffer[1]),
+ &buffer_length);
+ APP_ERROR_CHECK(err_code);
+
+ //@note: Increment buffer length as internally managed packet type field must be included.
+ return ser_sd_transport_cmd_write(p_buffer,
+ (++buffer_length),
+ mw_ecb_block_encrypt_rsp_dec);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.c
new file mode 100644
index 0000000..108231d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.c
@@ -0,0 +1,182 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 "app_ble_gap_sec_keys.h"
+#include "ser_config.h"
+#include "nrf_error.h"
+#include "nordic_common.h"
+#include <stddef.h>
+#include <stdbool.h>
+#include <string.h>
+
+#if NRF_SD_BLE_API_VERSION >= 6
+typedef struct {
+ bool active;
+ uint8_t adv_handle;
+ uint8_t * p_adv_data;
+ uint8_t * p_scan_rsp_data;
+} adv_set_t;
+
+static adv_set_t m_adv_sets[4]; //todo configurable number of adv sets.
+
+static ble_data_t m_scan_data = {0};
+#endif
+ser_ble_gap_app_keyset_t m_app_keys_table[SER_MAX_CONNECTIONS];
+
+uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index)
+{
+ uint32_t err_code = NRF_ERROR_NO_MEM;
+ uint32_t i;
+
+ for (i=0; i<SER_MAX_CONNECTIONS; i++ )
+ {
+ if ( ! m_app_keys_table[i].conn_active )
+ {
+ m_app_keys_table[i].conn_active = 1;
+ m_app_keys_table[i].conn_handle = conn_handle;
+ *p_index = i;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+
+ return err_code;
+}
+
+uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle)
+{
+ uint32_t err_code = NRF_ERROR_NOT_FOUND;
+ uint32_t i;
+
+ for (i=0; i<SER_MAX_CONNECTIONS; i++ )
+ {
+ if ( m_app_keys_table[i].conn_handle == conn_handle )
+ {
+ m_app_keys_table[i].conn_active = 0;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+
+ return err_code;
+}
+
+uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index)
+{
+ uint32_t err_code = NRF_ERROR_NOT_FOUND;
+ uint32_t i;
+
+ for (i=0; i<SER_MAX_CONNECTIONS; i++ )
+ {
+ if ( (m_app_keys_table[i].conn_handle == conn_handle) && (m_app_keys_table[i].conn_active == 1) )
+ {
+ *p_index = i;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+
+ return err_code;
+}
+#if NRF_SD_BLE_API_VERSION >= 6
+uint32_t app_ble_gap_scan_data_set(ble_data_t const * p_data)
+{
+ if (m_scan_data.p_data)
+ {
+ return NRF_ERROR_BUSY;
+ }
+ else
+ {
+ memcpy(&m_scan_data, p_data, sizeof(ble_data_t));
+ return NRF_SUCCESS;
+ }
+}
+
+
+uint32_t app_ble_gap_scan_data_fetch_clear(ble_data_t * p_data)
+{
+ memcpy(p_data, &m_scan_data, sizeof(ble_data_t));
+ if (m_scan_data.p_data)
+ {
+ m_scan_data.p_data = NULL;
+ return NRF_SUCCESS;
+ }
+ else
+ {
+ return NRF_ERROR_NOT_FOUND;
+ }
+}
+
+uint32_t app_ble_gap_adv_set_register(uint8_t adv_handle, uint8_t * p_adv_data, uint8_t * p_scan_rsp_data)
+{
+ uint32_t err_code = NRF_ERROR_NO_MEM;
+ uint32_t i;
+ for (i = 0; i < ARRAY_SIZE(m_adv_sets); i++)
+ {
+ if (m_adv_sets[i].active == false)
+ {
+ m_adv_sets[i].active = true;
+ m_adv_sets[i].adv_handle = adv_handle;
+ m_adv_sets[i].p_adv_data = p_adv_data;
+ m_adv_sets[i].p_scan_rsp_data = p_scan_rsp_data;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+ return err_code;
+}
+
+uint32_t app_ble_gap_adv_set_unregister(uint8_t adv_handle, uint8_t * * pp_adv_data, uint8_t **pp_scan_rsp_data)
+{
+ uint32_t err_code = NRF_ERROR_NOT_FOUND;
+ uint32_t i;
+ for (i = 0; i < ARRAY_SIZE(m_adv_sets); i++)
+ {
+ if ((m_adv_sets[i].active == true) && (m_adv_sets[i].adv_handle == adv_handle))
+ {
+ m_adv_sets[i].active = false;
+ *pp_adv_data = m_adv_sets[i].p_adv_data;
+ *pp_scan_rsp_data = m_adv_sets[i].p_scan_rsp_data;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+ return err_code;
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.h
new file mode 100644
index 0000000..314a5f5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_gap_sec_keys.h
@@ -0,0 +1,151 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef _APP_BLE_GAP_SEC_KEYS_H
+#define _APP_BLE_GAP_SEC_KEYS_H
+
+ /**@file
+ *
+ * @defgroup app_ble_gap_sec_keys GAP Functions for managing memory for security keys in the application device.
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GAP Application auxiliary functions for synchronizing the GAP security keys with the ones stored in the connectivity device.
+ */
+
+#include "ble_gap.h"
+#include "ble_types.h"
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief GAP connection - keyset mapping structure.
+ *
+ * @note This structure is used to map keysets to connection instances and store them in a static table.
+ */
+typedef struct
+{
+ uint16_t conn_handle; /**< Connection handle.*/
+ uint8_t conn_active; /**< Indication that keys for this connection are used by the SoftDevice. 0: keys used; 1: keys not used. */
+ ble_gap_sec_keyset_t keyset; /**< Keyset structure, see @ref ble_gap_sec_keyset_t.*/
+} ser_ble_gap_app_keyset_t;
+
+/**@brief Allocates the instance in m_app_keys_table[] for storage of encryption keys.
+ *
+ * @param[in] conn_handle conn_handle
+ * @param[out] p_index Pointer to the index of the allocated instance.
+ *
+ * @retval NRF_SUCCESS Context allocated.
+ * @retval NRF_ERROR_NO_MEM No free instance available.
+ */
+uint32_t app_ble_gap_sec_context_create(uint16_t conn_handle, uint32_t *p_index);
+
+/**@brief Release the instance identified by a connection handle.
+ *
+ * @param[in] conn_handle conn_handle
+ *
+ * @retval NRF_SUCCESS Context released.
+ * @retval NRF_ERROR_NOT_FOUND Instance with conn_handle not found.
+ */
+uint32_t app_ble_gap_sec_context_destroy(uint16_t conn_handle);
+
+/**@brief Finds index of instance identified by a connection handle in m_app_keys_table[].
+ *
+ * @param[in] conn_handle conn_handle
+ *
+ * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle.
+ *
+ * @retval NRF_SUCCESS Context found.
+ * @retval NRF_ERROR_NOT_FOUND Instance with conn_handle not found.
+ */
+uint32_t app_ble_gap_sec_context_find(uint16_t conn_handle, uint32_t *p_index);
+/** @} */
+
+#if NRF_SD_BLE_API_VERSION >= 6
+/**
+ * @brief Stores buffer for adv report data.
+ *
+ * @param p_data Pointer to the buffer.
+ *
+ * @return NRF_SUCCESS or error in case pointer is already set.
+ */
+uint32_t app_ble_gap_scan_data_set(ble_data_t const * p_data);
+
+/**
+ * @brief Returns pointer to the buffer for storing report data. Returns error if not paired with
+ * @ref app_ble_gap_scan_data_set call.
+ *
+ * @param[out] p_data Stored data.
+ * @return NRF_SUCCESS or error in case pointer is already cleared.
+ */
+uint32_t app_ble_gap_scan_data_fetch_clear(ble_data_t * p_data);
+
+/**
+ * @brief Function for registering data pointers related with given adv_handle.
+ *
+ * @param adv_handle Handle.
+ * @param p_adv_data Adv_data buffer.
+ * @param p_scan_rsp_data Scan_rsp_data buffer.
+ *
+ * @return NRF_SUCCESS or error.
+ *
+ */
+uint32_t app_ble_gap_adv_set_register(uint8_t adv_handle, uint8_t * p_adv_data, uint8_t * p_scan_rsp_data);
+
+
+/**
+ * @brief Function for unregistering given .
+ *
+ * @param[in] adv_handle Handle.
+ * @param[out] pp_adv_data Pointer to adv_data buffer associated with given adv_handle.
+ * @param[out] pp_scan_rsp_data Pointer to adv_data buffer associated with given adv_handle.
+ *
+ * @return NRF_SUCCESS or error.
+ *
+ */
+uint32_t app_ble_gap_adv_set_unregister(uint8_t adv_handle, uint8_t * * pp_adv_data, uint8_t **pp_scan_rsp_data);
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_APP_BLE_GAP_SEC_KEYS_H
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.c
new file mode 100644
index 0000000..dcb1371
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.c
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 "app_ble_user_mem.h"
+#include "ser_config.h"
+#include "nrf_error.h"
+#include <stddef.h>
+
+ser_ble_user_mem_t m_app_user_mem_table[SER_MAX_CONNECTIONS];
+
+uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index)
+{
+ uint32_t err_code = NRF_ERROR_NO_MEM;
+ uint32_t i;
+
+ for (i=0; i<SER_MAX_CONNECTIONS; i++ )
+ {
+ if ( ! m_app_user_mem_table[i].conn_active )
+ {
+ m_app_user_mem_table[i].conn_active = 1;
+ m_app_user_mem_table[i].conn_handle = conn_handle;
+ *p_index = i;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+
+ return err_code;
+}
+
+uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle)
+{
+ uint32_t err_code = NRF_ERROR_NOT_FOUND;
+ uint32_t i;
+
+ for (i=0; i<SER_MAX_CONNECTIONS; i++ )
+ {
+ if ( m_app_user_mem_table[i].conn_handle == conn_handle )
+ {
+ m_app_user_mem_table[i].conn_active = 0;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+
+ return err_code;
+}
+
+uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index)
+{
+ uint32_t err_code = NRF_ERROR_NOT_FOUND;
+ uint32_t i;
+
+ for (i=0; i<SER_MAX_CONNECTIONS; i++ )
+ {
+ if ( (m_app_user_mem_table[i].conn_handle == conn_handle) && (m_app_user_mem_table[i].conn_active == 1) )
+ {
+ *p_index = i;
+ err_code = NRF_SUCCESS;
+ break;
+ }
+ }
+
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.h
new file mode 100644
index 0000000..ac95b01
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/app_ble_user_mem.h
@@ -0,0 +1,109 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef _APP_BLE_USER_MEM_H
+#define _APP_BLE_USER_MEM_H
+
+
+ /**@file
+ *
+ * @defgroup app_ble_user_mem Functions for managing memory for user memory request in the application device.
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief Application auxiliary functions for synchronizing user memory with the one stored in the connectivity device.
+ */
+
+#include "ble.h"
+#include "ser_config.h"
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Connection - user memory mapping structure.
+ *
+ * @note This structure is used to map user memory to connection instances and store it in a static table.
+ */
+//lint -esym(452,ser_ble_user_mem_t)
+typedef struct
+{
+ uint16_t conn_handle; /**< Connection handle. */
+ uint8_t conn_active; /**< Indication that user memory for this connection is used by the SoftDevice. 0: memory used; 1: memory not used. */
+ ble_user_mem_block_t mem_block; /**< User memory block structure, see @ref ble_user_mem_block_t. */
+} ser_ble_user_mem_t;
+
+/**@brief Allocates instance in m_user_mem_table[] for storage.
+ *
+ * @param[in] conn_handle conn_handle
+ * @param[out] p_index Pointer to the index of the allocated instance.
+ *
+ * @retval NRF_SUCCESS Context allocated.
+ * @retval NRF_ERROR_NO_MEM No free instance available.
+ */
+uint32_t app_ble_user_mem_context_create(uint16_t conn_handle, uint32_t *p_index);
+
+/**@brief Release instance identified by a connection handle.
+ *
+ * @param[in] conn_handle conn_handle
+ *
+ * @retval NRF_SUCCESS Context released.
+ * @retval NRF_ERROR_NOT_FOUND Instance with conn_handle not found.
+ */
+uint32_t app_ble_user_mem_context_destroy(uint16_t conn_handle);
+
+/**@brief Finds index of the instance identified by a connection handle in m_user_mem_table[].
+ *
+ * @param[in] conn_handle conn_handle
+ *
+ * @param[out] p_index Pointer to the index of the entry in the context table corresponding to the given conn_handle.
+ *
+ * @retval NRF_SUCCESS Context found.
+ * @retval NRF_ERROR_NOT_FOUND Instance with conn_handle not found.
+ */
+uint32_t app_ble_user_mem_context_find(uint16_t conn_handle, uint32_t *p_index);
+/** @} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //_APP_BLE_USER_MEM_H
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.c
new file mode 100644
index 0000000..fcc71ab
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.c
@@ -0,0 +1,513 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "ble_app.h"
+#include "ble_serialization.h"
+#include "ble_struct_serialization.h"
+#include "ble_gap_struct_serialization.h"
+#include "ble_gatt_struct_serialization.h"
+#include "ble_gattc_struct_serialization.h"
+#include "ble_gatts_struct_serialization.h"
+#include "ble_l2cap_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_ENABLE);
+ SER_PUSH_COND(p_ble_enable_params, ble_enable_params_t_enc);
+ SER_REQ_ENC_END;
+}
+#else
+uint32_t ble_enable_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_ENABLE);
+ SER_REQ_ENC_END;
+}
+#endif
+
+uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_ENABLE);
+}
+
+uint32_t ble_opt_get_req_enc(uint32_t opt_id,
+ ble_opt_t const * const p_opt,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_OPT_GET);
+
+ SER_PUSH_uint32(&opt_id);
+ SER_PUSH_COND(p_opt, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_opt_id,
+ ble_opt_t * const p_opt,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_OPT_GET);
+
+ SER_PULL_uint32(p_opt_id);
+
+ field_decoder_handler_t fp_decoder = NULL;
+ void * p_struct = NULL;
+
+ switch (*p_opt_id)
+ {
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_COMMON_OPT_CONN_BW:
+ fp_decoder = ble_common_opt_conn_bw_t_dec;
+ p_struct = &(p_opt->common_opt.conn_bw);
+ break;
+#endif
+ case BLE_COMMON_OPT_PA_LNA:
+ fp_decoder = ble_common_opt_pa_lna_t_dec;
+ p_struct = &(p_opt->common_opt.pa_lna);
+ break;
+ case BLE_COMMON_OPT_CONN_EVT_EXT:
+ fp_decoder = ble_common_opt_conn_evt_ext_t_dec;
+ p_struct = &(p_opt->common_opt.conn_evt_ext);
+ break;
+ case BLE_GAP_OPT_CH_MAP:
+ fp_decoder = ble_gap_opt_ch_map_t_dec;
+ p_struct =&(p_opt->gap_opt.ch_map);
+ break;
+ case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
+ fp_decoder = ble_gap_opt_local_conn_latency_t_dec;
+ p_struct = &(p_opt->gap_opt.local_conn_latency);
+ break;
+ case BLE_GAP_OPT_PASSKEY:
+ fp_decoder = ble_gap_opt_passkey_t_dec;
+ p_struct = &(p_opt->gap_opt.passkey);
+ break;
+ case BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT:
+ fp_decoder = ble_gap_opt_auth_payload_timeout_t_dec;
+ p_struct = &(p_opt->gap_opt.auth_payload_timeout);
+ break;
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_GAP_OPT_EXT_LEN:
+ fp_decoder = ble_gap_opt_ext_len_t_dec;
+ p_struct = &(p_opt->gap_opt.ext_len);
+ break;
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 6
+ case BLE_GAP_OPT_SCAN_REQ_REPORT:
+ fp_decoder = ble_gap_opt_scan_req_report_t_dec;
+ p_struct = &(p_opt->gap_opt.scan_req_report);
+ break;
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_GAP_OPT_COMPAT_MODE:
+ fp_decoder = ble_gap_opt_compat_mode_t_dec;
+ p_struct = &(p_opt->gap_opt.compat_mode);
+ break;
+#else
+#ifndef S112
+ case BLE_GAP_OPT_COMPAT_MODE_1:
+ fp_decoder = ble_gap_opt_compat_mode_1_t_dec;
+ p_struct = &(p_opt->gap_opt.compat_mode_1);
+ break;
+#endif
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION == 4
+ case BLE_GAP_OPT_COMPAT_MODE_2:
+ fp_decoder = ble_gap_opt_compat_mode_2_t_dec;
+ p_struct = &(p_opt->gap_opt.compat_mode_2);
+ break;
+#endif
+ default:
+ SER_ASSERT(NRF_ERROR_INVALID_PARAM, NRF_ERROR_INVALID_PARAM);
+ break;
+ }
+
+ SER_PULL_FIELD(p_struct, fp_decoder);
+
+ SER_RSP_DEC_END;
+}
+
+
+
+uint32_t ble_opt_set_req_enc(uint32_t const opt_id,
+ ble_opt_t const * const p_opt,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_OPT_SET);
+
+ SER_PUSH_uint32(&opt_id);
+
+ field_encoder_handler_t fp_encoder = NULL;
+ void const * p_struct = NULL;
+
+ SER_PUSH_COND(p_opt, NULL);
+ if (p_opt)
+ {
+ switch (opt_id)
+ {
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_COMMON_OPT_CONN_BW:
+ fp_encoder = ble_common_opt_conn_bw_t_enc;
+ p_struct = &(p_opt->common_opt.conn_bw);
+ break;
+#endif
+ case BLE_COMMON_OPT_PA_LNA:
+ fp_encoder = ble_common_opt_pa_lna_t_enc;
+ p_struct = &(p_opt->common_opt.pa_lna);
+ break;
+ case BLE_COMMON_OPT_CONN_EVT_EXT:
+ fp_encoder = ble_common_opt_conn_evt_ext_t_enc;
+ p_struct = &(p_opt->common_opt.conn_evt_ext);
+ break;
+ case BLE_GAP_OPT_CH_MAP:
+ fp_encoder = ble_gap_opt_ch_map_t_enc;
+ p_struct = &(p_opt->gap_opt.ch_map);
+ break;
+ case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
+ fp_encoder = ble_gap_opt_local_conn_latency_t_enc;
+ p_struct = &(p_opt->gap_opt.local_conn_latency);
+ break;
+ case BLE_GAP_OPT_PASSKEY:
+ fp_encoder = ble_gap_opt_passkey_t_enc;
+ p_struct = &(p_opt->gap_opt.passkey);
+ break;
+ case BLE_GAP_OPT_AUTH_PAYLOAD_TIMEOUT:
+ fp_encoder = ble_gap_opt_auth_payload_timeout_t_enc;
+ p_struct = &(p_opt->gap_opt.auth_payload_timeout);
+ break;
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_GAP_OPT_EXT_LEN:
+ fp_encoder = ble_gap_opt_ext_len_t_enc;
+ p_struct = &(p_opt->gap_opt.ext_len);
+ break;
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 6
+ case BLE_GAP_OPT_SCAN_REQ_REPORT:
+ fp_encoder = ble_gap_opt_scan_req_report_t_enc;
+ p_struct = &(p_opt->gap_opt.scan_req_report);
+ break;
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_GAP_OPT_COMPAT_MODE:
+ fp_encoder = ble_gap_opt_compat_mode_t_enc;
+ p_struct = &(p_opt->gap_opt.compat_mode);
+ break;
+#else
+#ifndef S112
+ case BLE_GAP_OPT_COMPAT_MODE_1:
+ fp_encoder = ble_gap_opt_compat_mode_1_t_enc;
+ p_struct = &(p_opt->gap_opt.compat_mode_1);
+ break;
+#endif
+ case BLE_GAP_OPT_SLAVE_LATENCY_DISABLE:
+ fp_encoder = ble_gap_opt_slave_latency_disable_t_enc;
+ p_struct = &(p_opt->gap_opt.slave_latency_disable);
+ break;
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION == 4
+ case BLE_GAP_OPT_COMPAT_MODE_2:
+ fp_encoder = ble_gap_opt_compat_mode_2_t_enc;
+ p_struct = &(p_opt->gap_opt.compat_mode_2);
+ break;
+#endif
+ default:
+ SER_ASSERT(NRF_ERROR_INVALID_PARAM,NRF_ERROR_INVALID_PARAM);
+ break;
+ }
+
+ SER_PUSH_FIELD(p_struct, fp_encoder);
+ }
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_OPT_SET);
+}
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+uint32_t ble_tx_packet_count_get_req_enc(uint16_t conn_handle,
+ uint8_t const * const p_count,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_TX_PACKET_COUNT_GET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_count, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_tx_packet_count_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * * const pp_count,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_TX_PACKET_COUNT_GET);
+ SER_PULL_COND(pp_count, uint8_t_dec);
+ SER_RSP_DEC_END;
+}
+#endif
+
+uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle,
+ ble_user_mem_block_t const * p_block,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_USER_MEM_REPLY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_block, ble_user_mem_block_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_USER_MEM_REPLY);
+}
+
+
+
+uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len,
+ uint8_t const * const p_uuid_le,
+ ble_uuid_t * const p_uuid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_UUID_DECODE);
+
+ SER_PUSH_len8data(p_uuid_le, uuid_le_len);
+ SER_PUSH_COND(p_uuid, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_uuid_t * * const pp_uuid,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_UUID_DECODE);
+ SER_PULL_COND(pp_uuid, ble_uuid_t_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid,
+ uint8_t const * const p_uuid_le_len,
+ uint8_t const * const p_uuid_le,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_UUID_ENCODE);
+
+ SER_PUSH_COND(p_uuid, ble_uuid_t_enc);
+ SER_PUSH_COND(p_uuid_le_len, NULL);
+ SER_PUSH_COND(p_uuid_le, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * const p_uuid_le_len,
+ uint8_t * const p_uuid_le,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_UUID_ENCODE);
+
+ uint8_t uuid_le_len;
+ SER_PULL_uint8(&uuid_le_len);
+ if (p_uuid_le_len)
+ {
+ *p_uuid_le_len = uuid_le_len;
+ if (p_uuid_le)
+ {
+ SER_PULL_uint8array(p_uuid_le, uuid_le_len);
+ }
+ }
+
+ SER_RSP_DEC_END;
+}
+
+uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid,
+ uint8_t * const p_uuid_type,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_UUID_VS_ADD);
+
+ SER_PUSH_COND(p_vs_uuid, ble_uuid128_t_enc);
+ SER_PUSH_COND(p_uuid_type, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * * const pp_uuid_type,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_UUID_VS_ADD);
+
+ SER_ASSERT_NOT_NULL(pp_uuid_type);
+ SER_PULL_COND(pp_uuid_type, uint8_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+uint32_t ble_version_get_req_enc(ble_version_t const * const p_version,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_VERSION_GET);
+ SER_PUSH_COND(p_version, NULL);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_version_t * p_version,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_VERSION_GET);
+ SER_PULL_FIELD(p_version, ble_version_t_dec);
+ SER_RSP_DEC_END;
+}
+#if NRF_SD_BLE_API_VERSION >= 4
+uint32_t ble_cfg_set_req_enc(uint32_t cfg_id,
+ ble_cfg_t const * p_cfg,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_CFG_SET);
+ SER_PUSH_uint32(&cfg_id);
+ field_encoder_handler_t fp_encoder = NULL;
+ void const * p_struct = NULL;
+
+ SER_PUSH_COND(p_cfg, NULL);
+ if (p_cfg)
+ {
+
+ switch (cfg_id)
+ {
+ case BLE_CONN_CFG_GAP:
+ fp_encoder = ble_gap_conn_cfg_t_enc;
+ p_struct = &(p_cfg->conn_cfg.params.gap_conn_cfg);
+ break;
+ case BLE_CONN_CFG_GATTC:
+ fp_encoder = ble_gattc_conn_cfg_t_enc;
+ p_struct = &(p_cfg->conn_cfg.params.gattc_conn_cfg);
+ break;
+ case BLE_CONN_CFG_GATTS:
+ fp_encoder = ble_gatts_conn_cfg_t_enc;
+ p_struct = &(p_cfg->conn_cfg.params.gatts_conn_cfg);
+ break;
+ case BLE_CONN_CFG_GATT:
+ fp_encoder = ble_gatt_conn_cfg_t_enc;
+ p_struct = &(p_cfg->conn_cfg.params.gatt_conn_cfg);
+ break;
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION >= 5 && !defined(S112)
+ case BLE_CONN_CFG_L2CAP:
+ fp_encoder = ble_l2cap_conn_cfg_t_enc;
+ p_struct = &(p_cfg->conn_cfg.params.l2cap_conn_cfg);
+ break;
+#endif
+ case BLE_COMMON_CFG_VS_UUID:
+ fp_encoder = ble_common_cfg_vs_uuid_t_enc;
+ p_struct = &(p_cfg->common_cfg.vs_uuid_cfg);
+ break;
+ case BLE_GAP_CFG_ROLE_COUNT:
+ fp_encoder = ble_gap_cfg_role_count_t_enc;
+ p_struct = &(p_cfg->gap_cfg.role_count_cfg);
+ break;
+ case BLE_GAP_CFG_DEVICE_NAME:
+ fp_encoder = ble_gap_cfg_device_name_t_enc;
+ p_struct = &(p_cfg->gap_cfg.device_name_cfg);
+ break;
+ case BLE_GATTS_CFG_SERVICE_CHANGED:
+ fp_encoder = ble_gatts_cfg_service_changed_t_enc;
+ p_struct = &(p_cfg->gatts_cfg.service_changed);
+ break;
+ case BLE_GATTS_CFG_ATTR_TAB_SIZE:
+ fp_encoder = ble_gatts_cfg_attr_tab_size_t_enc;
+ p_struct = &(p_cfg->gatts_cfg.attr_tab_size);
+ break;
+ }
+ if (cfg_id >= BLE_CONN_CFG_BASE && cfg_id <= BLE_CONN_CFG_GATT)
+ {
+ SER_PUSH_uint8(&p_cfg->conn_cfg.conn_cfg_tag);
+ }
+ SER_PUSH_FIELD(p_struct, fp_encoder);
+ }
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_cfg_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_CFG_SET);
+}
+#endif //NRF_SD_BLE_API_VERSION >= 4
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.h
new file mode 100644
index 0000000..a68cf0d
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_app.h
@@ -0,0 +1,523 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_APP_H__
+#define BLE_APP_H__
+
+/**
+ * @addtogroup ser_codecs Serialization codecs
+ * @ingroup ble_sdk_lib_serialization
+ */
+
+/**
+ * @addtogroup ser_app_s130_codecs Application codecs for S132 and S140
+ * @ingroup ser_codecs_app
+ */
+
+/**@file
+ *
+ * @defgroup ble_app Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief Application command request encoders and command response decoders.
+ */
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**
+ * @brief Encodes @ref sd_ble_tx_packet_count_get command request.
+ *
+ * @sa @ref ble_tx_packet_count_get_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_count Pointer to count value to be filled.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @note \p p_count will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_tx_packet_count_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_tx_packet_count_get_req_enc(uint16_t conn_handle,
+ uint8_t const * const p_count,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes a response to @ref sd_ble_tx_packet_count_get command.
+ *
+ * @sa @ref ble_tx_packet_count_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] pp_count Pointer to the pointer to count value.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_tx_packet_count_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * * const pp_count,
+ uint32_t * const p_result_code);
+#endif
+/**@brief Encodes the @ref sd_ble_uuid_encode command request.
+ *
+ * @sa @ref ble_uuid_encode_rsp_dec for command response decoder.
+ *
+ * @param[in] p_uuid Pointer to a @ref ble_uuid_t structure that will be encoded into bytes.
+ * @param[in] p_uuid_le_len Size of \p p_uuid_le, if \p p_uuid_le is not NULL
+ * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16)
+ * will be stored. Can be NULL to calculate the required size.
+ * @param[in] p_buf Pointer to a buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @note \p p_uuid_le_len and \p p_uuid_le will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_uuid_encode_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_uuid_encode_req_enc(ble_uuid_t const * const p_uuid,
+ uint8_t const * const p_uuid_le_len,
+ uint8_t const * const p_uuid_le,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes a response to the @ref sd_ble_uuid_encode command.
+ *
+ * @sa @ref ble_uuid_encode_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of a response packet.
+ * @param[in,out] p_uuid_le_len \c in: Size (in bytes) of \p p_uuid_le buffer.
+ * \c out: Length of decoded contents of \p p_uuid_le.
+ * @param[out] p_uuid_le Pointer to a buffer where the encoded UUID will be stored.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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 Length of \p p_uuid_le is too small to hold the decoded
+ * value from response.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match the expected
+ * operation code.
+ */
+uint32_t ble_uuid_encode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * const p_uuid_le_len,
+ uint8_t * const p_uuid_le,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_uuid_decode command request.
+ *
+ * @sa @ref ble_uuid_decode_rsp_dec for command response decoder.
+ *
+ * @param[in] uuid_le_len Size of \p p_uuid_le if \p p_uuid_le is not NULL.
+ * @param[in] p_uuid_le Pointer to a buffer where the little endian raw UUID bytes(2 or 16)
+ * are stored.
+ * @param[out] p_uuid Pointer to a @ref ble_uuid_t structure were the raw UUID will be decoded.
+ * @param[in] p_buf Pointer to the buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @note \p p_uuid will not be updated by the command request encoder.
+ * Updated values are set by @ref ble_uuid_decode_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_uuid_decode_req_enc(uint8_t uuid_le_len,
+ uint8_t const * const p_uuid_le,
+ ble_uuid_t * const p_uuid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes a response to the @ref sd_ble_uuid_decode command.
+ *
+ * @sa @ref ble_uuid_decode_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_uuid Pointer to a buffer where the decoded UUID will be stored.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match the expected
+ * operation code.
+ */
+uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_uuid_t * * const p_uuid,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes the @ref sd_ble_uuid_vs_add command request.
+ *
+ * @sa @ref ble_uuid_vs_add_rsp_dec for command response decoder.
+ *
+ * @param[in] p_vs_uuid Pointer to a @ref ble_uuid128_t structure.
+ * @param[in] p_uuid_type Pointer to uint8_t where UUID type will be returned.
+ * @param[in] p_buf Pointer to buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_uuid_type will not be updated by the command request encoder.
+ * Updated values are set by @ref ble_uuid_vs_add_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_uuid_vs_add_req_enc(ble_uuid128_t const * const p_vs_uuid,
+ uint8_t * const p_uuid_type,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to the @ref sd_ble_uuid_vs_add command.
+ *
+ * @sa @ref ble_uuid_vs_add_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of a response packet.
+ * @param[out] pp_uuid_type Pointer to a pointer to uint8_t where the decoded UUID type will be stored.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * * const pp_uuid_type,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes the @ref sd_ble_version_get command request.
+ *
+ * @sa @ref ble_version_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_version Pointer to a @ref ble_version_t structure to be filled by the response.
+ * @param[in] p_buf Pointer to a buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_version_get_req_enc(ble_version_t const * const p_version,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to the @ref sd_ble_version_get command.
+ *
+ * @sa @ref ble_version_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_version Pointer to a @ref ble_version_t where the decoded version will be stored.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Version information stored successfully.
+ * @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 the decoded event.
+ */
+uint32_t ble_version_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_version_t * p_version,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes the @ref sd_ble_opt_set command request.
+ *
+ * @sa @ref ble_opt_set_rsp_dec for command response decoder.
+ *
+ * @param[in] opt_id Identifies type of parameter in ble_opt_t union.
+ * @param[in] p_opt Pointer to the ble_opt_t union.
+ * @param[in] p_buf Pointer to a buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+uint32_t ble_opt_set_req_enc(uint32_t const opt_id,
+ ble_opt_t const * const p_opt,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to the @ref sd_ble_opt_set command.
+ *
+ * @sa @ref ble_opt_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Version information stored successfully.
+ * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
+ */
+uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**@brief Encodes the @ref sd_ble_enable command request.
+ *
+ * @sa @ref ble_enable_rsp_dec for command response decoder.
+ *
+ * @param[in] p_ble_enable_params Pointer to the @ref ble_enable_params_t structure.
+ * @param[in] p_buf Pointer to the buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_enable_req_enc(ble_enable_params_t * p_ble_enable_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+#else
+/**@brief Encodes the @ref sd_ble_enable command request.
+ *
+ * @sa @ref ble_enable_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to the buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_enable_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+#endif
+
+/**@brief Decodes response to the @ref sd_ble_enable command.
+ *
+ * @sa @ref ble_enable_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Success.
+ * @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 the decoded event.
+ */
+uint32_t ble_enable_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+/**@brief Encodes the @ref sd_ble_opt_get command request.
+ *
+ * @sa @ref ble_opt_get_rsp_dec for command response decoder.
+ *
+ * @param[in] opt_id Identifies the type of parameter in the ble_opt_t union.
+ * @param[in] p_opt Pointer to the @ref ble_opt_t union to be filled by the response.
+ * @param[in] p_buf Pointer to the buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+uint32_t ble_opt_get_req_enc(uint32_t opt_id,
+ ble_opt_t const * const p_opt,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to the @ref sd_ble_opt_get command.
+ *
+ * @sa @ref ble_opt_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_opt_id Pointer to the decoded opt_id.
+ * @param[out] p_opt Pointer to the decoded @ref ble_opt_t union.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Opt stored successfully.
+ * @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 the decoded event.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+
+uint32_t ble_opt_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_opt_id,
+ ble_opt_t * const p_opt,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes the @ref sd_ble_user_mem_reply command request.
+ *
+ * @sa @ref ble_user_mem_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_block Pointer to the @ref ble_user_mem_block_t structure.
+ * @param[in] p_buf Pointer to the buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+uint32_t ble_user_mem_reply_req_enc(uint16_t conn_handle,
+ ble_user_mem_block_t const * p_block,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to the @ref sd_ble_user_mem_reply command.
+ *
+ * @sa @ref ble_user_mem_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Opt stored successfully.
+ * @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 the decoded event.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+uint32_t ble_user_mem_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#if NRF_SD_BLE_API_VERSION >= 4
+/**@brief Encodes the @ref sd_ble_cfg_set command request.
+ *
+ * @sa @ref ble_cfg_set_rsp_dec for command response decoder.
+ *
+ * @param[in] cfg_id Configuratio id.
+ * @param[in] p_cfg Pointer to the configuration.
+ * @param[in] p_buf Pointer to the buffer where the encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+uint32_t ble_cfg_set_req_enc(uint32_t cfg_id,
+ ble_cfg_t const * p_cfg,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to the @ref sd_ble_cfg_set command.
+ *
+ * @sa @ref ble_cfg_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Opt stored successfully.
+ * @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 the decoded event.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid opt id.
+ */
+uint32_t ble_cfg_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#endif //NRF_SD_BLE_API_VERSION >= 4
+
+/**@brief Event decoding dispatcher.
+ *
+ * The event decoding dispatcher will route the event packet to the correct decoder, which in turn
+ * decodes the contents of the event and updates the \p p_event struct.
+ *
+ * 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 the event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to the \ref ble_evt_t buffer where the decoded event will be
+ * stored. If NULL, the 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 the 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 the decoded event.
+ * @retval NRF_ERROR_NOT_FOUND Decoding failure. No event decoder is available.
+ */
+uint32_t ble_event_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
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_event.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_event.c
new file mode 100644
index 0000000..e32a905
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_event.c
@@ -0,0 +1,316 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_serialization.h"
+#include "ble_app.h"
+#include "ble_evt_app.h"
+#include "ble_gap_evt_app.h"
+#include "ble_gattc_evt_app.h"
+#include "ble_gatts_evt_app.h"
+#include "ble_l2cap_evt_app.h"
+#include "app_util.h"
+
+uint32_t ble_event_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 err_code;
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_event_len);
+ SER_ASSERT_LENGTH_LEQ(SER_EVT_HEADER_SIZE, packet_len);
+ SER_ASSERT_NOT_NULL(p_event);
+ SER_ASSERT_LENGTH_LEQ(sizeof (ble_evt_hdr_t), *p_event_len);
+ *p_event_len -= sizeof (ble_evt_hdr_t);
+
+ const uint16_t event_id = uint16_decode(&p_buf[SER_EVT_ID_POS]);
+ const uint8_t * p_sub_buffer = &p_buf[SER_EVT_HEADER_SIZE];
+ const uint32_t sub_packet_len = packet_len - SER_EVT_HEADER_SIZE;
+
+ uint32_t (*fp_event_decoder)(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len) = NULL;
+
+ switch (event_id)
+ {
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_EVT_TX_COMPLETE:
+ fp_event_decoder = ble_evt_tx_complete_dec;
+ break;
+ case BLE_EVT_DATA_LENGTH_CHANGED:
+ fp_event_decoder = ble_evt_data_length_changed_dec;
+ break;
+#endif
+ case BLE_EVT_USER_MEM_REQUEST:
+ fp_event_decoder = ble_evt_user_mem_request_dec;
+ break;
+
+ case BLE_EVT_USER_MEM_RELEASE:
+ fp_event_decoder = ble_evt_user_mem_release_dec;
+ break;
+
+
+ case BLE_GAP_EVT_PASSKEY_DISPLAY:
+ fp_event_decoder = ble_gap_evt_passkey_display_dec;
+ break;
+
+ case BLE_GAP_EVT_AUTH_KEY_REQUEST:
+ fp_event_decoder = ble_gap_evt_auth_key_request_dec;
+ break;
+
+ case BLE_GAP_EVT_CONN_PARAM_UPDATE:
+ fp_event_decoder = ble_gap_evt_conn_param_update_dec;
+ break;
+
+#ifndef S112
+ case BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST:
+ fp_event_decoder = ble_gap_evt_conn_param_update_request_dec;
+ break;
+#endif
+ case BLE_GAP_EVT_CONN_SEC_UPDATE:
+ fp_event_decoder = ble_gap_evt_conn_sec_update_dec;
+ break;
+
+ case BLE_GAP_EVT_CONNECTED:
+ fp_event_decoder = ble_gap_evt_connected_dec;
+ break;
+
+ case BLE_GAP_EVT_DISCONNECTED:
+ fp_event_decoder = ble_gap_evt_disconnected_dec;
+ break;
+
+ case BLE_GAP_EVT_TIMEOUT:
+ fp_event_decoder = ble_gap_evt_timeout_dec;
+ break;
+
+ case BLE_GAP_EVT_RSSI_CHANGED:
+ fp_event_decoder = ble_gap_evt_rssi_changed_dec;
+ break;
+
+ case BLE_GAP_EVT_SEC_INFO_REQUEST:
+ fp_event_decoder = ble_gap_evt_sec_info_request_dec;
+ break;
+
+ case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
+ fp_event_decoder = ble_gap_evt_sec_params_request_dec;
+ break;
+
+ case BLE_GAP_EVT_AUTH_STATUS:
+ fp_event_decoder = ble_gap_evt_auth_status_dec;
+ break;
+
+ case BLE_GAP_EVT_SEC_REQUEST:
+ fp_event_decoder = ble_gap_evt_sec_request_dec;
+ break;
+
+ case BLE_GAP_EVT_KEY_PRESSED:
+ fp_event_decoder = ble_gap_evt_key_pressed_dec;
+ break;
+
+ case BLE_GAP_EVT_LESC_DHKEY_REQUEST:
+ fp_event_decoder = ble_gap_evt_lesc_dhkey_request_dec;
+ break;
+#if NRF_SD_BLE_API_VERSION >= 5
+ case BLE_GAP_EVT_PHY_UPDATE:
+ fp_event_decoder = ble_gap_evt_phy_update_dec;
+ break;
+ case BLE_GAP_EVT_PHY_UPDATE_REQUEST:
+ fp_event_decoder = ble_gap_evt_phy_update_request_dec;
+ break;
+#endif
+#if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
+ case BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST:
+ fp_event_decoder = ble_gap_evt_data_length_update_request_dec;
+ break;
+ case BLE_GAP_EVT_DATA_LENGTH_UPDATE:
+ fp_event_decoder = ble_gap_evt_data_length_update_dec;
+ break;
+#endif
+ case BLE_GATTC_EVT_CHAR_DISC_RSP:
+ fp_event_decoder = ble_gattc_evt_char_disc_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP:
+ fp_event_decoder = ble_gattc_evt_char_val_by_uuid_read_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_DESC_DISC_RSP:
+ fp_event_decoder = ble_gattc_evt_desc_disc_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP:
+ fp_event_decoder = ble_gattc_evt_prim_srvc_disc_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_READ_RSP:
+ fp_event_decoder = ble_gattc_evt_read_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_HVX:
+ fp_event_decoder = ble_gattc_evt_hvx_dec;
+ break;
+
+ case BLE_GATTC_EVT_TIMEOUT:
+ fp_event_decoder = ble_gattc_evt_timeout_dec;
+ break;
+
+ case BLE_GATTC_EVT_WRITE_RSP:
+ fp_event_decoder = ble_gattc_evt_write_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_CHAR_VALS_READ_RSP:
+ fp_event_decoder = ble_gattc_evt_char_vals_read_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_REL_DISC_RSP:
+ fp_event_decoder = ble_gattc_evt_rel_disc_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_ATTR_INFO_DISC_RSP:
+ fp_event_decoder = ble_gattc_evt_attr_info_disc_rsp_dec;
+ break;
+
+ case BLE_GATTC_EVT_EXCHANGE_MTU_RSP:
+ fp_event_decoder = ble_gattc_evt_exchange_mtu_rsp_dec;
+ break;
+#if NRF_SD_BLE_API_VERSION >= 4
+ case BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE:
+ fp_event_decoder = ble_gattc_evt_write_cmd_tx_complete_dec;
+ break;
+#endif
+ case BLE_GATTS_EVT_WRITE:
+ fp_event_decoder = ble_gatts_evt_write_dec;
+ break;
+
+ case BLE_GATTS_EVT_TIMEOUT:
+ fp_event_decoder = ble_gatts_evt_timeout_dec;
+ break;
+
+ case BLE_GATTS_EVT_SC_CONFIRM:
+ fp_event_decoder = ble_gatts_evt_sc_confirm_dec;
+ break;
+
+ case BLE_GATTS_EVT_HVC:
+ fp_event_decoder = ble_gatts_evt_hvc_dec;
+ break;
+
+ case BLE_GATTS_EVT_SYS_ATTR_MISSING:
+ fp_event_decoder = ble_gatts_evt_sys_attr_missing_dec;
+ break;
+
+ case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
+ fp_event_decoder = ble_gatts_evt_rw_authorize_request_dec;
+ break;
+
+ case BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST:
+ fp_event_decoder = ble_gatts_evt_exchange_mtu_request_dec;
+ break;
+#if NRF_SD_BLE_API_VERSION >= 4
+ case BLE_GATTS_EVT_HVN_TX_COMPLETE:
+ fp_event_decoder = ble_gatts_evt_hvn_tx_complete_dec;
+ break;
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+ case BLE_L2CAP_EVT_RX:
+ fp_event_decoder = ble_l2cap_evt_rx_dec;
+ break;
+#endif
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION >= 5 && !defined(S112)
+ case BLE_L2CAP_EVT_CH_SETUP_REQUEST:
+ fp_event_decoder = ble_l2cap_evt_ch_setup_request_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_SETUP_REFUSED:
+ fp_event_decoder = ble_l2cap_evt_ch_setup_refused_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_SETUP:
+ fp_event_decoder = ble_l2cap_evt_ch_setup_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_RELEASED:
+ fp_event_decoder = ble_l2cap_evt_ch_released_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_SDU_BUF_RELEASED:
+ fp_event_decoder = ble_l2cap_evt_ch_sdu_buf_released_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_CREDIT:
+ fp_event_decoder = ble_l2cap_evt_ch_credit_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_RX:
+ fp_event_decoder = ble_l2cap_evt_ch_rx_dec;
+ break;
+
+ case BLE_L2CAP_EVT_CH_TX:
+ fp_event_decoder = ble_l2cap_evt_ch_tx_dec;
+ break;
+
+#endif
+#ifndef S112
+ case BLE_GAP_EVT_ADV_REPORT:
+ fp_event_decoder = ble_gap_evt_adv_report_dec;
+ break;
+#endif
+ case BLE_GAP_EVT_SCAN_REQ_REPORT:
+ fp_event_decoder = ble_gap_evt_scan_req_report_dec;
+ break;
+ default:
+ break;
+ }
+
+ if (fp_event_decoder)
+ {
+ err_code = fp_event_decoder(p_sub_buffer, sub_packet_len, p_event, p_event_len);
+ }
+ else
+ {
+ err_code = NRF_ERROR_NOT_FOUND;
+ }
+
+ *p_event_len += offsetof(ble_evt_t, evt);
+ p_event->header.evt_id = (err_code == NRF_SUCCESS) ? event_id : 0;
+ p_event->header.evt_len = (err_code == NRF_SUCCESS) ? (uint16_t)*p_event_len : 0;
+
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.c
new file mode 100644
index 0000000..a5964c6
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.c
@@ -0,0 +1,129 @@
+/**
+ * Copyright (c) 2015 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_serialization.h"
+#include "ble_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+#include "ble_evt_app.h"
+#include "app_ble_user_mem.h"
+
+
+// Helper definitions for common event type names to be compliant with
+// event serialization macros.
+#define ble_common_evt_tx_complete_t ble_evt_tx_complete_t
+#define ble_common_evt_user_mem_request_t ble_evt_user_mem_request_t
+#define ble_common_evt_user_mem_release_t ble_evt_user_mem_release_t
+#define ble_common_evt_data_length_changed_t ble_evt_data_length_changed_t
+
+
+extern ser_ble_user_mem_t m_app_user_mem_table[];
+
+uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_EVT_USER_MEM_RELEASE, common, user_mem_release);
+
+ SER_PULL_uint16(&p_event->evt.common_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.common_evt.params.user_mem_release.type);
+ SER_PULL_uint16(&p_event->evt.common_evt.params.user_mem_release.mem_block.len);
+
+ //Set the memory pointer to not-null value.
+ p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem = (uint8_t *)~0;
+ SER_PULL_COND(&p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem, NULL);
+ if (p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem)
+ {
+ // Using connection handle find which mem block to release in Application Processor
+ uint32_t user_mem_table_index;
+ err_code = app_ble_user_mem_context_find(p_event->evt.common_evt.conn_handle, &user_mem_table_index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ p_event->evt.common_evt.params.user_mem_release.mem_block.p_mem =
+ m_app_user_mem_table[user_mem_table_index].mem_block.p_mem;
+ }
+
+ // Now user memory context can be released
+ err_code = app_ble_user_mem_context_destroy(p_event->evt.common_evt.conn_handle);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_evt_user_mem_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_EVT_USER_MEM_REQUEST, common, user_mem_request);
+
+ SER_PULL_uint16(&p_event->evt.common_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.common_evt.params.user_mem_request.type);
+
+ SER_EVT_DEC_END;
+}
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_EVT_TX_COMPLETE, common, tx_complete);
+
+ SER_PULL_uint16(&p_event->evt.common_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.common_evt.params.tx_complete.count);
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_evt_data_length_changed_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_EVT_DATA_LENGTH_CHANGED, common, data_length_changed);
+
+ SER_PULL_uint16(&p_event->evt.common_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.common_evt.params.data_length_changed, ble_evt_data_length_changed_t_dec);
+
+ SER_EVT_DEC_END;
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.h
new file mode 100644
index 0000000..67b6135
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_evt_app.h
@@ -0,0 +1,157 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_EVT_APP_H__
+#define BLE_EVT_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_evt_app Application event decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief Application event decoders.
+ */
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**
+ * @brief Decodes the ble_evt_tx_complete event.
+ *
+ * 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 the event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to the \ref ble_evt_t buffer where the decoded event will be
+ * stored. If NULL, the required length will be returned in \p p_event_len.
+ * @param[in,out] p_event_len \c in: Size (in bytes) of the \p p_event buffer.
+ * \c out: Length of the 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 the decoded event.
+ */
+uint32_t ble_evt_tx_complete_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#endif
+/**
+ * @brief Decodes the ble_evt_user_mem_request event.
+ *
+ * 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 the event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to the \ref ble_evt_t buffer where the decoded event will be
+ * stored. If NULL, the required length will be returned in \p p_event_len.
+ * @param[in,out] p_event_len \c in: Size (in bytes) of the \p p_event buffer.
+ * \c out: Length of the 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 the decoded event.
+ */
+uint32_t ble_evt_user_mem_request_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 the ble_evt_user_mem_release event.
+ *
+ * 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 the event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to the \ref ble_evt_t buffer where the decoded event will be
+ * stored. If NULL, the required length will be returned in \p p_event_len.
+ * @param[in,out] p_event_len \c in: Size (in bytes) of the \p p_event buffer.
+ * \c out: Length of the 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 the decoded event.
+ */
+uint32_t ble_evt_user_mem_release_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**
+ * @brief Decodes the ble_evt_data_length_changed event.
+ *
+ * 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 the event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to the \ref ble_evt_t buffer where the decoded event will be
+ * stored. If NULL, the required length will be returned in \p p_event_len.
+ * @param[in,out] p_event_len \c in: Size (in bytes) of the \p p_event buffer.
+ * \c out: Length of the 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 the decoded event.
+ */
+uint32_t ble_evt_data_length_changed_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#endif
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.c
new file mode 100644
index 0000000..ca227e0
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.c
@@ -0,0 +1,1019 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gap_app.h"
+#include <stdlib.h>
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gap_struct_serialization.h"
+#include "ble_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 6
+uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data,
+ uint8_t dlen,
+ uint8_t const * const p_sr_data,
+ uint8_t srdlen,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ADV_DATA_SET);
+
+ SER_PUSH_len8data(p_data, dlen);
+ SER_PUSH_len8data(p_sr_data, srdlen);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_ADV_DATA_SET);
+}
+#endif
+
+uint32_t ble_gap_adv_start_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t adv_handle,
+#else
+ ble_gap_adv_params_t const * const p_adv_params,
+#endif
+#if NRF_SD_BLE_API_VERSION >= 4
+ uint8_t conn_cfg_tag,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ADV_START);
+
+#if NRF_SD_BLE_API_VERSION > 5
+ SER_PUSH_uint8(&adv_handle);
+#else
+ SER_PUSH_COND(p_adv_params, ble_gap_adv_params_t_enc);
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 4
+ SER_PUSH_uint8(&conn_cfg_tag);
+#endif
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_ADV_START);
+}
+
+
+uint32_t ble_gap_adv_stop_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t adv_handle,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ADV_STOP);
+#if NRF_SD_BLE_API_VERSION > 5
+ SER_PUSH_uint8(&adv_handle);
+#endif
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_ADV_STOP);
+}
+
+
+
+uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_APPEARANCE_GET);
+ SER_PUSH_COND(p_appearance, NULL);
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_appearance,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_APPEARANCE_GET);
+ SER_PULL_COND(&p_appearance, uint16_t_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_APPEARANCE_SET);
+ SER_PUSH_uint16(&appearance);
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_APPEARANCE_SET);
+}
+
+
+uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle,
+ uint8_t key_type,
+ uint8_t const * const p_key,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_AUTH_KEY_REPLY);
+
+ uint8_t key_len;
+ switch (key_type)
+ {
+ case BLE_GAP_AUTH_KEY_TYPE_NONE:
+ key_len = 0;
+ break;
+
+ case BLE_GAP_AUTH_KEY_TYPE_PASSKEY:
+ key_len = 6;
+ break;
+
+ case BLE_GAP_AUTH_KEY_TYPE_OOB:
+ key_len = 16;
+ break;
+
+ default:
+ return NRF_ERROR_INVALID_PARAM;
+ }
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint8(&key_type);
+ SER_PUSH_buf(p_key, key_len);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_AUTH_KEY_REPLY);
+}
+
+
+
+uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle,
+ ble_gap_sec_params_t const * const p_sec_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_AUTHENTICATE);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_sec_params, ble_gap_sec_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_AUTHENTICATE);
+}
+
+
+uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle,
+ ble_gap_conn_params_t const * const p_conn_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_CONN_PARAM_UPDATE);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_conn_params, ble_gap_conn_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_CONN_PARAM_UPDATE);
+}
+
+
+uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle,
+ ble_gap_conn_sec_t const * const p_conn_sec,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_CONN_SEC_GET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_conn_sec, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_conn_sec_t * * const pp_conn_sec,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_CONN_SEC_GET);
+ SER_PULL_COND(pp_conn_sec, ble_gap_conn_sec_t_dec);
+ SER_RSP_DEC_END;
+}
+
+#ifndef S112
+uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr,
+ ble_gap_scan_params_t const * const p_scan_params,
+ ble_gap_conn_params_t const * const p_conn_params,
+#if NRF_SD_BLE_API_VERSION >= 4
+ uint8_t conn_cfg_tag,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_CONNECT);
+
+ SER_PUSH_COND(p_peer_addr, ble_gap_addr_t_enc);
+ SER_PUSH_COND(p_scan_params, ble_gap_scan_params_t_enc);
+ SER_PUSH_COND(p_conn_params, ble_gap_conn_params_t_enc);
+#if NRF_SD_BLE_API_VERSION >= 4
+ SER_PUSH_uint8(&conn_cfg_tag);
+#endif
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_CONNECT);
+}
+
+
+uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_CONNECT_CANCEL);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_CONNECT_CANCEL);
+}
+#endif
+
+uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name,
+ uint16_t const * const p_len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_DEVICE_NAME_GET);
+
+ SER_PUSH_COND(p_len, uint16_t_enc);
+ SER_PUSH_COND(p_dev_name, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * const p_dev_name,
+ uint16_t * const p_dev_name_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_DEVICE_NAME_GET);
+
+ SER_PULL_COND(&p_dev_name_len, uint16_t_dec);
+ if (p_dev_name_len)
+ {
+ SER_PULL_uint8array(p_dev_name, *p_dev_name_len);
+ }
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm,
+ uint8_t const * const p_dev_name,
+ uint16_t len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_DEVICE_NAME_SET);
+
+ SER_ERROR_CHECK(len <= BLE_GAP_DEVNAME_MAX_LEN, NRF_ERROR_INVALID_PARAM);
+
+ SER_PUSH_COND(p_write_perm, ble_gap_conn_sec_mode_t_enc);
+ SER_PUSH_len16data(p_dev_name, len);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_DEVICE_NAME_SET);
+}
+
+
+uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle,
+ uint8_t hci_status_code,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_DISCONNECT);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint8(&hci_status_code);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_DISCONNECT);
+}
+
+#ifndef S112
+uint32_t ble_gap_encrypt_req_enc(uint16_t conn_handle,
+ ble_gap_master_id_t const * const p_master_id,
+ ble_gap_enc_info_t const * const p_enc_info,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ENCRYPT);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_master_id, ble_gap_master_id_t_enc);
+ SER_PUSH_COND(p_enc_info, ble_gap_enc_info_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_ENCRYPT);
+}
+#endif
+
+uint32_t ble_gap_keypress_notify_req_enc(uint16_t conn_handle,
+ uint8_t kp_not,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_KEYPRESS_NOTIFY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint8(&kp_not);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_keypress_notify_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_KEYPRESS_NOTIFY);
+}
+
+
+uint32_t ble_gap_lesc_dhkey_reply_req_enc(uint16_t conn_handle,
+ ble_gap_lesc_dhkey_t const *p_dhkey,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_LESC_DHKEY_REPLY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_dhkey, ble_gap_lesc_dhkey_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_lesc_dhkey_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_LESC_DHKEY_REPLY);
+}
+
+
+uint32_t ble_gap_lesc_oob_data_get_req_enc(uint16_t conn_handle,
+ ble_gap_lesc_p256_pk_t const *p_pk_own,
+ ble_gap_lesc_oob_data_t *p_oobd_own,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_LESC_OOB_DATA_GET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_pk_own, ble_gap_lesc_p256_pk_t_enc);
+ SER_PUSH_COND(p_oobd_own, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_lesc_oob_data_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_lesc_oob_data_t * *pp_oobd_own,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_LESC_OOB_DATA_GET);
+ SER_PULL_COND(pp_oobd_own, ble_gap_lesc_oob_data_t_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gap_lesc_oob_data_set_req_enc(uint16_t conn_handle,
+ ble_gap_lesc_oob_data_t const *p_oobd_own,
+ ble_gap_lesc_oob_data_t const *p_oobd_peer,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_LESC_OOB_DATA_SET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_oobd_own, ble_gap_lesc_oob_data_t_enc);
+ SER_PUSH_COND(p_oobd_peer, ble_gap_lesc_oob_data_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_lesc_oob_data_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_LESC_OOB_DATA_SET);
+}
+
+
+uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_PPCP_GET);
+ SER_PUSH_COND(p_conn_params, NULL);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_conn_params_t * const p_conn_params,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_PPCP_GET);
+ SER_PULL_COND(&p_conn_params, ble_gap_conn_params_t_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_PPCP_SET);
+ SER_PUSH_COND(p_conn_params, ble_gap_conn_params_t_enc);
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_PPCP_SET);
+}
+
+uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle,
+ int8_t const * const p_rssi,
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t const * const p_ch_index,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_RSSI_GET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_rssi, NULL);
+#if NRF_SD_BLE_API_VERSION > 5
+ SER_PUSH_COND(p_ch_index, NULL);
+#endif
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ int8_t * const p_rssi,
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t * const p_ch_index,
+#endif
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_RSSI_GET);
+ SER_PULL_COND(&p_rssi, uint8_t_dec);
+#if NRF_SD_BLE_API_VERSION > 5
+ SER_PULL_COND(&p_ch_index, uint8_t_dec);
+#endif
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle,
+ uint8_t threshold_dbm,
+ uint8_t skip_count,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_RSSI_START);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint8(&threshold_dbm);
+ SER_PUSH_uint8(&skip_count);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_RSSI_START);
+}
+
+
+uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_RSSI_STOP);
+ SER_PUSH_uint16(&conn_handle);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_RSSI_STOP);
+}
+
+#ifndef S112
+uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params,
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ ble_data_t const * p_adv_report_buffer,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_SCAN_START);
+ SER_PUSH_COND(p_scan_params, ble_gap_scan_params_t_enc);
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ SER_PUSH_COND(p_adv_report_buffer, ble_data_t_enc);
+#endif
+ SER_REQ_ENC_END;
+}
+uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_SCAN_START);
+}
+
+
+uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_SCAN_STOP);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_SCAN_STOP);
+}
+#endif
+
+uint32_t ble_gap_sec_info_reply_req_enc(uint16_t conn_handle,
+ ble_gap_enc_info_t const * p_enc_info,
+ ble_gap_irk_t const * p_id_info,
+ ble_gap_sign_info_t const * p_sign_info,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_SEC_INFO_REPLY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_enc_info, ble_gap_enc_info_t_enc);
+ SER_PUSH_COND(p_id_info, ble_gap_irk_t_enc);
+ SER_PUSH_COND(p_sign_info, ble_gap_sign_info_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_SEC_INFO_REPLY);
+}
+
+
+uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle,
+ uint8_t sec_status,
+ ble_gap_sec_params_t const * const p_sec_params,
+ ble_gap_sec_keyset_t const * const p_sec_keyset,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_SEC_PARAMS_REPLY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint8(&sec_status);
+ SER_PUSH_COND(p_sec_params, ble_gap_sec_params_t_enc);
+ SER_PUSH_COND(p_sec_keyset, ble_gap_sec_keyset_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_sec_keyset_t const * const p_sec_keyset,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_SEC_PARAMS_REPLY);
+ SER_PULL_COND(&p_sec_keyset, ble_gap_sec_keyset_t_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gap_tx_power_set_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t role, uint16_t handle,
+#endif
+ int8_t tx_power,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_TX_POWER_SET);
+#if NRF_SD_BLE_API_VERSION > 5
+ SER_PUSH_uint8(&role);
+ SER_PUSH_uint16(&handle);
+#endif
+ SER_PUSH_int8(&tx_power);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_TX_POWER_SET);
+}
+
+uint32_t ble_gap_addr_get_req_enc(ble_gap_addr_t const * const p_address,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ADDR_GET);
+ SER_PUSH_COND(p_address, NULL);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_addr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_addr_t * const p_address,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_ADDR_GET);
+ SER_PULL_FIELD(p_address, ble_gap_addr_t_dec);
+ SER_RSP_DEC_END;
+}
+
+uint32_t ble_gap_addr_set_req_enc(ble_gap_addr_t const * const p_addr,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ADDR_SET);
+ SER_PUSH_COND(p_addr, ble_gap_addr_t_enc);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_addr_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_ADDR_SET);
+}
+
+uint32_t ble_gap_privacy_set_req_enc(ble_gap_privacy_params_t const * p_privacy_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_PRIVACY_SET);
+ SER_PUSH_COND(p_privacy_params, ble_gap_privacy_params_t_enc);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_privacy_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_PRIVACY_SET);
+}
+
+
+uint32_t ble_gap_privacy_get_req_enc(ble_gap_privacy_params_t const * const p_privacy_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_PRIVACY_GET);
+ SER_PUSH_COND(p_privacy_params, ble_gap_privacy_params_t_enc);
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_privacy_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_privacy_params_t const * const p_privacy_params,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_PRIVACY_GET);
+ SER_PULL_COND((void **)&p_privacy_params, ble_gap_privacy_params_t_dec);
+ SER_RSP_DEC_END;
+}
+
+uint32_t ble_gap_whitelist_set_req_enc(ble_gap_addr_t const * const * const pp_wl_addrs,
+ uint8_t const len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_WHITELIST_SET);
+
+ uint8_t presence;
+ SER_PUSH_uint8(&len);
+
+ if (pp_wl_addrs)
+ {
+ presence = SER_FIELD_PRESENT;
+ SER_PUSH_uint8(&presence);
+
+ for (uint32_t i = 0; i < len; ++i)
+ {
+ SER_PUSH_COND(pp_wl_addrs[i], ble_gap_addr_t_enc);
+ }
+ }
+ else
+ {
+ presence = SER_FIELD_NOT_PRESENT;
+ SER_PUSH_uint8(&presence);
+ }
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_whitelist_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_WHITELIST_SET);
+}
+
+uint32_t ble_gap_device_identities_set_req_enc(ble_gap_id_key_t const * const * const pp_id_keys,
+ ble_gap_irk_t const * const * const pp_local_irks,
+ uint8_t const len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_DEVICE_IDENTITIES_SET);
+ uint8_t presence;
+ SER_PUSH_uint8(&len);
+
+ if (pp_id_keys)
+ {
+ presence = SER_FIELD_PRESENT;
+ SER_PUSH_uint8(&presence);
+
+ for (uint32_t i = 0; i < len; ++i)
+ {
+ SER_PUSH_COND(pp_id_keys[i], ble_gap_id_key_t_enc);
+ }
+ }
+ else
+ {
+ presence = SER_FIELD_NOT_PRESENT;
+ SER_PUSH_uint8(&presence);
+ }
+
+ if (pp_local_irks)
+ {
+ presence = SER_FIELD_PRESENT;
+ SER_PUSH_uint8(&presence);
+
+ for (uint32_t i = 0; i < len; ++i)
+ {
+ SER_PUSH_COND(pp_local_irks[i], ble_gap_irk_t_enc);
+ }
+ }
+ else
+ {
+ presence = SER_FIELD_NOT_PRESENT;
+ SER_PUSH_uint8(&presence);
+ }
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gap_device_identities_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_DEVICE_IDENTITIES_SET);
+}
+#if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
+uint32_t ble_gap_data_length_update_req_enc(uint16_t conn_handle,
+ ble_gap_data_length_params_t const * p_dl_params,
+ ble_gap_data_length_limitation_t * p_dl_limitation,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_DATA_LENGTH_UPDATE);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_dl_params, ble_gap_data_length_params_t_enc);
+ SER_PUSH_COND(p_dl_limitation, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_data_length_update_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_data_length_limitation_t * p_dl_limitation,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_DATA_LENGTH_UPDATE);
+ SER_PULL_COND((void **)&p_dl_limitation, ble_gap_data_length_limitation_t_dec);
+ SER_RSP_DEC_END;
+}
+#endif
+#if NRF_SD_BLE_API_VERSION >= 5
+uint32_t ble_gap_phy_update_req_enc(uint16_t conn_handle,
+ ble_gap_phys_t const * p_gap_phys,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_PHY_UPDATE);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_gap_phys, ble_gap_phys_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_phy_update_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_PHY_UPDATE);
+}
+#endif
+
+#if NRF_SD_BLE_API_VERSION > 5
+uint32_t ble_gap_adv_set_configure_req_enc(uint8_t * p_adv_handle,
+ ble_gap_adv_data_t const * p_adv_data,
+ ble_gap_adv_params_t const *p_adv_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_ADV_SET_CONFIGURE);
+
+ SER_PUSH_COND(p_adv_handle, uint8_t_enc);
+ SER_PUSH_COND(p_adv_data, ble_gap_adv_data_t_enc);
+ SER_PUSH_COND(p_adv_params, ble_gap_adv_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_adv_set_configure_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * p_adv_handle,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GAP_ADV_SET_CONFIGURE);
+ SER_PULL_COND((void **)&p_adv_handle, uint8_t_dec);
+ SER_RSP_DEC_END;
+}
+
+#ifndef S112
+uint32_t ble_gap_qos_channel_survey_start_req_enc(uint32_t interval_us,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_QOS_CHANNEL_SURVEY_START);
+
+ SER_PUSH_uint32(&interval_us);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_qos_channel_survey_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_QOS_CHANNEL_SURVEY_START);
+}
+
+uint32_t ble_gap_qos_channel_survey_stop_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GAP_QOS_CHANNEL_SURVEY_STOP);
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gap_qos_channel_survey_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GAP_QOS_CHANNEL_SURVEY_STOP);
+}
+#endif //!S112
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.h
new file mode 100644
index 0000000..715a8df
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_app.h
@@ -0,0 +1,1667 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_GAP_APP_H__
+#define BLE_GAP_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_gap_app GAP Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GAP Application command request encoders and command response decoders.
+ */
+#include "ble.h"
+#include "ble_gap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(NRF_SD_BLE_API_VERSION) && (NRF_SD_BLE_API_VERSION <= 5)
+/**
+ * @brief Encodes @ref sd_ble_gap_adv_data_set command request.
+ *
+ * @sa @ref ble_gap_adv_data_set_rsp_dec for command response decoder.
+ *
+ * @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes
+ * are made to the current advertisement packet data.
+ * @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_SR_MAX_LEN_DEFAULT octets.
+ * Should be 0 if p_data is NULL, can be 0 if p_data is not NULL.
+ * @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL,
+ * no changes are made to the current scan response packet data.
+ * @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_SR_MAX_LEN_DEFAULT octets.
+ * Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_adv_data_set_req_enc(uint8_t const * const p_data,
+ uint8_t dlen,
+ uint8_t const * const p_sr_data,
+ uint8_t srdlen,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_adv_data_set command.
+ *
+ * @sa @ref ble_gap_adv_data_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_adv_data_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#endif
+
+/**
+ * @brief Encodes @ref sd_ble_gap_adv_start command request.
+ *
+ * @sa @ref ble_gap_adv_start_rsp_dec for command response decoder.
+ *
+ * @param[in] p_adv_params Pointer to advertising parameters structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_adv_start_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t adv_handle,
+#else
+ ble_gap_adv_params_t const * const p_adv_params,
+#endif
+#if NRF_SD_BLE_API_VERSION >= 4
+ uint8_t conn_cfg_tag,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_adv_start command.
+ *
+ * @sa @ref ble_gap_adv_start_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_adv_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_tx_power_set command request.
+ *
+ * @sa @ref ble_gap_tx_power_set_rsp_dec for command response decoder.
+ *
+ * @param[in] tx_power Radio transmit power in dBm (accepted values are -40, -30, -20, -16, -12, -8, -4, 0, and 4 dBm).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_tx_power_set_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t role, uint16_t handle,
+#endif
+ int8_t tx_power,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_tx_power_set command.
+ *
+ * @sa @ref ble_gap_tx_power_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_tx_power_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_appearance_get command request.
+ *
+ * @sa @ref ble_gap_appearance_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_appearance Appearance (16 bit), see @ref BLE_APPEARANCES.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_appearance will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gap_appearance_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_appearance_get_req_enc(uint16_t const * const p_appearance,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_appearance_get command.
+ *
+ * @sa @ref ble_gap_appearance_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_appearance Appearance (16 bit), see @ref BLE_APPEARANCES.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_appearance_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_appearance,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_appearance_set command request.
+ *
+ * @sa @ref ble_gap_appearance_set_rsp_dec for command response decoder.
+ *
+ * @param[in] appearance Appearance (16 bit), see @ref BLE_APPEARANCES.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_appearance_set_req_enc(uint16_t appearance,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_appearance_set command.
+ *
+ * @sa @ref ble_gap_appearance_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_appearance_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_device_name_get command request.
+ *
+ * @sa @ref ble_gap_device_name_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_dev_name Pointer to an empty buffer where the UTF-8 <b>non NULL-terminated</b>
+ * string will be placed. Set to NULL to obtain the complete device
+ * name length.
+ * @param[in] p_dev_name_len Length of the buffer pointed by p_dev_name.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_dev_name and \p p_len will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gap_device_name_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_device_name_get_req_enc(uint8_t const * const p_dev_name,
+ uint16_t const * const p_dev_name_len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_device_name_get command.
+ *
+ * @sa @ref ble_gap_device_name_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_dev_name Pointer to an empty buffer where the UTF-8
+ * <b>non NULL-terminated</b> string will be placed.
+ * @param[in,out] p_dev_name_len Length of the buffer pointed by p_dev_name, complete device name
+ * length on output.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_device_name_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * const p_dev_name,
+ uint16_t * const p_dev_name_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_device_name_set command request.
+ *
+ * @sa @ref ble_gap_device_name_set_rsp_dec for command response decoder.
+ *
+ * @param[in] p_write_perm Write permissions for the Device Name characteristic, see
+ * @ref ble_gap_conn_sec_mode_t.
+ * @param[in] p_dev_name Pointer to a UTF-8 encoded, <b>non NULL-terminated</b> string.
+ * @param[in] len Length of the UTF-8, <b>non NULL-terminated</b> string pointed
+ * to by p_dev_name in octets (must be smaller or equal
+ * than @ref BLE_GAP_DEVNAME_MAX_LEN).
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_device_name_set_req_enc(ble_gap_conn_sec_mode_t const * const p_write_perm,
+ uint8_t const * const p_dev_name,
+ uint16_t len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_device_name_set command.
+ *
+ * @sa @ref ble_gap_device_name_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_device_name_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_ppcp_set command request.
+ *
+ * @sa @ref ble_gap_ppcp_set_rsp_dec for command response decoder.
+ *
+ * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure with the
+ * desired parameters.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_ppcp_set_req_enc(ble_gap_conn_params_t const * const p_conn_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_ppcp_set command.
+ *
+ * @sa @ref ble_gap_ppcp_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_ppcp_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_conn_param_update command request.
+ *
+ * @sa @ref ble_gap_conn_param_update_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_conn_params Pointer to desired connection parameters.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_conn_param_update_req_enc(uint16_t conn_handle,
+ ble_gap_conn_params_t const * const p_conn_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_conn_param_update command.
+ *
+ * @sa @ref ble_gap_conn_param_update_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_conn_param_update_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_disconnect command request.
+ *
+ * @sa @ref ble_gap_disconnect_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] hci_status_code HCI status code, see @ref BLE_HCI_STATUS_CODES.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_disconnect_req_enc(uint16_t conn_handle,
+ uint8_t hci_status_code,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_disconnect command.
+ *
+ * @sa @ref ble_gap_disconnect_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_disconnect_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes @ref sd_ble_gap_rssi_stop command request.
+ *
+ * @sa @ref ble_gap_rssi_stop_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_rssi_stop_req_enc(uint16_t conn_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_rssi_stop command.
+ *
+ * @sa @ref ble_gap_rssi_stop_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_rssi_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+
+
+/**@brief Encodes @ref sd_ble_gap_ppcp_get command request.
+ *
+ * @sa @ref ble_gap_ppcp_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the
+ * parameters will be stored.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_conn_params will not be updated by the command request encoder. Updated values are
+ * set by @ref ble_gap_ppcp_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_ppcp_get_req_enc(ble_gap_conn_params_t const * const p_conn_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_ppcp_get command.
+ *
+ * @sa @ref ble_gap_ppcp_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_conn_params Pointer to a @ref ble_gap_conn_params_t structure where the parameters
+ * will be stored.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_ppcp_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_conn_params_t * const p_conn_params,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_auth_key_reply command request.
+ *
+ * @sa @ref ble_gap_auth_key_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] key_type Key type which defines length of key data as defined for
+ * @ref sd_ble_gap_auth_key_reply .
+ * @param[in] p_key Pointer to a buffer which contains key
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Incorrect param provided (key_type).
+ */
+uint32_t ble_gap_auth_key_reply_req_enc(uint16_t conn_handle,
+ uint8_t key_type,
+ uint8_t const * const p_key,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_auth_key_reply command.
+ *
+ * @sa @ref ble_gap_auth_key_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_auth_key_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_sec_info_reply command request.
+ *
+ * @sa @ref ble_gap_sec_info_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_enc_info Pointer to a @ref ble_gap_enc_info_t encryption information
+ * structure.
+ * @param[in] p_id_info Pointer to a @ref ble_gap_irk_t id information
+ * structure.
+ * @param[in] p_sign_info Pointer to a @ref ble_gap_sign_info_t signing information
+ * structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_sec_info_reply_req_enc(uint16_t conn_handle,
+ ble_gap_enc_info_t const * p_enc_info,
+ ble_gap_irk_t const * p_id_info,
+ ble_gap_sign_info_t const * p_sign_info,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_sec_info_reply command.
+ *
+ * @sa @ref ble_gap_sec_info_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_sec_info_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_sec_params_reply command request.
+ *
+ * @sa @ref ble_gap_sec_params_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] sec_status Security status, see @ref BLE_GAP_SEC_STATUS.
+ * @param[in] p_sec_params Pointer to @ref ble_gap_sec_params_t security parameters
+ * structure.
+ * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys
+ * structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_sec_params_reply_req_enc(uint16_t conn_handle,
+ uint8_t sec_status,
+ ble_gap_sec_params_t const * const p_sec_params,
+ ble_gap_sec_keyset_t const * const p_sec_keyset,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_sec_params_reply command.
+ *
+ * @sa @ref ble_gap_sec_params_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[in] p_sec_keyset Pointer to @ref ble_gap_sec_keyset_t security keys
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_sec_params_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_sec_keyset_t const * const p_sec_keyset,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_authenticate command request.
+ *
+ * @sa @ref ble_gap_authenticate_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_sec_params Pointer to a @ref ble_gap_sec_params_t security parameters
+ * structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_authenticate_req_enc(uint16_t conn_handle,
+ ble_gap_sec_params_t const * const p_sec_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_authenticate command.
+ *
+ * @sa @ref ble_gap_authenticate_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_authenticate_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_adv_stop command request.
+ *
+ * @sa @ref ble_gap_adv_stop_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_adv_stop_req_enc(
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t adv_handle,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_adv_stop command.
+ *
+ * @sa @ref ble_gap_adv_stop_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_adv_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_conn_sec_get command request.
+ *
+ * @sa @ref ble_gap_conn_sec_get_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_conn_sec Pointer to \ref ble_gap_conn_sec_t which will be filled in
+ * response.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_conn_sec_get_req_enc(uint16_t conn_handle,
+ ble_gap_conn_sec_t const * const p_conn_sec,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_conn_sec_get command.
+ *
+ * @sa @ref ble_gap_conn_sec_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] pp_conn_sec Pointer to pointer to \ref ble_gap_conn_sec_t which will be filled by
+ * the decoded data (if present).
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_conn_sec_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_conn_sec_t * * const pp_conn_sec,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_rssi_start command request.
+ *
+ * @sa @ref ble_gap_rssi_start_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] threshold_dbm Threshold in dBm.
+ * @param[in] skip_count Sample skip count.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_rssi_start_req_enc(uint16_t conn_handle,
+ uint8_t threshold_dbm,
+ uint8_t skip_count,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_rssi_start command.
+ *
+ * @sa @ref ble_gap_rssi_start_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_rssi_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#ifndef S112
+/**@brief Encodes @ref sd_ble_gap_scan_stop command request.
+ *
+ * @sa @ref ble_gap_scan_stop_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_scan_stop_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_scan_stop command.
+ *
+ * @sa @ref ble_gap_scan_stop_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_scan_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_scan_start command request.
+ *
+ * @sa @ref ble_gap_scan_start_rsp_dec for command response decoder.
+ *
+ * @param[in] p_scan_params Pointer to scan params structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_scan_start_req_enc(ble_gap_scan_params_t const * p_scan_params,
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ ble_data_t const * p_adv_report_buffer,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_scan_start command.
+ *
+ * @sa @ref ble_gap_scan_start_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_scan_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_connect command request.
+ *
+ * @sa @ref ble_gap_connect_rsp_dec for command response decoder.
+ *
+ * @param[in] p_peer_addr Pointer to peer address.
+ * @param[in] p_scan_params Pointer to scan params structure.
+ * @param[in] p_conn_params Pointer to desired connection parameters.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_connect_req_enc(ble_gap_addr_t const * const p_peer_addr,
+ ble_gap_scan_params_t const * const p_scan_params,
+ ble_gap_conn_params_t const * const p_conn_params,
+#if NRF_SD_BLE_API_VERSION >= 4
+ uint8_t conn_cfg_tag,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_connect command.
+ *
+ * @sa @ref ble_gap_connect_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_connect_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_connect_cancel command request.
+ *
+ * @sa @ref ble_gap_connect_cancel_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_connect_cancel command.
+ *
+ * @sa @ref ble_gap_connect_cancel_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_connect_cancel_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes @ref sd_ble_gap_encrypt command request.
+ *
+ * @sa @ref ble_gap_encrypt_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_master_id Pointer to a master identification structure.
+ * @param[in] p_enc_info Pointer to desired connection parameters.
+ * @param[in] p_buf Pointer to a ble_gap_enc_info_t encryption information structure.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+
+uint32_t ble_gap_encrypt_req_enc(uint16_t conn_handle,
+ ble_gap_master_id_t const * const p_master_id,
+ ble_gap_enc_info_t const * const p_enc_info,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+
+/**@brief Decodes response to @ref sd_ble_gap_encrypt command.
+ *
+ * @sa @ref ble_gap_encrypt_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_encrypt_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#endif //!S112
+
+/**@brief Encodes @ref sd_ble_gap_rssi_get command request.
+ *
+ * @sa @ref ble_gap_rssi_get_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_rssi Pointer to the RSSI value.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_rssi_get_req_enc(uint16_t conn_handle,
+ int8_t const * const p_rssi,
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t const * const p_ch_index,
+#endif
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_rssi_get command.
+ *
+ * @sa @ref ble_gap_rssi_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_rssi Pointer to RSSI value.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_rssi_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ int8_t * const p_rssi,
+#if NRF_SD_BLE_API_VERSION > 5
+ uint8_t * const p_ch_index,
+#endif
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_keypress_notify command request.
+ *
+ * @sa @ref ble_gap_keypress_notify_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] kp_not See @ref sd_ble_gap_keypress_notify.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_keypress_notify_req_enc(uint16_t conn_handle,
+ uint8_t kp_not,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_keypress_notify command.
+ *
+ * @sa @ref ble_gap_keypress_notify_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_keypress_notify_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_lesc_dhkey_reply command request.
+ *
+ * @sa @ref ble_gap_lesc_dhkey_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_dhkey See @ref sd_ble_gap_lesc_dhkey_reply.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_lesc_dhkey_reply_req_enc(uint16_t conn_handle,
+ ble_gap_lesc_dhkey_t const *p_dhkey,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_lesc_dhkey_reply command.
+ *
+ * @sa @ref ble_gap_lesc_dhkey_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_lesc_dhkey_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_lesc_oob_data_set command request.
+ *
+ * @sa @ref ble_gap_lesc_oob_data_set_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_oobd_own See @ref sd_ble_gap_lesc_oob_data_set.
+ * @param[in] p_oobd_peer See @ref sd_ble_gap_lesc_oob_data_set.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_lesc_oob_data_set_req_enc(uint16_t conn_handle,
+ ble_gap_lesc_oob_data_t const *p_oobd_own,
+ ble_gap_lesc_oob_data_t const *p_oobd_peer,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_lesc_oob_data_set command.
+ *
+ * @sa @ref ble_gap_lesc_oob_data_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_lesc_oob_data_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_lesc_oob_data_get command request.
+ *
+ * @sa @ref ble_gap_lesc_oob_data_get_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_pk_own See @ref sd_ble_gap_lesc_oob_data_get.
+ * @param[in] p_oobd_own See @ref sd_ble_gap_lesc_oob_data_get.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_lesc_oob_data_get_req_enc(uint16_t conn_handle,
+ ble_gap_lesc_p256_pk_t const *p_pk_own,
+ ble_gap_lesc_oob_data_t *p_oobd_own,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_lesc_oob_data_get command.
+ *
+ * @sa @ref ble_gap_lesc_oob_data_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] pp_oobd_own Pointer to pointer to location where OOB data is decoded.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_lesc_oob_data_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_lesc_oob_data_t * *pp_oobd_own,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_addr_get command request.
+ *
+ * @sa @ref ble_gap_addr_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_address Pointer to address.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_address will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gap_addr_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_addr_get_req_enc(ble_gap_addr_t const * const p_address,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_addr_get command.
+ *
+ * @sa @ref ble_gap_addr_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_address Pointer to address.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_addr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_addr_t * const p_address,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_addr_set command request.
+ *
+ * @sa @ref ble_gap_addr_set_rsp_dec for command response decoder.
+ *
+ * @param[in] p_addr Pointer to address structure.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_addr_set_req_enc(ble_gap_addr_t const * const p_addr,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_addr_set command.
+ *
+ * @sa @ref ble_gap_addr_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_addr_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_privacy_set command request.
+ *
+ * @sa @ref ble_gap_privacy_set_rsp_dec for command response decoder.
+ *
+ * @param[in] p_privacy_params Pointer to privacy settings structure.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_privacy_set_req_enc(ble_gap_privacy_params_t const * p_privacy_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_privacy_set command.
+ *
+ * @sa @ref ble_gap_privacy_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_privacy_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_privacy_get command request.
+ *
+ * @sa @ref ble_gap_privacy_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_privacy_params Pointer to privacy settings structure.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_privacy_get_req_enc(ble_gap_privacy_params_t const * const p_privacy_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_privacy_get command.
+ *
+ * @sa @ref ble_gap_privacy_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_privacy_params Pointer to privacy settings structure.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_privacy_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_privacy_params_t const * const p_privacy_params,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_whitelist_set command request.
+ *
+ * @sa @ref ble_gap_whitelist_set_rsp_dec for command response decoder.
+ *
+ * @param[in] pp_wl_addrs Pointer to a whitelist of peer addresses.
+ * @param[out] len Pointer to a length of the whitelist.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_whitelist_set_req_enc(ble_gap_addr_t const * const * const pp_wl_addrs,
+ uint8_t const len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_gap_whitelist_set command.
+ *
+ * @sa @ref ble_gap_whitelist_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_whitelist_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**
+ * @brief Encodes @ref sd_ble_gap_device_identities_set command request.
+ *
+ * @sa @ref ble_gap_device_identities_set_rsp_dec for command response decoder.
+ *
+ * @param[in] pp_id_keys Pointer to an array of peer identity addresses and peer IRKs.
+ * @param[in] pp_local_irks Pointer to an array of local IRKs.
+ * @param[out] len Pointer to a length of the device identity list.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_device_identities_set_req_enc(ble_gap_id_key_t const * const * const pp_id_keys,
+ ble_gap_irk_t const * const * const pp_local_irks,
+ uint8_t const len,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+/**
+ * @brief Decodes response to @ref sd_ble_gap_device_identities_set command.
+ *
+ * @sa @ref ble_gap_device_identities_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_device_identities_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+#if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
+/**
+ * @brief Encodes @ref sd_ble_gap_data_length_update command request.
+ *
+ * @sa @ref ble_gap_data_length_update_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_dl_params Pointer to a data length params structure.
+ * @param[out] p_dl_limitation Pointer to a data length limitation structure.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_data_length_update_req_enc(uint16_t conn_handle,
+ ble_gap_data_length_params_t const * p_dl_params,
+ ble_gap_data_length_limitation_t * p_dl_limitation,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+/**
+ * @brief Decodes response to @ref sd_ble_gap_data_length_update command.
+ *
+ * @sa @ref ble_gap_data_length_update_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_dl_limitation Pointer to a data length limitation structure.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gap_data_length_update_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gap_data_length_limitation_t * p_dl_limitation,
+ uint32_t * const p_result_code);
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 5
+/**@brief Encodes @ref sd_ble_gap_phy_update command request.
+ *
+ * @sa @ref ble_gap_phy_update_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_gap_phys Pointer to a @ref ble_gap_phys_t
+ * structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_phy_update_req_enc(uint16_t conn_handle,
+ ble_gap_phys_t const * p_gap_phys,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gap_phy_update command.
+ *
+ * @sa @ref ble_gap_phy_update_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_phy_update_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 6
+/**@brief Encodes @ref sd_ble_gap_adv_set_configure command request.
+ *
+ * @sa @ref ble_gap_adv_set_configure_rsp_dec for command response decoder.
+ *
+ * @param[in] p_adv_handle Advertising handle.
+ * @param[in] p_adv_data Pointer to a @ref ble_gap_adv_data_t structure.
+ * @param[in] p_adv_params Pointer to a @ref ble_gap_adv_params_t structure.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_adv_set_configure_req_enc(uint8_t * p_adv_handle,
+ ble_gap_adv_data_t const * p_adv_data,
+ ble_gap_adv_params_t const *p_adv_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+
+/**@brief Decodes response to @ref sd_ble_gap_adv_set_configure command.
+ *
+ * @sa @ref ble_gap_adv_set_configure_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_adv_handle Advertising handle.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_adv_set_configure_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * p_adv_handle,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_qos_channel_survey_start command request.
+ *
+ * @sa @ref ble_gap_qos_channel_survey_start_rsp_dec for command response decoder.
+ *
+ * @param[in] interval_us Interval.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_qos_channel_survey_start_req_enc(uint32_t interval_us,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+
+/**@brief Decodes response to @ref sd_ble_gap_qos_channel_survey_start command.
+ *
+ * @sa @ref ble_gap_qos_channel_survey_start_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_qos_channel_survey_start_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gap_qos_channel_survey_stop command request.
+ *
+ * @sa @ref ble_gap_qos_channel_survey_stop_rsp_dec for command response decoder.
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gap_qos_channel_survey_stop_req_enc(uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+
+/**@brief Decodes response to @ref sd_ble_gap_qos_channel_survey_stop command.
+ *
+ * @sa @ref ble_gap_qos_channel_survey_stop_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gap_qos_channel_survey_stop_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#endif
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.c
new file mode 100644
index 0000000..150a891
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.c
@@ -0,0 +1,415 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gap_evt_app.h"
+#include "ble_serialization.h"
+#include "app_util.h"
+#include "app_ble_gap_sec_keys.h"
+#include "ble_gap_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include <string.h>
+
+extern ser_ble_gap_app_keyset_t m_app_keys_table[];
+
+#ifndef S112
+uint32_t ble_gap_evt_adv_report_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_ADV_REPORT, gap, adv_report);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION >= 6
+ //get buffer stored during scan start.
+ err_code = app_ble_gap_scan_data_fetch_clear(&p_event->evt.gap_evt.params.adv_report.data);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+#endif
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.adv_report, ble_gap_evt_adv_report_t_dec);
+
+ SER_EVT_DEC_END;
+}
+#endif //!S112
+
+uint32_t ble_gap_evt_auth_key_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_AUTH_KEY_REQUEST, gap, auth_key_request);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.auth_key_request.key_type);
+
+ SER_EVT_DEC_END;
+}
+
+
+extern ser_ble_gap_app_keyset_t m_app_keys_table[];
+
+uint32_t ble_gap_evt_auth_status_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_AUTH_STATUS, gap, auth_status);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.auth_status, ble_gap_evt_auth_status_t_dec);
+
+ // keyset is an extension of standard event data - used to synchronize keys at application
+ uint32_t conn_index;
+ err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index);
+ if (err_code == NRF_SUCCESS)
+ {
+ SER_PULL_FIELD(&(m_app_keys_table[conn_index].keyset), ble_gap_sec_keyset_t_dec);
+
+ err_code = app_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gap_evt_conn_param_update_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_CONN_PARAM_UPDATE, gap, conn_param_update);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.conn_param_update, ble_gap_evt_conn_param_update_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+#ifndef S112
+uint32_t ble_gap_evt_conn_param_update_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST, gap, conn_param_update_request);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.conn_param_update_request,
+ ble_gap_evt_conn_param_update_request_t_dec);
+
+ SER_EVT_DEC_END;
+}
+#endif
+
+uint32_t ble_gap_evt_conn_sec_update_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_CONN_SEC_UPDATE, gap, conn_sec_update);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.conn_sec_update, ble_gap_evt_conn_sec_update_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_evt_connected_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_CONNECTED, gap, connected);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.connected, ble_gap_evt_connected_t_dec);
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ if (BLE_GAP_ROLE_PERIPH == p_event->evt.gap_evt.params.connected.role)
+ {
+ err_code = app_ble_gap_adv_set_unregister(p_event->evt.gap_evt.params.connected.adv_handle,
+ &p_event->evt.gap_evt.params.connected.adv_data.adv_data.p_data,
+ &p_event->evt.gap_evt.params.connected.adv_data.scan_rsp_data.p_data);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+#endif
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gap_evt_disconnected_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_DISCONNECTED, gap, disconnected);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.disconnected, ble_gap_evt_disconnected_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_evt_key_pressed_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_KEY_PRESSED, gap, key_pressed);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.key_pressed.kp_not);
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gap_evt_lesc_dhkey_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_LESC_DHKEY_REQUEST, gap, lesc_dhkey_request);
+
+ uint8_t ser_data;
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+
+ // keyset is an extension of standard event data - used to synchronize keys at application
+ uint32_t conn_index;
+ err_code = app_ble_gap_sec_context_find(p_event->evt.gap_evt.conn_handle, &conn_index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ p_event->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer = m_app_keys_table[conn_index].keyset.keys_peer.p_pk;
+ SER_PULL_COND(&p_event->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer, ble_gap_lesc_p256_pk_t_dec);
+
+ SER_PULL_uint8(&ser_data);
+ p_event->evt.gap_evt.params.lesc_dhkey_request.oobd_req = ser_data & 0x01;
+
+ SER_EVT_DEC_END;
+}
+
+
+#define PASSKEY_LEN sizeof (p_event->evt.gap_evt.params.passkey_display.passkey)
+
+
+uint32_t ble_gap_evt_passkey_display_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_PASSKEY_DISPLAY, gap, passkey_display);
+
+ uint8_t ser_data;
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_uint8array(p_event->evt.gap_evt.params.passkey_display.passkey, BLE_GAP_PASSKEY_LEN);
+ SER_PULL_uint8(&ser_data);
+ p_event->evt.gap_evt.params.passkey_display.match_request = (ser_data & 0x01);
+
+ SER_EVT_DEC_END;
+}
+
+
+
+uint32_t ble_gap_evt_rssi_changed_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_RSSI_CHANGED, gap, rssi_changed);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_int8(&p_event->evt.gap_evt.params.rssi_changed.rssi);
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.rssi_changed.ch_index);
+#endif
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gap_evt_scan_req_report_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_SCAN_REQ_REPORT, gap, scan_req_report);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.scan_req_report.adv_handle);
+#endif
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.scan_req_report.peer_addr, ble_gap_addr_t_dec);
+ SER_PULL_int8(&p_event->evt.gap_evt.params.scan_req_report.rssi);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_evt_sec_info_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_SEC_INFO_REQUEST, gap, sec_info_request);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.sec_info_request, ble_gap_evt_sec_info_request_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_evt_sec_params_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_SEC_PARAMS_REQUEST, gap, sec_params_request);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.sec_params_request, ble_gap_evt_sec_params_request_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_evt_sec_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_SEC_REQUEST, gap, sec_request);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.sec_request, ble_gap_evt_sec_request_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_TIMEOUT, gap, timeout);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.timeout.src);
+#if defined(NRF_SD_BLE_API_VERSION) && (NRF_SD_BLE_API_VERSION > 5) && !defined(S112)
+ if (p_event->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_SCAN)
+ {
+ SER_PULL_uint16(&p_event->evt.gap_evt.params.timeout.params.adv_report_buffer.len);
+ err_code = app_ble_gap_scan_data_fetch_clear(&p_event->evt.gap_evt.params.timeout.params.adv_report_buffer);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+#endif
+ SER_EVT_DEC_END;
+}
+
+#if NRF_SD_BLE_API_VERSION >= 5
+uint32_t ble_gap_evt_phy_update_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_PHY_UPDATE, gap, phy_update);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.phy_update.status);
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.phy_update.tx_phy);
+ SER_PULL_uint8(&p_event->evt.gap_evt.params.phy_update.rx_phy);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gap_evt_phy_update_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_PHY_UPDATE_REQUEST, gap, phy_update);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.phy_update_request, ble_gap_phys_t_dec);
+
+ SER_EVT_DEC_END;
+}
+#endif
+#if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
+uint32_t ble_gap_evt_data_length_update_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_DATA_LENGTH_UPDATE_REQUEST, gap, timeout);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.data_length_update_request.peer_params, ble_gap_data_length_params_t_dec);
+
+ SER_EVT_DEC_END;
+}
+uint32_t ble_gap_evt_data_length_update_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_DATA_LENGTH_UPDATE, gap, timeout);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.data_length_update.effective_params, ble_gap_data_length_params_t_dec);
+
+ SER_EVT_DEC_END;
+}
+#endif //NRF_SD_BLE_API_VERSION >= 4 @@ !defined(S112)
+#if NRF_SD_BLE_API_VERSION > 5
+uint32_t ble_gap_evt_adv_set_terminated_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GAP_EVT_ADV_SET_TERMINATED, gap, adv_set_terminated);
+
+ SER_PULL_uint16(&p_event->evt.gap_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gap_evt.params.adv_set_terminated, ble_gap_evt_adv_set_terminated_t_dec);
+
+ err_code = app_ble_gap_adv_set_unregister(
+ p_event->evt.gap_evt.params.adv_set_terminated.adv_handle,
+ &p_event->evt.gap_evt.params.adv_set_terminated.adv_data.adv_data.p_data,
+ &p_event->evt.gap_evt.params.adv_set_terminated.adv_data.scan_rsp_data.p_data);
+ SER_ERROR_CHECK(err_code == NRF_SUCCESS, err_code);
+
+ SER_EVT_DEC_END;
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.h
new file mode 100644
index 0000000..b36e70b
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gap_evt_app.h
@@ -0,0 +1,546 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_GAP_EVT_APP_H__
+#define BLE_GAP_EVT_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_gap_evt_app GAP Application event decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GAP Application event decoders.
+ */
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Decodes ble_gap_evt_auth_key_request event.
+ *
+ * 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_gap_evt_auth_key_request_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_gap_evt_auth_status event.
+ *
+ * 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_gap_evt_auth_status_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_gap_evt_conn_param_update event.
+ *
+ * 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_gap_evt_conn_param_update_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_gap_evt_conn_sec_update event.
+ *
+ * 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_gap_evt_conn_sec_update_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_gap_evt_connected event.
+ *
+ * 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_gap_evt_connected_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_gap_evt_disconnected event.
+ *
+ * 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_gap_evt_disconnected_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_gap_evt_passkey_display event.
+ *
+ * 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_gap_evt_passkey_display_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_gap_evt_rssi_changed event.
+ *
+ * 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_gap_evt_rssi_changed_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_gap_evt_sec_info_request event.
+ *
+ * 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_gap_evt_sec_info_request_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_gap_evt_sec_params_request event.
+ *
+ * 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_gap_evt_sec_params_request_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_gap_evt_timeout event.
+ *
+ * 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_gap_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_gap_evt_sec_request event.
+ *
+ * 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_gap_evt_sec_request_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_gap_evt_conn_param_update_request event.
+ *
+ * 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_gap_evt_conn_param_update_request_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_gap_evt_adv_report event.
+ *
+ * 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_gap_evt_adv_report_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_gap_evt_scan_req_report event.
+ *
+ * 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_gap_evt_scan_req_report_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_gap_evt_key_pressed event.
+ *
+ * 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_gap_evt_key_pressed_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_gap_evt_lesc_dhkey_request event.
+ *
+ * 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_gap_evt_lesc_dhkey_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+
+#if NRF_SD_BLE_API_VERSION >= 5
+/**
+ * @brief Decodes ble_gap_evt_phy_update event.
+ *
+ * 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_gap_evt_phy_update_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_gap_evt_phy_update_request event.
+ *
+ * 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_gap_evt_phy_update_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 4
+/**
+ * @brief Decodes ble_gap_evt_data_length_update_request event.
+ *
+ * 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_gap_evt_data_length_update_request_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_gap_evt_data_length_update event.
+ *
+ * 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_gap_evt_data_length_update_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#endif
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.c
new file mode 100644
index 0000000..dc0057c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.c
@@ -0,0 +1,286 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gattc_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+#include "ble_struct_serialization.h"
+#include "ble_types.h"
+
+uint32_t ble_gattc_attr_info_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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_ATTR_INFO_DISCOVER);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_handle_range, ble_gattc_handle_range_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_attr_info_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_ATTR_INFO_DISCOVER);
+}
+
+uint32_t ble_gattc_char_value_by_uuid_read_req_enc(uint16_t conn_handle,
+ ble_uuid_t const * const p_uuid,
+ ble_gattc_handle_range_t const * const p_handle_range,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_uuid, ble_uuid_t_enc);
+ SER_PUSH_COND(p_handle_range, ble_gattc_handle_range_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ);
+}
+
+uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle,
+ uint16_t const * const p_handles,
+ uint16_t handle_count,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_CHAR_VALUES_READ);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_len16data16(p_handles, handle_count);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_CHAR_VALUES_READ);
+}
+
+uint32_t ble_gattc_characteristics_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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_handle_range, ble_gattc_handle_range_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER);
+}
+
+uint32_t ble_gattc_descriptors_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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_DESCRIPTORS_DISCOVER);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_handle_range, ble_gattc_handle_range_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_DESCRIPTORS_DISCOVER);
+}
+
+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_REQ_ENC_BEGIN(SD_BLE_GATTC_HV_CONFIRM);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&handle);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_HV_CONFIRM);
+}
+
+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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&start_handle);
+ SER_PUSH_COND(p_srvc_uuid, ble_uuid_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+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)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER);
+}
+
+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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_READ);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&handle);
+ SER_PUSH_uint16(&offset);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_READ);
+}
+
+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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_handle_range, ble_gattc_handle_range_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER);
+}
+
+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)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_WRITE);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_write_params, ble_gattc_write_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_WRITE);
+}
+
+uint32_t ble_gattc_exchange_mtu_request_req_enc(uint16_t conn_handle,
+ uint16_t client_rx_mtu,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&client_rx_mtu);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gattc_exchange_mtu_request_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTC_EXCHANGE_MTU_REQUEST);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.h
new file mode 100644
index 0000000..ddb237e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_app.h
@@ -0,0 +1,491 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_GATTC_APP_H__
+#define BLE_GATTC_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_gattc_app GATTC Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GATTC Application command request encoders and command response decoders.
+ */
+#include "ble_gattc.h"
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Encodes @ref sd_ble_gattc_primary_services_discover command request.
+ *
+ * @sa @ref ble_gattc_primary_services_discover_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] start_handle Handle to start searching from.
+ * @param[in] p_srvc_uuid Pointer to a @ref ble_uuid_t which indicates the service UUID to
+ * be found. If it is NULL, all primary services will be returned.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_primary_services_discover command.
+ *
+ * @sa @ref ble_gattc_primary_services_discover_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+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);
+
+/**@brief Encodes @ref sd_ble_gattc_descriptors_discover command request.
+ *
+ * @sa @ref ble_gattc_descriptors_discover_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_handle_range A pointer to the range of handles of the Service to perform
+ * this procedure on.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gattc_descriptors_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);
+
+
+/**@brief Decodes response to @ref sd_ble_gattc_descriptors_discover command.
+ *
+ * @sa @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_relationships_discover command request.
+ *
+ * @sa @ref ble_gattc_relationships_discover_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_handle_range A pointer to the range of handles of the Service to perform
+ * this procedure on.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_relationships_discover command.
+ *
+ * @sa @ref ble_gattc_relationships_discover_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_characteristics_discover command request.
+ *
+ * @sa @ref ble_gattc_characteristics_discover_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_handle_range A pointer to the range of handles of the Service to perform
+ * this procedure on.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gattc_characteristics_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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_characteristics_discover command.
+ *
+ * @sa @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_read command request.
+ *
+ * @sa @ref ble_gattc_read_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] handle The handle of the attribute to be read.
+ * @param[in] offset Offset into the attribute value to be read.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_read command.
+ *
+ * @sa @ref ble_gattc_read_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_char_values_read command request.
+ *
+ * @sa @ref ble_gattc_char_values_read_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read.
+ * @param[in] handle_count The number of handles in p_handles.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle,
+ uint16_t const * const p_handles,
+ uint16_t handle_count,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gattc_char_values_read command.
+ *
+ * @sa @ref ble_gattc_char_values_read_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_write command request.
+ *
+ * @sa @ref ble_gattc_write_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_write_params Pointer to \ref sd_ble_gattc_write params.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_write command.
+ *
+ * @sa @ref ble_gattc_write_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_hv_confirm command request.
+ *
+ * @sa @ref ble_gattc_hv_confirm_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] handle Handle of the attribute in the indication.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_hv_confirm command.
+ *
+ * @sa @ref ble_gattc_hv_confirm_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Pointer to command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command request.
+ *
+ * @sa @ref ble_gattc_char_value_by_uuid_read_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_uuid Pointer to a characteristic value UUID to read.
+ * @param[in] p_handle_range Pointer to the range of handles to perform this procedure on.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gattc_char_value_by_uuid_read_req_enc
+ (uint16_t conn_handle,
+ ble_uuid_t const * const p_uuid,
+ ble_gattc_handle_range_t const * const p_handle_range,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gattc_char_value_by_uuid_read command.
+ *
+ * @sa @ref ble_gattc_char_value_by_uuid_read_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Pointer to command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_attr_info_discover command request.
+ *
+ * @sa @ref ble_gattc_attr_info_discover_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_handle_range Pointer to the range of handles
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gattc_attr_info_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);
+
+/**@brief Decodes response to @ref sd_ble_gattc_attr_info_discover command.
+ *
+ * @sa @ref ble_gattc_attr_info_discover_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Pointer to command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_attr_info_discover_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gattc_exchange_mtu_request command request.
+ *
+ * @sa @ref ble_gattc_exchange_mtu_request_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] client_rx_mtu Client MTU Size.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gattc_exchange_mtu_request_req_enc(uint16_t conn_handle,
+ uint16_t client_rx_mtu,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gattc_exchange_mtu_request command.
+ *
+ * @sa @ref ble_gattc_exchange_mtu_request_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Pointer to command response result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
+ * operation code.
+ */
+uint32_t ble_gattc_exchange_mtu_request_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.c
new file mode 100644
index 0000000..c049ed4
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.c
@@ -0,0 +1,262 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, gattc, attr_info_disc_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.attr_info_disc_rsp,
+ ble_gattc_evt_attr_info_disc_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_CHAR_DISC_RSP, gattc, char_disc_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.char_disc_rsp,
+ ble_gattc_evt_char_disc_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+
+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_EVT_DEC_BEGIN(BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, gattc, char_val_by_uuid_read_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.char_val_by_uuid_read_rsp,
+ ble_gattc_evt_char_val_by_uuid_read_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_CHAR_VALS_READ_RSP, gattc, char_vals_read_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.char_vals_read_rsp,
+ ble_gattc_evt_char_vals_read_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_DESC_DISC_RSP, gattc, desc_disc_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.desc_disc_rsp,
+ ble_gattc_evt_desc_disc_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_HVX, gattc, hvx);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.hvx,
+ ble_gattc_evt_hvx_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP, gattc, prim_srvc_disc_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.prim_srvc_disc_rsp,
+ ble_gattc_evt_prim_srvc_disc_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_READ_RSP, gattc, read_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.read_rsp,
+ ble_gattc_evt_read_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+#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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_READ_RSP, gattc, rel_disc_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.rel_disc_rsp,
+ ble_gattc_evt_rel_disc_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_TIMEOUT, gattc, timeout);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD(&p_event->evt.gattc_evt.params.timeout,
+ ble_gattc_evt_timeout_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_WRITE_RSP, gattc, write_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gattc_evt.params.write_rsp,
+ ble_gattc_evt_write_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gattc_evt_exchange_mtu_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_EVT_DEC_BEGIN(BLE_GATTC_EVT_EXCHANGE_MTU_RSP, gattc, exchange_mtu_rsp);
+
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_FIELD(&p_event->evt.gattc_evt.params.exchange_mtu_rsp,
+ ble_gattc_evt_exchange_mtu_rsp_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+#if NRF_SD_BLE_API_VERSION >= 4
+uint32_t ble_gattc_evt_write_cmd_tx_complete_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE, gattc, write_cmd_tx_complete);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.gatt_status);
+ SER_PULL_uint16(&p_event->evt.gattc_evt.error_handle);
+ SER_PULL_uint8(&p_event->evt.gattc_evt.params.write_cmd_tx_complete.count);
+
+ SER_EVT_DEC_END;
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.h
new file mode 100644
index 0000000..73a0c78
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gattc_evt_app.h
@@ -0,0 +1,364 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_GATTC_EVT_APP_H__
+#define BLE_GATTC_EVT_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_gattc_evt_app GATTC Application event decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GATTC Application event decoders.
+ */
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Decodes ble_gattc_evt_char_disc_rsp event.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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);
+
+/**
+ * @brief Decodes ble_gattc_evt_exchange_mtu_rsp event.
+ *
+ * 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_exchange_mtu_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+
+#if NRF_SD_BLE_API_VERSION >= 4
+
+/**
+ * @brief Decodes ble_gattc_evt_write_cmd_tx_complete event.
+ *
+ * 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_cmd_tx_complete_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#endif
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.c
new file mode 100644
index 0000000..eb7c76c
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.c
@@ -0,0 +1,439 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gatts_app.h"
+#include <stdlib.h>
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gatts_struct_serialization.h"
+#include "ble_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+
+uint32_t ble_gatts_attr_get_req_enc(uint16_t handle,
+ ble_uuid_t * p_uuid,
+ ble_gatts_attr_md_t * p_md,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_ATTR_GET);
+
+ SER_PUSH_uint16(&handle);
+ SER_PUSH_COND(p_uuid, NULL);
+ SER_PUSH_COND(p_md, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_attr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_uuid_t ** pp_uuid,
+ ble_gatts_attr_md_t ** pp_md,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_ATTR_GET);
+ SER_PULL_COND(pp_uuid, ble_uuid_t_dec);
+ SER_PULL_COND(pp_md, ble_gatts_attr_md_t_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_characteristic_add_req_enc(
+ uint16_t service_handle,
+ ble_gatts_char_md_t const * const p_char_md,
+ ble_gatts_attr_t const * const p_attr_char_value,
+ ble_gatts_char_handles_t const * const p_handles,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_CHARACTERISTIC_ADD);
+
+ SER_PUSH_uint16(&service_handle);
+ SER_PUSH_COND(p_char_md, ble_gatts_char_md_t_enc);
+ SER_PUSH_COND(p_attr_char_value, ble_gatts_attr_t_enc);
+ SER_PUSH_COND(p_handles, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * * const pp_handles,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_CHARACTERISTIC_ADD);
+
+ SER_PULL_COND(pp_handles, ble_gatts_char_handles_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+
+uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle,
+ ble_gatts_attr_t const * const p_attr,
+ uint16_t * const p_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_DESCRIPTOR_ADD);
+
+ SER_PUSH_uint16(&char_handle);
+ SER_PUSH_COND(p_attr, ble_gatts_attr_t_enc);
+ SER_PUSH_COND(p_handle, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_handle,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_DESCRIPTOR_ADD);
+
+ SER_PULL_COND(&p_handle, uint16_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle,
+ ble_gatts_hvx_params_t const * const p_hvx_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_HVX);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_hvx_params, ble_gatts_hvx_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code,
+ uint16_t * * const pp_bytes_written)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_HVX);
+
+ SER_PULL_COND(pp_bytes_written, uint16_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle,
+ uint16_t inc_srvc_handle,
+ uint16_t * const p_include_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_INCLUDE_ADD);
+
+ SER_PUSH_uint16(&service_handle);
+ SER_PUSH_uint16(&inc_srvc_handle);
+ SER_PUSH_COND(p_include_handle, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_include_handle,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_INCLUDE_ADD);
+
+ SER_PULL_COND(&p_include_handle, uint16_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_initial_user_handle_get_req_enc(uint16_t * p_handle,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET);
+
+ SER_PUSH_COND(p_handle, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_initial_user_handle_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t ** pp_handle,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_INITIAL_USER_HANDLE_GET);
+
+ SER_PULL_COND(pp_handle, uint16_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_rw_authorize_reply_req_enc(uint16_t conn_handle,
+ ble_gatts_rw_authorize_reply_params_t const * const p_reply_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_RW_AUTHORIZE_REPLY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_reply_params, ble_gatts_rw_authorize_reply_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTS_RW_AUTHORIZE_REPLY);
+}
+
+
+uint32_t ble_gatts_service_add_req_enc(uint8_t type,
+ ble_uuid_t const * const p_uuid,
+ uint16_t const * const p_conn_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_SERVICE_ADD);
+
+ SER_PUSH_uint8(&type);
+ SER_PUSH_COND(p_uuid, ble_uuid_t_enc);
+ SER_PUSH_COND(p_conn_handle, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_conn_handle,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_SERVICE_ADD);
+
+ SER_PULL_COND(&p_conn_handle, uint16_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle,
+ uint16_t start_handle,
+ uint16_t end_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_SERVICE_CHANGED);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&start_handle);
+ SER_PUSH_uint16(&end_handle);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTS_SERVICE_CHANGED);
+}
+
+
+uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle,
+ uint8_t const * const p_sys_attr_data,
+ uint16_t const * const p_sys_attr_data_len,
+ uint32_t flags,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_SYS_ATTR_GET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_sys_attr_data_len, uint16_t_enc);
+ SER_PUSH_COND(p_sys_attr_data, NULL);
+ SER_PUSH_uint32(&flags);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * * const pp_sys_attr_data,
+ uint16_t * * const pp_sys_attr_data_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_SYS_ATTR_GET);
+
+ SER_PULL_COND(pp_sys_attr_data_len, uint16_t_dec);
+ if (*pp_sys_attr_data_len)
+ {
+ SER_PULL_buf(pp_sys_attr_data, **pp_sys_attr_data_len, **pp_sys_attr_data_len);
+ }
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle,
+ uint8_t const * const p_sys_attr_data,
+ uint16_t sys_attr_data_len,
+ uint32_t flags,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_SYS_ATTR_SET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_len16data(p_sys_attr_data, sys_attr_data_len);
+ SER_PUSH_uint32(&flags);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_sys_attr_set_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_GATTS_SYS_ATTR_SET, p_result_code);
+}
+
+
+uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle,
+ uint16_t handle,
+ ble_gatts_value_t const * const p_value,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_VALUE_GET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&handle);
+
+ //Special case: skip the data.
+ SER_PUSH_COND(p_value, NULL);
+ if (p_value)
+ {
+ SER_PUSH_uint16(&p_value->offset);
+ SER_PUSH_uint16(&p_value->len);
+ SER_PUSH_COND(p_value->p_value, NULL);
+ }
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gatts_value_t * const p_value,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_VALUE_GET);
+
+ SER_PULL_COND(&p_value, ble_gatts_value_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle,
+ uint16_t handle,
+ ble_gatts_value_t * p_value,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_VALUE_SET);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&handle);
+ SER_PUSH_COND(p_value, ble_gatts_value_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gatts_value_t * const p_value,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_GATTS_VALUE_SET);
+
+ SER_PULL_COND(&p_value, ble_gatts_value_t_dec);
+
+ SER_RSP_DEC_END;
+}
+
+uint32_t ble_gatts_exchange_mtu_reply_req_enc(uint16_t conn_handle,
+ uint16_t server_rx_mtu,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_GATTS_EXCHANGE_MTU_REPLY);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&server_rx_mtu);
+
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ble_gatts_exchange_mtu_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_GATTS_EXCHANGE_MTU_REPLY);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.h
new file mode 100644
index 0000000..3dcf5d5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_app.h
@@ -0,0 +1,677 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_GATTS_APP_H__
+#define BLE_GATTS_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_gatts_app GATTS Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GATTS Application command request encoders and command response decoders.
+ */
+#include "ble_gatts.h"
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Encodes @ref sd_ble_gatts_value_get command request.
+ *
+ * @sa @ref ble_gatts_value_get_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] handle Attribute handle.
+ * @param[in] p_value Pointer to attribute value information.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_data_len and \p p_data will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gatts_value_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_value_get_req_enc(uint16_t conn_handle,
+ uint16_t handle,
+ ble_gatts_value_t const * const p_value,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_value_get command.
+ *
+ * @sa @ref ble_gatts_value_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_value Pointer to structure where the attribute value will be stored.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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 Length of \p p_value is too small to hold decoded
+ * value from response.
+ */
+uint32_t ble_gatts_value_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gatts_value_t * const p_value,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_hvx command request.
+ *
+ * @sa @ref ble_gatts_hvx_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_hvx_params Pointer to an HVx parameters structure to be encoded.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_hvx_params will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gatts_hvx_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_hvx_req_enc(uint16_t conn_handle,
+ ble_gatts_hvx_params_t const * const p_hvx_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_hvx command.
+ *
+ * @sa @ref ble_gatts_hvx_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ * @param[out] pp_bytes_written Pointer to pointer to location where number of bytes is written.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_hvx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code,
+ uint16_t * * const pp_bytes_written);
+
+/**@brief Encodes @ref sd_ble_gatts_characteristic_add command request.
+ *
+ * @sa @ref ble_gatts_characteristic_add_rsp_dec for command response decoder.
+ *
+ * @param[in] service_handle Handle of the service where the characteristic is to be placed.
+ * If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed
+ * sequentially.
+ * @param[in] p_char_md Pointer to a @ref ble_gatts_char_md_t structure, characteristic
+ * metadata.
+ * @param[in] p_attr_char_value Pointer to a @ref ble_gatts_attr_t structure, corresponding to
+ * the characteristic value.
+ * @param[in] p_handles Pointer to a @ref ble_gatts_char_handles_t structure, where the
+ * assigned handles will be stored.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_handles will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gatts_characteristic_add_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_characteristic_add_req_enc
+ (uint16_t service_handle,
+ ble_gatts_char_md_t const * const p_char_md,
+ ble_gatts_attr_t const * const p_attr_char_value,
+ ble_gatts_char_handles_t const * const p_handles,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_characteristic_add command.
+ *
+ * @sa @ref ble_gatts_characteristic_add_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] pp_handles Pointer to pointer to location where handles should be decoded.
+ * @param[out] p_result_code Pointer to command result code decode location.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_characteristic_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * * const pp_handles,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes @ref sd_ble_gatts_service_add command request.
+ *
+ * @sa @ref ble_gatts_service_add_rsp_dec for command response decoder.
+ *
+ * @param[in] type Toggles between primary and secondary services,
+ * see @ref BLE_GATTS_SRVC_TYPES.
+ * @param[in] p_uuid Pointer to service UUID.
+ * @param[in] p_conn_handle Pointer to a 16-bit word where the assigned handle will be stored.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_conn_handle will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gatts_service_add_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_service_add_req_enc(uint8_t type,
+ ble_uuid_t const * const p_uuid,
+ uint16_t const * const p_conn_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_service_add command.
+ *
+ * @sa @ref ble_gatts_service_add_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_conn_handle Connection handle.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_service_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_conn_handle,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_sys_attr_set command request.
+ *
+ * @sa @ref ble_gatts_sys_attr_set_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_sys_attr_data Pointer to a buffer (at least \p sys_attr_data_len bytes long)
+ * containing the attribute value to write.
+ * @param[in] sys_attr_data_len Length (in bytes) of \p p_sys_attr_data.
+ * @param[in] flags Optional additional flags.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_sys_attr_set_req_enc(uint16_t conn_handle,
+ uint8_t const * const p_sys_attr_data,
+ uint16_t sys_attr_data_len,
+ uint32_t flags,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_set command.
+ *
+ * @sa @ref ble_gatts_sys_attr_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_sys_attr_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_value_set command request.
+ *
+ * @sa @ref ble_gatts_value_set_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] handle Attribute handle.
+ * @param[in] p_value Pointer to attribute value information.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_value_set_req_enc(uint16_t conn_handle,
+ uint16_t handle,
+ ble_gatts_value_t * p_value,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_value_set command.
+ *
+ * @sa @ref ble_gatts_value_set_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_value Pointer to attribute value information.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_value_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_gatts_value_t * const p_value,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_sys_attr_get command request.
+ *
+ * @sa @ref ble_gatts_sys_attr_get_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle of the connection.
+ * @param[in] p_sys_attr_data Pointer to buffer where updated information about system
+ * attributes will be stored. Can be NULL to calculate required
+ * size.
+ * @param[in] p_sys_attr_data_len Size of p_sys_attr_data buffer if \p p_sys_attr_data is
+ * not NULL.
+ * @param[in] flags Additional optional flags.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will
+ * be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @note \p p_sys_attr_data and \p p_sys_attr_data_len will not be updated by the command
+ * request encoder. Updated values are set by @ref ble_gatts_sys_attr_get_rsp_dec.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_sys_attr_get_req_enc(uint16_t conn_handle,
+ uint8_t const * const p_sys_attr_data,
+ uint16_t const * const p_sys_attr_data_len,
+ uint32_t flags,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_sys_attr_get command.
+ *
+ * @sa @ref ble_gatts_sys_attr_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] pp_sys_attr_data Pointer to a buffer where updated information about system
+ * attributes will be stored.
+ * @param[in,out] pp_sys_attr_data_len \c in: Size (in bytes) of \p p_sys_attr_data buffer.
+ * \c out: Length of decoded contents of \p p_sys_attr_data.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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 Length of \p p_sys_attr_data is too small to hold decoded
+ * value from response.
+ * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * * const pp_sys_attr_data,
+ uint16_t * * const pp_sys_attr_data_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_descriptor_add command request.
+ *
+ * @sa @ref ble_gatts_descriptor_add_rsp_dec for command response decoder.
+ *
+ * @param[in] char_handle Handle of the characteristic where the description is to be placed.
+ * If @ref BLE_GATT_HANDLE_INVALID is used, it will be placed
+ * sequentially.
+ * @param[in] p_attr Pointer to a @ref ble_gatts_attr_t structure, characteristic
+ * metadata.
+ * @param[in] p_handle Pointer to a @ref ble_gatts_char_handles_t structure, where the
+ * assigned handles will be stored.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_descriptor_add_req_enc(uint16_t char_handle,
+ ble_gatts_attr_t const * const p_attr,
+ uint16_t * const p_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_descriptor_add command.
+ *
+ * @sa @ref ble_gatts_descriptor_add_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_handle Pointer to bufer where descriptor handle will be
+ returned.
+ * @param[out] p_result_code Pointer to command result code decode location.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_descriptor_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_handle,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_include_add command request.
+ *
+ * @sa @ref ble_gatts_include_add_rsp_dec for command response decoder.
+ *
+ * @param[in] service_handle Handle of the service where the included service is to be placed.
+ * @param[in] inc_srvc_handle Handle of the included service
+ * @param[in] p_include_handle Pointer to Pointer to a 16-bit word where the assigned handle will be stored.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_include_add_req_enc(uint16_t service_handle,
+ uint16_t inc_srvc_handle,
+ uint16_t * const p_include_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_include_add command.
+ *
+ * @sa @ref ble_gatts_include_add_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_include_handle Pointer to a 16-bit word where the assigned handle will be stored.
+ * @param[out] p_result_code Pointer to command result code decode location.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_include_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * const p_include_handle,
+ uint32_t * const p_result_code);
+
+
+/**@brief Encodes @ref sd_ble_gatts_rw_authorize_reply command request.
+ *
+ * @sa @ref ble_gatts_rw_authorize_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_reply_params Pointer to \ref ble_gatts_rw_authorize_reply_params_t
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params.
+ */
+uint32_t ble_gatts_rw_authorize_reply_req_enc(
+ uint16_t conn_handle,
+ ble_gatts_rw_authorize_reply_params_t const * const
+ p_reply_params,
+ uint8_t * const
+ p_buf,
+ uint32_t * const
+ p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_rw_authorize_reply command.
+ *
+ * @sa @ref ble_gatts_rw_authorize_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_rw_authorize_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_service_changed command request.
+ *
+ * @sa @ref ble_gatts_service_changed_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] start_handle Start of affected attribute handle range.
+ * @param[in] end_handle End of affected attribute handle range.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params.
+ */
+uint32_t ble_gatts_service_changed_req_enc(uint16_t conn_handle,
+ uint16_t start_handle,
+ uint16_t end_handle,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_service_changed command.
+ *
+ * @sa @ref ble_gatts_service_changed_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_service_changed_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_attr_get command request.
+ *
+ * @sa @ref ble_gatts_attr_get_rsp_dec for command response decoder.
+ *
+ * @param[in] handle See @ref sd_ble_gatts_attr_get.
+ * @param[in] p_uuid See @ref sd_ble_gatts_attr_get.
+ * @param[out] p_md See @ref sd_ble_gatts_attr_get.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_attr_get_req_enc(uint16_t handle,
+ ble_uuid_t * p_uuid,
+ ble_gatts_attr_md_t * p_md,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_attr_get command.
+ *
+ * @sa @ref ble_gatts_attr_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] pp_uuid Pointer to address where to put output data.
+ * @param[out] pp_md Pointer to address where to put output data.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_attr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_uuid_t ** pp_uuid,
+ ble_gatts_attr_md_t ** pp_md,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_initial_user_handle_get command request.
+ *
+ * @sa @ref ble_gatts_initial_user_handle_get_rsp_dec for command response decoder.
+ *
+ * @param[out] p_handle See @ref sd_ble_gatts_initial_user_handle_get.
+ * @param[in,out] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_gatts_initial_user_handle_get_req_enc(uint16_t * p_handle,
+ uint8_t * const p_buf,
+ uint32_t * p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_initial_user_handle_get command.
+ *
+ * @sa @ref ble_gatts_initial_user_handle_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] pp_handle Pointer to address where to put output data.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_initial_user_handle_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t ** pp_handle,
+ uint32_t * const p_result_code);
+
+/**@brief Encodes @ref sd_ble_gatts_exchange_mtu_reply command request.
+ *
+ * @sa @ref ble_gatts_exchange_mtu_reply_rsp_dec for command response decoder.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] server_rx_mtu Server MTU Size.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_INVALID_PARAM Encoding failure. Invalid param provided in p_reply_params.
+ */
+uint32_t ble_gatts_exchange_mtu_reply_req_enc(uint16_t conn_handle,
+ uint16_t server_rx_mtu,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ble_gatts_exchange_mtu_reply command.
+ *
+ * @sa @ref ble_gatts_exchange_mtu_reply_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_gatts_exchange_mtu_reply_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //BLE_GATTS_APP_H__
+
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.c
new file mode 100644
index 0000000..bbe71e8
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.c
@@ -0,0 +1,190 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_gatts_evt_app.h"
+#include "ble_serialization.h"
+#include "ble_gatts_struct_serialization.h"
+#include "app_ble_user_mem.h"
+#include "app_util.h"
+
+extern ser_ble_user_mem_t m_app_user_mem_table[];
+
+uint32_t ble_gatts_evt_hvc_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_HVC, gatts, hvc);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gatts_evt.params.hvc,
+ ble_gatts_evt_hvc_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_gatts_evt_rw_authorize_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_HVC, gatts, rw_authorize_request);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gatts_evt.params.authorize_request, ble_gatts_evt_rw_authorize_request_t_dec);
+
+ //Correct event length / memory sync.
+ if (p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_READ)
+ {
+ evt_struct_len = offsetof(ble_evt_t, evt.gatts_evt.params.authorize_request.request.read)
+ - offsetof(ble_evt_t, evt)
+ + sizeof(ble_gatts_evt_read_t);
+ }
+ else if ((p_event->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_WRITE) &&
+ ( (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW) ||
+ (p_event->evt.gatts_evt.params.authorize_request.request.write.op == BLE_GATTS_OP_PREP_WRITE_REQ)))
+ {
+ uint32_t conn_index;
+ if (app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND)
+ {
+ SER_PULL_len16data(&m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len);
+ }
+ }
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gatts_evt_sc_confirm_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN_NO_STRUCT(BLE_GATTS_EVT_SC_CONFIRM, gatts);
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gatts_evt_sys_attr_missing_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_SYS_ATTR_MISSING, gatts, sys_attr_missing);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gatts_evt.params.sys_attr_missing,
+ ble_gatts_evt_sys_attr_missing_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gatts_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)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_TIMEOUT, gatts, timeout);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gatts_evt.params.timeout,
+ ble_gatts_evt_timeout_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+
+
+
+uint32_t ble_gatts_evt_write_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_WRITE, gatts, write);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.gatts_evt.params.write, ble_gatts_evt_write_t_dec);
+
+ if (p_event != NULL)
+ {
+ if (p_event->evt.gatts_evt.params.write.op == BLE_GATTS_OP_EXEC_WRITE_REQ_NOW)
+ {
+ uint32_t conn_index;
+ if (app_ble_user_mem_context_find(p_event->evt.gatts_evt.conn_handle, &conn_index) != NRF_ERROR_NOT_FOUND)
+ {
+ SER_PULL_len16data(&m_app_user_mem_table[conn_index].mem_block.p_mem, &m_app_user_mem_table[conn_index].mem_block.len);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+ }
+ }
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_gatts_evt_exchange_mtu_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_EXCHANGE_MTU_REQUEST, gatts, exchange_mtu_request);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_FIELD(&p_event->evt.gatts_evt.params.exchange_mtu_request, ble_gatts_evt_exchange_mtu_request_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+#if NRF_SD_BLE_API_VERSION >= 4
+uint32_t ble_gatts_evt_hvn_tx_complete_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_GATTS_EVT_HVN_TX_COMPLETE, gatts, hvn_tx_complete);
+
+ SER_PULL_uint16(&p_event->evt.gatts_evt.conn_handle);
+ SER_PULL_uint8(&p_event->evt.gatts_evt.params.hvn_tx_complete.count);
+
+ SER_EVT_DEC_END;
+}
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.h
new file mode 100644
index 0000000..d294b81
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_gatts_evt_app.h
@@ -0,0 +1,249 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_GATTS_EVT_APP_H__
+#define BLE_GATTS_EVT_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_gatts_evt_app GATTS Application event decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief GATTS Application event decoders.
+ */
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Decodes ble_gatts_evt_hvc event.
+ *
+ * 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_gatts_evt_hvc_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_gatts_evt_rw_authorize_request event.
+ *
+ * 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_gatts_evt_rw_authorize_request_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_gatts_evt_sc_confirm event.
+ *
+ * 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_gatts_evt_sc_confirm_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_gatts_evt_sys_attr_missing event.
+ *
+ * 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_gatts_evt_sys_attr_missing_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_gatts_evt_timeout event.
+ *
+ * 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_gatts_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_gatts_evt_write event.
+ *
+ * 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_gatts_evt_write_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_gatts_evt_exchange_mtu_request event.
+ *
+ * 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_gatts_evt_exchange_mtu_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+
+#if NRF_SD_BLE_API_VERSION >= 4
+
+/**
+ * @brief Decodes ble_gatts_evt_hvn_tx_complete event.
+ *
+ * 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_gatts_evt_hvn_tx_complete_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len);
+#endif
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.c
new file mode 100644
index 0000000..8378c80
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.c
@@ -0,0 +1,279 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <string.h>
+#include "ble_l2cap_app.h"
+#include "ble_serialization.h"
+#include "ble_struct_serialization.h"
+#include "ble_l2cap_struct_serialization.h"
+#include "ble_gap.h"
+#include "app_util.h"
+#include "cond_field_serialization.h"
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ 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_L2CAP_CID_REGISTER;
+ err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ble_l2cap_cid_register_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_L2CAP_CID_REGISTER, p_result_code);
+}
+
+uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ 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_L2CAP_CID_UNREGISTER;
+ err_code = uint16_t_enc(&cid, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ble_l2cap_cid_unregister_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_L2CAP_CID_UNREGISTER, p_result_code);
+}
+
+
+uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle,
+ ble_l2cap_header_t const * const p_l2cap_header,
+ uint8_t const * const p_data,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ SER_ASSERT_LENGTH_LEQ(1, *p_buf_len);
+ p_buf[index++] = SD_BLE_L2CAP_TX;
+
+ err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc(p_l2cap_header, p_buf, *p_buf_len, &index, ble_l2cap_header_t_enc);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (p_l2cap_header != NULL)
+ {
+ err_code = buf_enc(p_data, p_l2cap_header->len, p_buf, *p_buf_len, &index);
+ }
+ else
+ {
+ err_code = buf_enc(NULL, 0, p_buf, *p_buf_len, &index);
+ }
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ble_l2cap_tx_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_L2CAP_TX, p_result_code);
+}
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 5
+uint32_t ble_l2cap_ch_setup_req_enc(uint16_t conn_handle,
+ uint16_t * p_local_cid,
+ ble_l2cap_ch_setup_params_t const *p_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_L2CAP_CH_SETUP);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_COND(p_local_cid, uint16_t_enc);
+ SER_PUSH_COND(p_params, ble_l2cap_ch_setup_params_t_enc);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_l2cap_ch_setup_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * p_local_cid,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_L2CAP_CH_SETUP);
+ SER_PULL_COND((void **)&p_local_cid, uint16_t_dec);
+ SER_RSP_DEC_END;
+}
+
+uint32_t ble_l2cap_ch_release_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_L2CAP_CH_RELEASE);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&local_cid);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_l2cap_ch_release_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_L2CAP_CH_RELEASE);
+}
+
+uint32_t ble_l2cap_ch_rx_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ ble_data_t const *p_sdu_buf,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_L2CAP_CH_RX);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&local_cid);
+
+ SER_PUSH_COND(p_sdu_buf, NULL);
+ if (p_sdu_buf)
+ {
+ SER_PUSH_uint16(&p_sdu_buf->len);
+ SER_PUSH_uint32(&p_sdu_buf->p_data);
+ }
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_l2cap_ch_rx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_L2CAP_CH_RX);
+}
+
+uint32_t ble_l2cap_ch_tx_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ ble_data_t const *p_sdu_buf,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_L2CAP_CH_TX);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&local_cid);
+
+ SER_PUSH_COND(p_sdu_buf, NULL);
+ if (p_sdu_buf)
+ {
+ SER_PUSH_uint32(&p_sdu_buf->p_data);
+ SER_PUSH_uint16(&p_sdu_buf->len);
+ SER_PUSH_buf(p_sdu_buf->p_data, p_sdu_buf->len);
+ }
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_l2cap_ch_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_RESULT_ONLY(SD_BLE_L2CAP_CH_TX);
+}
+
+uint32_t ble_l2cap_ch_flow_control_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ uint16_t credits,
+ uint16_t *p_credits,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_BLE_L2CAP_CH_FLOW_CONTROL);
+
+ SER_PUSH_uint16(&conn_handle);
+ SER_PUSH_uint16(&local_cid);
+ SER_PUSH_uint16(&credits);
+ SER_PUSH_COND(p_credits, NULL);
+
+ SER_REQ_ENC_END;
+}
+
+uint32_t ble_l2cap_ch_flow_control_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * p_credits,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_BLE_L2CAP_CH_FLOW_CONTROL);
+ SER_PULL_COND((void **)&p_credits, uint16_t_dec);
+ SER_RSP_DEC_END;
+}
+#endif //NRF_SD_BLE_API_VERSION >= 5
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.h
new file mode 100644
index 0000000..68d8f68
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_app.h
@@ -0,0 +1,242 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+/**@file
+ *
+ * @defgroup ble_l2cap_app L2CAP Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief L2CAP Application command request encoders and command response decoders.
+ */
+
+#ifndef BLE_L2CAP_APP_H__
+#define BLE_L2CAP_APP_H__
+
+#include "ble.h"
+#include "ble_types.h"
+#include "ble_ranges.h"
+#include "ble_err.h"
+#include "ble_l2cap.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+/**@brief Register a CID with L2CAP.
+ *
+ * @details This registers a higher protocol layer with the L2CAP multiplexer, and is required prior to all operations on the CID.
+ *
+ * @param[in] cid L2CAP CID.
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_l2cap_cid_register_req_enc(uint16_t cid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_l2cap_cid_register command.
+ *
+ * @sa @ref ble_l2cap_cid_register_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_l2cap_cid_register_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Unregister a CID with L2CAP.
+ *
+ * @details This unregisters a previously registered higher protocol layer with the L2CAP multiplexer.
+ *
+ * @param[in] cid L2CAP CID.
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_l2cap_cid_unregister_req_enc(uint16_t cid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_l2cap_cid_unregister command.
+ *
+ * @sa @ref ble_l2cap_cid_unregister_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_l2cap_cid_unregister_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+/**@brief Transmit an L2CAP packet.
+ *
+ * @note It is important to note that a call to this function will <b>consume an application buffer</b>, and will therefore
+ * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted.
+ * See the documentation of @ref sd_ble_tx_packet_count_get for more details.
+ *
+ * @param[in] conn_handle Connection handle.
+ * @param[in] p_l2cap_header Pointer to a packet header containing length and CID.
+ * @param[in] p_data Pointer to the data to be transmitted.
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in,out] p_buf_len\ c in: Size of \p p_buf buffer.
+ * \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Successfully queued an L2CAP packet for transmission.
+ * @retval NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
+ * @retval NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register.
+ * @retval NRF_ERROR_NOT_FOUND CID not found.
+ * @retval NRF_ERROR_NO_MEM Not enough memory to complete operation.
+ * @retval NRF_ERROR_DATA_SIZE Invalid data size(s) supplied, see @ref BLE_L2CAP_MTU_DEF.
+ */
+uint32_t ble_l2cap_tx_req_enc(uint16_t conn_handle,
+ ble_l2cap_header_t const * const p_l2cap_header,
+ uint8_t const * const p_data,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**
+ * @brief Decodes response to @ref sd_ble_l2cap_tx command.
+ *
+ * @sa @ref ble_l2cap_tx_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @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_INVALID_DATA Decoding failure. Decoded operation code does not match
+ * expected operation code.
+ */
+uint32_t ble_l2cap_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+#endif
+
+#if NRF_SD_BLE_API_VERSION >= 5
+uint32_t ble_l2cap_ch_setup_req_enc(uint16_t conn_handle,
+ uint16_t * p_local_cid,
+ ble_l2cap_ch_setup_params_t const *p_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+uint32_t ble_l2cap_ch_setup_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * p_local_cid,
+ uint32_t * const p_result_code);
+
+uint32_t ble_l2cap_ch_release_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+uint32_t ble_l2cap_ch_release_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+uint32_t ble_l2cap_ch_rx_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ ble_data_t const *p_sdu_buf,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+uint32_t ble_l2cap_ch_rx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+uint32_t ble_l2cap_ch_tx_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ ble_data_t const *p_sdu_buf,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+uint32_t ble_l2cap_ch_tx_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+uint32_t ble_l2cap_ch_flow_control_req_enc(uint16_t conn_handle,
+ uint16_t local_cid,
+ uint16_t credits,
+ uint16_t *p_credits,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+uint32_t ble_l2cap_ch_flow_control_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint16_t * p_credits,
+ uint32_t * const p_result_code);
+#endif //NRF_SD_BLE_API_VERSION >= 5
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //BLE_L2CAP_APP_H__
+
+/**
+ @}
+ */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.c
new file mode 100644
index 0000000..392d860
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.c
@@ -0,0 +1,183 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_serialization.h"
+#include "ble_struct_serialization.h"
+#include "ble_l2cap_struct_serialization.h"
+#include "app_util.h"
+#include "ble_l2cap_evt_app.h"
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 4
+uint32_t ble_l2cap_evt_rx_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_RX, l2cap, rx);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_FIELD_EXTENDED(&p_event->evt.l2cap_evt.params.rx, ble_l2cap_evt_rx_t_dec);
+
+ SER_EVT_DEC_END;
+}
+#endif
+
+#if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION >= 5
+
+uint32_t ble_l2cap_evt_ch_setup_request_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_SETUP_REQUEST, l2cap, ch_setup_request);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.ch_setup_request.le_psm);
+ SER_PULL_FIELD(&p_event->evt.l2cap_evt.params.ch_setup_request.tx_params, ble_l2cap_ch_tx_params_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_l2cap_evt_ch_setup_refused_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_SETUP_REFUSED, l2cap, ch_setup_refused);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_uint8(&p_event->evt.l2cap_evt.params.ch_setup_refused.source);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.ch_setup_refused.status);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_l2cap_evt_ch_setup_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_SETUP, l2cap, ch_setup);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_FIELD(&p_event->evt.l2cap_evt.params.ch_setup.tx_params, ble_l2cap_ch_tx_params_t_dec);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_l2cap_evt_ch_released_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN_NO_STRUCT(BLE_L2CAP_EVT_CH_RELEASED, l2cap);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_l2cap_evt_ch_sdu_buf_released_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_SDU_BUF_RELEASED, l2cap, ch_sdu_buf_released);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.ch_sdu_buf_released.sdu_buf.len);
+ SER_PULL_uint32(&p_event->evt.l2cap_evt.params.ch_sdu_buf_released.sdu_buf.p_data);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_l2cap_evt_ch_credit_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_CREDIT, l2cap, ch_credit);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.credit.credits);
+
+ SER_EVT_DEC_END;
+}
+
+uint32_t ble_l2cap_evt_ch_rx_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_RX, l2cap, ch_rx);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.rx.sdu_len);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.rx.sdu_buf.len);
+
+ SER_PULL_uint32(&p_event->evt.l2cap_evt.params.rx.sdu_buf.p_data);
+ SER_PULL_buf(&p_event->evt.l2cap_evt.params.rx.sdu_buf.p_data, p_event->evt.l2cap_evt.params.rx.sdu_buf.len, p_event->evt.l2cap_evt.params.rx.sdu_buf.len);
+
+ SER_EVT_DEC_END;
+}
+
+
+uint32_t ble_l2cap_evt_ch_tx_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ ble_evt_t * const p_event,
+ uint32_t * const p_event_len)
+{
+ SER_EVT_DEC_BEGIN(BLE_L2CAP_EVT_CH_TX, l2cap, ch_tx);
+
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.conn_handle);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.local_cid);
+ SER_PULL_uint16(&p_event->evt.l2cap_evt.params.tx.sdu_buf.len);
+ SER_PULL_uint32(&p_event->evt.l2cap_evt.params.tx.sdu_buf.p_data);
+
+ SER_EVT_DEC_END;
+}
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.h
new file mode 100644
index 0000000..e2d7958
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/ble_l2cap_evt_app.h
@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_L2CAP_EVT_APP_H__
+#define BLE_L2CAP_EVT_APP_H__
+
+/**@file
+ *
+ * @defgroup ble_l2cap_evt_app L2CAP Application event decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief L2CAP Application event decoders.
+ */
+#include "ble.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Decodes ble_l2cap_evt_rx event.
+ *
+ * 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_l2cap_evt_rx_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 ble_l2cap_evt_ch_setup_request_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 ble_l2cap_evt_ch_setup_refused_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 ble_l2cap_evt_ch_setup_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 ble_l2cap_evt_ch_released_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 ble_l2cap_evt_ch_sdu_buf_released_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 ble_l2cap_evt_ch_credit_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 ble_l2cap_evt_ch_rx_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 ble_l2cap_evt_ch_tx_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
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.c
new file mode 100644
index 0000000..dab842b
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.c
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 "nrf_soc_app.h"
+#include "nrf_soc.h"
+#include <stdlib.h>
+#include <string.h>
+#include "ble_serialization.h"
+#include "cond_field_serialization.h"
+#include "nrf_soc_struct_serialization.h"
+#include "app_util.h"
+
+
+uint32_t ecb_block_encrypt_req_enc(nrf_ecb_hal_data_t * p_ecb_data,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_ECB_BLOCK_ENCRYPT);
+ SER_PUSH_COND(p_ecb_data, nrf_ecb_hal_data_t_in_enc);
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t ecb_block_encrypt_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ nrf_ecb_hal_data_t * * const pp_ecb_data,
+ uint32_t * const p_result_code)
+{
+ SER_RSP_DEC_BEGIN(SD_ECB_BLOCK_ENCRYPT);
+ SER_PULL_COND(pp_ecb_data, nrf_ecb_hal_data_t_out_dec);
+ SER_RSP_DEC_END;
+}
+
+
+uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_POWER_SYSTEM_OFF);
+ SER_REQ_ENC_END;
+}
+
+
+uint32_t temp_get_req_enc(int32_t const * const p_temp,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len)
+{
+ SER_REQ_ENC_BEGIN(SD_TEMP_GET);
+ SER_PUSH_COND(p_temp, NULL);
+ SER_REQ_ENC_END;
+}
+
+uint32_t temp_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code,
+ int32_t * * const pp_temp)
+{
+ SER_RSP_DEC_BEGIN(SD_TEMP_GET);
+ SER_PULL_COND(pp_temp, uint32_t_dec);
+ SER_RSP_DEC_END;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.h
new file mode 100644
index 0000000..ed1cb84
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/ble/serializers/nrf_soc_app.h
@@ -0,0 +1,147 @@
+/**
+ * Copyright (c) 2013 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+/**@file
+ *
+ * @defgroup soc_app SOC Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief SOC Application command request encoders and command response decoders.
+ */
+
+#ifndef NRF_SOC_APP_H__
+#define NRF_SOC_APP_H__
+
+#include <stdint.h>
+#include "nrf_soc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**@brief Encodes @ref sd_power_system_off command request.
+ *
+ *
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t power_system_off_req_enc(uint8_t * const p_buf, uint32_t * const p_buf_len);
+
+
+/**@brief Encodes @ref sd_temp_get command request.
+ *
+ * @sa @ref temp_get_rsp_dec for command response decoder.
+ *
+ * @param[in] p_temp Pointer to result of temperature measurement.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t temp_get_req_enc(int32_t const * const p_temp,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_temp_get command.
+ *
+ * @sa @ref temp_get_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_result_code Command result code.
+ * @param[out] pp_temp Pointer to result of temperature measurement.
+ *
+ * @retval NRF_SUCCESS Version information stored successfully.
+ * @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 temp_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code,
+ int32_t * * const pp_temp);
+
+/**@brief Encodes @ref sd_ecb_block_encrypt command request.
+ *
+ * @sa @ref ecb_block_encrypt_rsp_dec for command response decoder.
+ *
+ * @param[in] p_ecb_data Pointer to ECB data.
+ * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: size of p_buf buffer. \c out: Length of encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ecb_block_encrypt_req_enc(nrf_ecb_hal_data_t * p_ecb_data,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+/**@brief Decodes response to @ref sd_ecb_block_encrypt command.
+ *
+ * @sa @ref ecb_block_encrypt_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to beginning of command response packet.
+ * @param[in] packet_len Length (in bytes) of response packet.
+ * @param[out] p_ecb_data Pointer to ECB data.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Version information stored successfully.
+ * @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 ecb_block_encrypt_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ nrf_ecb_hal_data_t * * const p_ecb_data,
+ uint32_t * const p_result_code);
+/** @} */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // NRF_SOC_APP_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.c
new file mode 100644
index 0000000..fe86167
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.c
@@ -0,0 +1,100 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdint.h>
+#include "app_error.h"
+#include "ble_dtm_app.h"
+#include "ble_serialization.h"
+#include "nrf_error.h"
+#include "ser_config.h"
+#include "ser_hal_transport.h"
+#include "ser_sd_transport.h"
+
+
+static uint32_t dtm_init_rsp_dec(const uint8_t * p_buffer, uint16_t length)
+{
+ uint32_t result_code;
+
+ const uint32_t err_code = ble_dtm_init_rsp_dec(p_buffer, length, &result_code);
+ APP_ERROR_CHECK(err_code);
+
+ return result_code;
+}
+
+
+uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params)
+{
+ if (p_uart_comm_params == NULL)
+ {
+ return NRF_ERROR_NULL;
+ }
+
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t index = 0;
+
+ uint8_t * p_tx_buf = NULL;
+ uint32_t tx_buf_len = 0;
+
+ err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len);
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ p_tx_buf[index++] = SER_PKT_TYPE_DTM_CMD;
+ tx_buf_len -= SER_PKT_TYPE_SIZE;
+
+ err_code = ble_dtm_init_req_enc(p_uart_comm_params, &(p_tx_buf[SER_PKT_TYPE_SIZE]), &tx_buf_len);
+ if (err_code == NRF_SUCCESS)
+ {
+ tx_buf_len += SER_PKT_TYPE_SIZE;
+
+ err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, dtm_init_rsp_dec);
+ if (err_code != NRF_SUCCESS)
+ {
+ err_code = NRF_ERROR_INTERNAL;
+ }
+ }
+ else
+ {
+ err_code = NRF_ERROR_INTERNAL;
+ }
+
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.h
new file mode 100644
index 0000000..3d008a3
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_app.h
@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef BLE_DTM_APP_H__
+#define BLE_DTM_APP_H__
+
+/**
+ * @addtogroup ser_codecs Serialization codecs
+ * @ingroup ble_sdk_lib_serialization
+ * @brief Application and Connectivity codecs.
+ */
+
+/**
+ * @addtogroup ser_codecs_app Application codecs
+ * @ingroup ser_codecs
+ */
+
+/**
+ * @addtogroup ser_app_common_codecs Application common codecs
+ * @ingroup ser_codecs_app
+ */
+
+/**@file
+ *
+ * @defgroup ble_dtm_app DTM Application command request encoders and command response decoders
+ * @{
+ * @ingroup ser_app_common_codecs
+ *
+ * @brief DTM Application command request encoders and command response decoders.
+ */
+
+#include "dtm_uart_params.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**@brief Encodes the @ref ble_dtm_init command request.
+ *
+ * @sa @ref encoding_data for packet format,
+ * @ref ble_dtm_init_rsp_dec for command response decoder.
+ *
+ * @param[in] p_uart_comm_params Pointer to the UART configuration parameters.
+ * @param[in] p_buf Pointer to the buffer where encoded data command will be returned.
+ * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
+ * \c out: Length of the encoded command packet.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
+ */
+uint32_t ble_dtm_init_req_enc(app_uart_stream_comm_params_t const * const p_uart_comm_params,
+ uint8_t * const p_buf,
+ uint32_t * const p_buf_len);
+
+
+/**@brief Decodes the response @ref ble_dtm_init command.
+ *
+ * @sa @ref encoding_data for packet format,
+ * @ref ble_dtm_init_req_enc for command request encoder.
+ *
+ * @param[in] p_buf Pointer to the beginning of a command response packet.
+ * @param[in] packet_len Length (in bytes) of the response packet.
+ * @param[out] p_result_code Command result code.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
+ */
+uint32_t ble_dtm_init_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code);
+
+
+/**@brief Function to initializing the DTM mode.
+ *
+ * @param[in] p_uart_comm_params Pointer to the DTM UART configuration parameters.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
+ */
+uint32_t ble_dtm_init(app_uart_stream_comm_params_t * p_uart_comm_params);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // BLE_DTM_APP_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_init.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_init.c
new file mode 100644
index 0000000..16e3c47
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/ble_dtm_init.c
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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_dtm_app.h"
+#include "ble_serialization.h"
+#include "nrf_error.h"
+
+uint32_t ble_dtm_init_req_enc(app_uart_stream_comm_params_t const * const p_uart_comm_params, uint8_t * const p_buf, uint32_t * const p_buf_len)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+ SER_ASSERT_NOT_NULL(p_uart_comm_params);
+
+ uint32_t index = 0;
+ uint32_t buf_len = *p_buf_len;
+ uint32_t err_code;
+
+ err_code = uint8_t_enc(&p_uart_comm_params->tx_pin_no, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&p_uart_comm_params->rx_pin_no, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint8_t_enc(&p_uart_comm_params->baud_rate, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ble_dtm_init_rsp_dec(uint8_t const * const p_buf, uint32_t packet_len, uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t err_code;
+ uint32_t index = 0;
+
+ err_code = uint32_t_dec(p_buf, packet_len, &index, p_result_code);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT(packet_len == index, NRF_ERROR_INVALID_LENGTH);
+
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.c
new file mode 100644
index 0000000..b98e6d5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.c
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdint.h>
+#include "ble_serialization.h"
+#include "ser_hal_transport.h"
+#include "ser_sd_transport.h"
+
+
+uint32_t conn_systemreset(void)
+{
+ uint32_t err_code = NRF_SUCCESS;
+ uint8_t * p_tx_buf = NULL;
+ uint32_t tx_buf_len = 0;
+
+ err_code = ser_hal_transport_tx_pkt_alloc(&p_tx_buf, (uint16_t *)&tx_buf_len);
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ SER_ASSERT_LENGTH_LEQ(SER_PKT_TYPE_SIZE, tx_buf_len);
+ p_tx_buf[SER_PKT_TYPE_POS] = SER_PKT_TYPE_RESET_CMD;
+ tx_buf_len = SER_PKT_TYPE_SIZE;
+
+ err_code = ser_sd_transport_cmd_write(p_tx_buf, tx_buf_len, NULL);
+ if (err_code != NRF_SUCCESS)
+ {
+ err_code = NRF_ERROR_INTERNAL;
+ }
+
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.h
new file mode 100644
index 0000000..00ea5f5
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/codecs/common/conn_systemreset.h
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef CONN_SYSTEMRESET_H__
+#define CONN_SYSTEMRESET_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup ser_codecs Serialization codecs
+ * @ingroup ble_sdk_lib_serialization
+ */
+
+/**
+ * @addtogroup ser_app_common_codecs Application common codecs
+ * @ingroup ser_codecs_app
+ */
+
+/**@file
+ *
+ * @defgroup conn_systemreset Connectivity chip reset command request encoder
+ * @{
+ * @ingroup ser_app_common_codecs
+ *
+ * @brief Connectivity chip reset command request encoder.
+ */
+
+/**@brief Function for performing the connectivity chip reset.
+ *
+ * @retval NRF_SUCCESS Encoding success.
+ * @retval NRF_ERROR_INTERNAL Encoding failure. Transport error.
+ */
+uint32_t conn_systemreset(void);
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CONN_SYSTEMRESET_H__
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal.h
new file mode 100644
index 0000000..3c87057
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal.h
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+/**@file
+ *
+ * @defgroup ser_app_hal Serialization Application Hardware Abstraction Layer (HAL)
+ * @{
+ * @ingroup ble_sdk_lib_serialization
+ *
+ * @brief Functions that set up hardware on Application Board and perform the reset of the Connectivity Board.
+ */
+
+#ifndef SER_APP_HAL_H_
+#define SER_APP_HAL_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef void (*ser_app_hal_flash_op_done_handler_t)(bool success);
+/**@brief Function for initializing hardware modules.
+ *
+ * @details Function can initialize hardware modules on the Application Chip. It is optional to
+ * implement. It is called once the Connectivity Chip is initialized.
+ *
+ * @param handler Flash operation event handler.
+ *
+ * @return @ref NRF_SUCCESS HAL initialized successfully.
+ * @return @ref nrf_error "NRF_ERROR_..." HAL initialization failed.
+ *
+ */
+uint32_t ser_app_hal_hw_init(ser_app_hal_flash_op_done_handler_t handler);
+
+/**@brief Function for waiting for a given amount of time.
+ *
+ * @param[in] ms Number of milliseconds to wait.
+ *
+ */
+void ser_app_hal_delay(uint32_t ms);
+
+/**@brief Function for clearing the Connectivity Chip reset pin.
+ *
+ */
+void ser_app_hal_nrf_reset_pin_clear(void);
+
+/**@brief Function for setting the Connectivity Chip reset pin.
+ *
+ */
+void ser_app_hal_nrf_reset_pin_set(void);
+
+
+/**@brief Function for setting the SoftDevice event interrupt priority that serves the events incoming
+ * from the Connectivity Chip.
+ *
+ * @note Serialization solution on the application side mimics a SoC solution where events are handled in
+ * the interrupt context in two ways: either directly in the interrupt context or with a message being posted to
+ * the scheduler. However, it is possible that the Application Chip does not use a dedicated interrupt
+ * for connectivity events. In that case, this function can be left empty and
+ * \ref ser_app_hal_nrf_evt_pending will directly call an interrupt handler function.
+ */
+void ser_app_hal_nrf_evt_irq_priority_set(void);
+
+/**@brief Function for setting a pending interrupt for serving events incoming from the Connectivity Chip.
+ *
+ * @note The interrupt used for event from the Connectivity Chip mimics behavior of SoC and it is not
+ * intended to be triggered by any hardware event. This function should be the only source of
+ * interrupt triggering.
+ */
+void ser_app_hal_nrf_evt_pending(void);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SER_APP_HAL_H_ */
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal_nrf5x.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal_nrf5x.c
new file mode 100644
index 0000000..7304a12
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_hal_nrf5x.c
@@ -0,0 +1,163 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 "app_util_platform.h"
+#include "ser_app_hal.h"
+#include "nrf.h"
+#include "nrf_gpio.h"
+#include "nrf_soc.h"
+#include "nrf_delay.h"
+#include "nrf_nvmc.h"
+#include "boards.h"
+#include "ser_phy.h"
+#include "ser_phy_config_app.h"
+#include "nrf_drv_clock.h"
+
+#define SOFTDEVICE_EVT_IRQ SD_EVT_IRQn /**< SoftDevice Event IRQ number. Used for both protocol events and SoC events. */
+#define FLASH_WRITE_MAX_LENGTH ((uint16_t)NRF_FICR->CODEPAGESIZE)
+#define BLE_FLASH_PAGE_SIZE ((uint16_t)NRF_FICR->CODEPAGESIZE) /**< Size of one flash page. */
+
+static ser_app_hal_flash_op_done_handler_t m_flash_op_handler;
+uint32_t ser_app_hal_hw_init(ser_app_hal_flash_op_done_handler_t handler)
+{
+ nrf_gpio_cfg_output(CONN_CHIP_RESET_PIN_NO);
+
+ if (NRF_SUCCESS != nrf_drv_clock_init())
+ {
+ return NRF_ERROR_INTERNAL;
+ }
+
+ nrf_drv_clock_lfclk_request(NULL);
+ nrf_drv_clock_hfclk_request(NULL);
+
+ while (false == nrf_drv_clock_hfclk_is_running());
+ while (false == nrf_drv_clock_lfclk_is_running());
+
+ m_flash_op_handler = handler;
+
+ return NRF_SUCCESS;
+}
+
+void ser_app_hal_delay(uint32_t ms)
+{
+ nrf_delay_ms(ms);
+}
+
+void ser_app_hal_nrf_reset_pin_clear()
+{
+ nrf_gpio_pin_clear(CONN_CHIP_RESET_PIN_NO);
+}
+
+void ser_app_hal_nrf_reset_pin_set()
+{
+ nrf_gpio_pin_set(CONN_CHIP_RESET_PIN_NO);
+}
+
+void ser_app_hal_nrf_evt_irq_priority_set()
+{
+ NVIC_SetPriority(SOFTDEVICE_EVT_IRQ, APP_IRQ_PRIORITY_LOWEST);
+}
+
+void ser_app_hal_nrf_evt_pending()
+{
+ NVIC_SetPendingIRQ(SOFTDEVICE_EVT_IRQ);
+}
+
+uint32_t sd_ppi_channel_enable_get(uint32_t * p_channel_enable)
+{
+ *p_channel_enable = NRF_PPI->CHEN;
+ return NRF_SUCCESS;
+}
+
+uint32_t sd_ppi_channel_enable_set(uint32_t channel_enable_set_msk)
+{
+ NRF_PPI->CHEN = channel_enable_set_msk;
+ return NRF_SUCCESS;
+}
+
+uint32_t sd_ppi_channel_assign(uint8_t channel_num,
+ const volatile void * evt_endpoint,
+ const volatile void * task_endpoint)
+{
+ NRF_PPI->CH[channel_num].TEP = (uint32_t)task_endpoint;
+ NRF_PPI->CH[channel_num].EEP = (uint32_t)evt_endpoint;
+ return NRF_SUCCESS;
+}
+/**
+ * @brief Check if given address is in device FLASH range.
+ *
+ * @param[in] ptr Address to check.
+ * @retval true Given address is located in FLASH.
+ * @retval false Given address is not located in FLASH.
+ */
+__STATIC_INLINE bool addr_is_in_FLASH(void const * const ptr)
+{
+ return ((((uintptr_t)ptr) & 0xFF000000u) == 0x00000000u);
+}
+
+uint32_t sd_flash_page_erase(uint32_t page_number)
+{
+ uint32_t * p_page = (uint32_t *)(BLE_FLASH_PAGE_SIZE * page_number);
+
+ if (!addr_is_in_FLASH(p_page))
+ {
+ return NRF_ERROR_INVALID_ADDR;
+ }
+
+ nrf_nvmc_page_erase((uint32_t) p_page);
+ m_flash_op_handler(true);
+ return NRF_SUCCESS;
+}
+
+uint32_t sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size)
+{
+ if (size > FLASH_WRITE_MAX_LENGTH)
+ {
+ return NRF_ERROR_INVALID_LENGTH;
+ }
+
+ if (!addr_is_in_FLASH(p_dst))
+ {
+ return NRF_ERROR_INVALID_ADDR;
+ }
+
+ nrf_nvmc_write_words((uint32_t) p_dst, p_src, size);
+ m_flash_op_handler(true);
+ return NRF_SUCCESS;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.c
new file mode 100644
index 0000000..056636f
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.c
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 "nrf.h"
+#include "ser_app_power_system_off.h"
+
+static bool m_power_system_off = false;
+
+
+void ser_app_power_system_off_set(void)
+{
+ m_power_system_off = true;
+}
+
+bool ser_app_power_system_off_get(void)
+{
+ return m_power_system_off;
+}
+
+void ser_app_power_system_off_enter(void)
+{
+ NRF_POWER->SYSTEMOFF = POWER_SYSTEMOFF_SYSTEMOFF_Enter;
+
+ /*Only for debugging purpose, will not be reached without connected debugger*/
+ while (1);
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.h
new file mode 100644
index 0000000..914a59e
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/hal/ser_app_power_system_off.h
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+#ifndef APP_POWER_SYSTEM_OFF_H
+#define APP_POWER_SYSTEM_OFF_H
+
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void ser_app_power_system_off_set(void);
+
+bool ser_app_power_system_off_get(void);
+
+void ser_app_power_system_off_enter(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.c
new file mode 100644
index 0000000..8f0118a
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.c
@@ -0,0 +1,325 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+#include "ser_sd_transport.h"
+#include "ser_hal_transport.h"
+#include "nrf_error.h"
+#include "app_error.h"
+#include "ble_serialization.h"
+#include "ser_dbg_sd_str.h"
+#include "ser_app_power_system_off.h"
+#include "app_util.h"
+#define NRF_LOG_MODULE_NAME ser_xfer
+#include "nrf_log.h"
+NRF_LOG_MODULE_REGISTER();
+
+#ifdef BLE_STACK_SUPPORT_REQD
+/** SoftDevice event handler. */
+static ser_sd_transport_evt_handler_t m_ble_evt_handler = NULL;
+#endif // BLE_STACK_SUPPORT_REQD
+
+#ifdef ANT_STACK_SUPPORT_REQD
+/** SoftDevice event handler for ANT events. */
+static ser_sd_transport_evt_handler_t m_ant_evt_handler = NULL;
+#endif // ANT_STACK_SUPPORT_REQD
+
+/** 'One time' handler called in task context while waiting for response to scheduled command. */
+static ser_sd_transport_rsp_wait_handler_t m_ot_rsp_wait_handler = NULL;
+
+/** Handler called in task context while waiting for response to scheduled command. */
+static ser_sd_transport_rsp_wait_handler_t m_os_rsp_wait_handler = NULL;
+
+/** Handler called in serial peripheral interrupt context when response is received. */
+static ser_sd_transport_rsp_set_handler_t m_os_rsp_set_handler = NULL;
+
+/** Handler called when hal_transport notifies that packet reception has started. */
+static ser_sd_transport_rx_notification_handler_t m_rx_notify_handler = NULL;
+
+/** User decoder handler for expected response packet. */
+static ser_sd_transport_rsp_handler_t m_rsp_dec_handler = NULL;
+
+/** Flag indicated whether module is waiting for response packet. */
+static volatile bool m_rsp_wait = false;
+
+/** SoftDevice call return value decoded by user decoder handler. */
+static uint32_t m_return_value;
+
+/**@brief Function for handling the rx packets comming from hal_transport.
+ *
+ * @details
+ * This function is called in serial peripheral interrupt context. Response packets are handled in
+ * this context. Events are passed to the application and it is up to application in which context
+ * they are handled.
+ *
+ * @param[in] p_data Pointer to received data.
+ * @param[in] length Size of data.
+ */
+static void ser_sd_transport_rx_packet_handler(uint8_t * p_data, uint16_t length)
+{
+ if (p_data && (length >= SER_PKT_TYPE_SIZE))
+ {
+ const uint8_t packet_type = p_data[SER_PKT_TYPE_POS];
+ p_data += SER_PKT_TYPE_SIZE;
+ length -= SER_PKT_TYPE_SIZE;
+
+ switch (packet_type)
+ {
+ case SER_PKT_TYPE_RESP:
+ case SER_PKT_TYPE_DTM_RESP:
+#ifdef ANT_STACK_SUPPORT_REQD
+ case SER_PKT_TYPE_ANT_RESP:
+#endif // ANT_STACK_SUPPORT_REQD
+ if (m_rsp_wait)
+ {
+ m_return_value = m_rsp_dec_handler(p_data, length);
+ (void)ser_sd_transport_rx_free(p_data);
+
+ /* Reset response flag - cmd_write function is pending on it.*/
+ m_rsp_wait = false;
+
+ /* If os handler is set, signal os that response has arrived.*/
+ if (m_os_rsp_set_handler)
+ {
+ m_os_rsp_set_handler();
+ }
+ }
+ else
+ {
+ /* Unexpected packet. */
+ (void)ser_sd_transport_rx_free(p_data);
+ APP_ERROR_HANDLER(packet_type);
+ }
+ break;
+
+#ifdef BLE_STACK_SUPPORT_REQD
+ case SER_PKT_TYPE_EVT:
+ /* It is ensured during opening that handler is not NULL. No check needed. */
+ NRF_LOG_DEBUG("[EVT]: %s ", (uint32_t)ser_dbg_sd_evt_str_get(uint16_decode(&p_data[SER_EVT_ID_POS]))); // p_data points to EVT_ID
+ m_ble_evt_handler(p_data, length);
+ break;
+#endif // BLE_STACK_SUPPORT_REQD
+
+#ifdef ANT_STACK_SUPPORT_REQD
+ case SER_PKT_TYPE_ANT_EVT:
+ /* It is ensured during opening that handler is not NULL. No check needed. */
+ NRF_LOG_DEBUG("[ANT_EVT_ID]: %s ", (uint32_t)ser_dbg_sd_evt_str_get(uint16_decode(&p_data[SER_EVT_ID_POS]))); // p_data points to EVT_ID
+ m_ant_evt_handler(p_data, length);
+ break;
+#endif // ANT_STACK_SUPPORT_REQD
+
+ default:
+ (void)ser_sd_transport_rx_free(p_data);
+ APP_ERROR_HANDLER(packet_type);
+ break;
+ }
+ }
+}
+
+/**@brief Function for handling the event from hal_transport.
+ *
+ * @param[in] event Event from hal_transport.
+ */
+static void ser_sd_transport_hal_handler(ser_hal_transport_evt_t event)
+{
+ switch (event.evt_type)
+ {
+ case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED:
+ ser_sd_transport_rx_packet_handler(event.evt_params.rx_pkt_received.p_buffer,
+ event.evt_params.rx_pkt_received.num_of_bytes);
+ break;
+ case SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING:
+ if (m_rx_notify_handler)
+ {
+ m_rx_notify_handler();
+ }
+ break;
+ case SER_HAL_TRANSP_EVT_TX_PKT_SENT:
+ if (ser_app_power_system_off_get() == true)
+ {
+ ser_app_power_system_off_enter();
+ }
+ break;
+ case SER_HAL_TRANSP_EVT_PHY_ERROR:
+
+ if (m_rsp_wait)
+ {
+ m_return_value = NRF_ERROR_INTERNAL;
+
+ /* Reset response flag - cmd_write function is pending on it.*/
+ m_rsp_wait = false;
+
+ /* If os handler is set, signal os that response has arrived.*/
+ if (m_os_rsp_set_handler)
+ {
+ m_os_rsp_set_handler();
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+uint32_t ser_sd_transport_open(ser_sd_transport_evt_handler_t ble_evt_handler,
+ ser_sd_transport_evt_handler_t ant_evt_handler,
+ ser_sd_transport_rsp_wait_handler_t os_rsp_wait_handler,
+ ser_sd_transport_rsp_set_handler_t os_rsp_set_handler,
+ ser_sd_transport_rx_notification_handler_t rx_not_handler)
+{
+ m_os_rsp_wait_handler = os_rsp_wait_handler;
+ m_os_rsp_set_handler = os_rsp_set_handler;
+ m_rx_notify_handler = rx_not_handler;
+ m_ot_rsp_wait_handler = NULL;
+
+#ifdef ANT_STACK_SUPPORT_REQD
+ m_ant_evt_handler = ant_evt_handler;
+
+ if (m_ant_evt_handler == NULL)
+ {
+ return NRF_ERROR_INVALID_PARAM;
+ }
+#else
+ UNUSED_PARAMETER(ant_evt_handler);
+#endif // ANT_STACK_SUPPORT_REQD
+
+#ifdef BLE_STACK_SUPPORT_REQD
+ m_ble_evt_handler = ble_evt_handler;
+
+ if (m_ble_evt_handler == NULL)
+ {
+ return NRF_ERROR_INVALID_PARAM;
+ }
+#else
+ UNUSED_PARAMETER(ble_evt_handler);
+#endif // BLE_STACK_SUPPORT_REQD
+
+ return ser_hal_transport_open(ser_sd_transport_hal_handler);
+}
+
+uint32_t ser_sd_transport_close(void)
+{
+#ifdef ANT_STACK_SUPPORT_REQD
+ m_ant_evt_handler = NULL;
+#endif // ANT_STACK_SUPPORT_REQD
+
+#ifdef BLE_STACK_SUPPORT_REQD
+ m_ble_evt_handler = NULL;
+#endif // BLE_STACK_SUPPORT_REQD
+
+ m_os_rsp_wait_handler = NULL;
+ m_os_rsp_set_handler = NULL;
+ m_ot_rsp_wait_handler = NULL;
+
+ ser_hal_transport_close();
+
+ return NRF_SUCCESS;
+}
+
+uint32_t ser_sd_transport_ot_rsp_wait_handler_set(ser_sd_transport_rsp_wait_handler_t handler)
+{
+ m_ot_rsp_wait_handler = handler;
+
+ return NRF_SUCCESS;
+}
+
+bool ser_sd_transport_is_busy(void)
+{
+ return m_rsp_wait;
+}
+
+uint32_t ser_sd_transport_tx_alloc(uint8_t * * pp_data, uint16_t * p_len)
+{
+ uint32_t err_code;
+
+ if (m_rsp_wait)
+ {
+ err_code = NRF_ERROR_BUSY;
+ }
+ else
+ {
+ err_code = ser_hal_transport_tx_pkt_alloc(pp_data, p_len);
+ }
+ return err_code;
+}
+
+uint32_t ser_sd_transport_tx_free(uint8_t * p_data)
+{
+ return ser_hal_transport_tx_pkt_free(p_data);
+}
+
+uint32_t ser_sd_transport_rx_free(uint8_t * p_data)
+{
+ p_data -= SER_PKT_TYPE_SIZE;
+ return ser_hal_transport_rx_pkt_free(p_data);
+}
+
+uint32_t ser_sd_transport_cmd_write(const uint8_t * p_buffer,
+ uint16_t length,
+ ser_sd_transport_rsp_handler_t cmd_rsp_decode_callback)
+{
+ uint32_t err_code = NRF_SUCCESS;
+
+ m_rsp_wait = true;
+ m_rsp_dec_handler = cmd_rsp_decode_callback;
+ err_code = ser_hal_transport_tx_pkt_send(p_buffer, length);
+ APP_ERROR_CHECK(err_code);
+
+ /* Execute callback for response decoding only if one was provided.*/
+ if ((err_code == NRF_SUCCESS) && cmd_rsp_decode_callback)
+ {
+ if (m_ot_rsp_wait_handler)
+ {
+ m_ot_rsp_wait_handler();
+ m_ot_rsp_wait_handler = NULL;
+ }
+
+ m_os_rsp_wait_handler();
+ err_code = m_return_value;
+ }
+ else
+ {
+ m_rsp_wait = false;
+ }
+
+ NRF_LOG_DEBUG("[SD_CALL]:%s, err_code= 0x%X", (uint32_t)ser_dbg_sd_call_str_get(p_buffer[1]), err_code);
+ return err_code;
+}
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.h
new file mode 100644
index 0000000..77dadf2
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_sd_transport.h
@@ -0,0 +1,193 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+/**
+ * @addtogroup ser_app Application side code
+ * @ingroup ble_sdk_lib_serialization
+ * @brief SoftDevice handler and transport on the application side.
+ */
+
+/** @file
+ *
+ * @defgroup ser_sd_transport Serialization SoftDevice Transport
+ * @{
+ * @ingroup ser_app
+ *
+ * @brief Serialization SoftDevice Transport on application side.
+ *
+ * @details This file contains declarations of functions and definitions of data structures and
+ * identifiers (typedef enum) used as API of the serialization of SoftDevice. This layer
+ * ensures atomic nature of SoftDevice calls (command and waiting for response). Packet
+ * type field of incoming packets is handled in this layer - responses are handled by
+ * ser_sd_transport (using response decoder handler provided for each SoftDevice call), but
+ * events are forwarded to the user so it is up to the user to free the RX buffer.
+ *
+ */
+#ifndef SER_SD_TRANSPORT_H_
+#define SER_SD_TRANSPORT_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*ser_sd_transport_evt_handler_t)(uint8_t * p_buffer, uint16_t length);
+typedef void (*ser_sd_transport_rsp_wait_handler_t)(void);
+typedef void (*ser_sd_transport_rsp_set_handler_t)(void);
+typedef void (*ser_sd_transport_rx_notification_handler_t)(void);
+
+typedef uint32_t (*ser_sd_transport_rsp_handler_t)(const uint8_t * p_buffer, uint16_t length);
+
+/**@brief Function for opening the module.
+ *
+ * @note 'Wait for response' and 'Response set' callbacks can be set in RTOS environment.
+ * It enables rescheduling while waiting for the Connectivity Chip response. In a nonOS environment,
+ * usually 'Wait for response' will only be used for handling incoming events or forcing the
+ * application to low power mode.
+ *
+ * @param[in] ble_evt_handler Handler to be called when ble event packet is received.
+ * @param[in] ant_evt_handler Handler to be called when ant event packet is received.
+ * @param[in] os_rsp_wait_handler Handler to be called after the request is send. It should
+ * implement a 'Wait for signal' functionality in an OS environment.
+ * @param[in] os_rsp_set_handler Handler to be called after response reception. It should
+ * implement a 'Signal Set' functionality in an OS environment.
+ * @param[in] rx_not_handler Handler to be called after the transport layer notifies that
+ * an incoming RX packet is detected.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ * @retval NRF_ERROR_NULL Operation failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_PARAM Operation failure. Parameter propagated from ser_hal_transport
+ * opening or timer creation.
+ * @retval NRF_ERROR_INVALID_STATE Operation failure. Parameter propagated from ser_hal_transport
+ * opening or timer creation.
+ * @retval NRF_ERROR_INTERNAL Operation failure. Parameter propagated from ser_hal_transport
+ * opening or timer creation.
+ * @retval NRF_ERROR_NO_MEM Operation failure. Parameter propagated from timer creation.
+ */
+uint32_t ser_sd_transport_open(ser_sd_transport_evt_handler_t ble_evt_handler,
+ ser_sd_transport_evt_handler_t ant_evt_handler,
+ ser_sd_transport_rsp_wait_handler_t os_rsp_wait_handler,
+ ser_sd_transport_rsp_set_handler_t os_rsp_set_handler,
+ ser_sd_transport_rx_notification_handler_t rx_not_handler);
+
+
+/**@brief Function setting a 'One Time' handler to be called between sending the next request packet and
+ * receiving the response packet.
+ * @note It is intended to be used in a nonOS environment to implement concurrency.
+ * @note It is a 'One Time' handler meaning that it is valid only for the next SoftDevice call processing.
+ *
+ *
+ * @param[in] wait_handler Handler to be called after the request packet is sent.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t ser_sd_transport_ot_rsp_wait_handler_set(ser_sd_transport_rsp_wait_handler_t wait_handler);
+
+
+/**@brief Function for closing the module.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t ser_sd_transport_close(void);
+
+/**@brief Function for allocating a TX packet to be used for request command.
+ *
+ * @param[out] pp_data Pointer to the data pointer to be set to point to allocated buffer.
+ * @param[out] p_len Pointer to allocated buffer length.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t ser_sd_transport_tx_alloc(uint8_t * * pp_data, uint16_t * p_len);
+
+
+/**@brief Function for freeing a TX packet.
+ *
+ * @note Function should be called once the command is processed.
+ *
+ * @param[out] p_data Pointer to the allocated TX buffer.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t ser_sd_transport_tx_free(uint8_t * p_data);
+
+
+/**@brief Function for freeing an RX event packet.
+ *
+ * @note Function should be called once the SoftDevice event buffer is processed.
+ *
+ * @param[out] p_data Pointer to the allocated RX buffer.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t ser_sd_transport_rx_free(uint8_t * p_data);
+
+
+/**@brief Function for checking if module is busy waiting for response from connectivity side.
+ *
+ * @retval true Module busy. Cannot accept the next command.
+ * @retval false Module not busy. Can accept next the command.
+ */
+bool ser_sd_transport_is_busy(void);
+
+/**@brief Function for handling a SoftDevice command.
+ *
+ * @note Function blocks task context until response is received and processed.
+ * @note Non-blocking functionality can be achieved using OS handlers or a 'One Time' handler
+ * @warning Function should not be called from interrupt context, which would block switching to
+ * serial port interrupt.
+ *
+ * @param[in] p_buffer Pointer to command.
+ * @param[in] length Pointer to allocated buffer length.
+ * @param[in] cmd_resp_decode_callback Pointer to a function for decoding the response packet.
+ *
+ * @retval NRF_SUCCESS Operation success.
+ */
+uint32_t ser_sd_transport_cmd_write(const uint8_t * p_buffer,
+ uint16_t length,
+ ser_sd_transport_rsp_handler_t cmd_resp_decode_callback);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SER_SD_TRANSPORT_H_ */
+/** @} */
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.c b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.c
new file mode 100644
index 0000000..57db847
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.c
@@ -0,0 +1,311 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 <stdlib.h>
+#include <string.h>
+#include "nrf_queue.h"
+#include "app_scheduler.h"
+#include "nrf_sdh.h"
+#include "nrf_sdm.h"
+#include "ser_sd_transport.h"
+#include "ser_app_hal.h"
+#include "ser_config.h"
+#include "nrf_soc.h"
+#include "ble_serialization.h"
+#if defined(BLE_STACK_SUPPORT_REQD)
+#include "ble_app.h"
+#include "nrf_sdh_ble.h"
+#endif
+#if defined(ANT_STACK_SUPPORT_REQD)
+#include "ant_event.h"
+#endif
+
+#define SD_BLE_EVT_MAILBOX_QUEUE_SIZE 5 /**< Size of mailbox queue. */
+
+/** @brief Structure used to pass packet details through mailbox.
+ */
+#if defined(BLE_STACK_SUPPORT_REQD)
+typedef struct
+{
+ //lint -save -e666
+ uint32_t evt_data[CEIL_DIV(NRF_SDH_BLE_EVT_BUF_SIZE, sizeof (uint32_t))]; /**< Buffer for decoded event */
+ //lint -restore
+} ser_sd_handler_evt_data_t;
+#endif
+
+#if defined(ANT_STACK_SUPPORT_REQD)
+typedef struct
+{
+ uint32_t evt_data[CEIL_DIV(sizeof(ant_evt_t), sizeof (uint32_t))]; /**< Buffer for decoded event */
+} ser_ant_sd_handler_evt_data_t;
+#endif
+
+/** @brief
+ * Mailbox used for communication between event handler (called from serial stream
+ * interrupt context) and event processing function (called from scheduler or interrupt context).
+ */
+#if defined(BLE_STACK_SUPPORT_REQD)
+NRF_QUEUE_DEF(ser_sd_handler_evt_data_t,
+ m_sd_ble_evt_mailbox,
+ SD_BLE_EVT_MAILBOX_QUEUE_SIZE,
+ NRF_QUEUE_MODE_NO_OVERFLOW);
+#endif
+
+#if defined(ANT_STACK_SUPPORT_REQD)
+NRF_QUEUE_DEF(ser_ant_sd_handler_evt_data_t,
+ m_sd_ant_evt_mailbox,
+ SD_BLE_EVT_MAILBOX_QUEUE_SIZE,
+ NRF_QUEUE_MODE_NO_OVERFLOW);
+#endif
+
+NRF_QUEUE_DEF(uint32_t,
+ m_sd_soc_evt_mailbox,
+ SD_BLE_EVT_MAILBOX_QUEUE_SIZE,
+ NRF_QUEUE_MODE_NO_OVERFLOW);
+
+/**
+ * @brief Function to be replaced by user implementation if needed.
+ *
+ * Weak function - user can add different implementation of this function if application needs it.
+ */
+__WEAK void os_rsp_set_handler(void)
+{
+
+}
+
+static void connectivity_reset_low(void)
+{
+ //Signal a reset to the connectivity chip by setting the reset pin low.
+ ser_app_hal_nrf_reset_pin_clear();
+ ser_app_hal_delay(CONN_CHIP_RESET_TIME);
+
+}
+
+static void connectivity_reset_high(void)
+{
+
+ //Set the reset level to high again.
+ ser_app_hal_nrf_reset_pin_set();
+
+ //Wait for connectivity chip to be ready.
+ ser_app_hal_delay(CONN_CHIP_WAKEUP_TIME);
+}
+
+#if defined(BLE_STACK_SUPPORT_REQD)
+static void ser_softdevice_ble_evt_handler(uint8_t * p_data, uint16_t length)
+{
+ ser_sd_handler_evt_data_t item;
+ uint32_t err_code;
+ uint32_t len32 = sizeof (item.evt_data);
+
+ err_code = ble_event_dec(p_data, length, (ble_evt_t *)item.evt_data, &len32);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = ser_sd_transport_rx_free(p_data);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = nrf_queue_push(&m_sd_ble_evt_mailbox, &item);
+ APP_ERROR_CHECK(err_code);
+
+ ser_app_hal_nrf_evt_pending();
+}
+#endif
+
+#if defined(ANT_STACK_SUPPORT_REQD)
+static void ser_softdevice_ant_evt_handler(uint8_t * p_data, uint16_t length)
+{
+ ser_ant_sd_handler_evt_data_t item;
+ uint32_t err_code;
+ uint32_t len32 = sizeof (item.evt_data);
+
+ err_code = ant_event_dec(p_data, length, (ant_evt_t *)item.evt_data, &len32);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = ser_sd_transport_rx_free(p_data);
+ APP_ERROR_CHECK(err_code);
+
+ err_code = nrf_queue_push(&m_sd_ant_evt_mailbox, &item);
+ APP_ERROR_CHECK(err_code);
+
+ ser_app_hal_nrf_evt_pending();
+}
+#endif
+
+void ser_softdevice_flash_operation_success_evt(bool success)
+{
+ uint32_t evt_type = success ? NRF_EVT_FLASH_OPERATION_SUCCESS :
+ NRF_EVT_FLASH_OPERATION_ERROR;
+
+ uint32_t err_code = nrf_queue_push(&m_sd_soc_evt_mailbox, &evt_type);
+ APP_ERROR_CHECK(err_code);
+
+ ser_app_hal_nrf_evt_pending();
+}
+
+/**
+ * @brief Function called while waiting for connectivity chip response. It handles incoming events.
+ */
+static void ser_sd_rsp_wait(void)
+{
+ do
+ {
+ (void)sd_app_evt_wait();
+
+ //intern_softdevice_events_execute();
+ }
+ while (ser_sd_transport_is_busy());
+}
+
+uint32_t sd_evt_get(uint32_t * p_evt_id)
+{
+ return nrf_queue_pop(&m_sd_soc_evt_mailbox, p_evt_id);
+}
+
+#if defined(BLE_STACK_SUPPORT_REQD)
+uint32_t sd_ble_evt_get(uint8_t * p_data, uint16_t * p_len)
+{
+ uint32_t err_code = nrf_queue_pop(&m_sd_ble_evt_mailbox, p_data);
+
+ if (err_code == NRF_SUCCESS) //if anything in the mailbox
+ {
+ if (((ble_evt_t *)p_data)->header.evt_len > *p_len)
+ {
+ err_code = NRF_ERROR_DATA_SIZE;
+ }
+ else
+ {
+ *p_len = ((ble_evt_t *)p_data)->header.evt_len;
+ }
+ }
+ else
+ {
+ err_code = NRF_ERROR_NOT_FOUND;
+ }
+
+ return err_code;
+}
+#endif
+
+#if defined(ANT_STACK_SUPPORT_REQD)
+uint32_t sd_ant_event_get(uint8_t* p_channel, uint8_t* p_event, uint8_t* p_ant_mesg)
+{
+ SER_ASSERT_NOT_NULL(p_channel);
+ SER_ASSERT_NOT_NULL(p_event);
+ SER_ASSERT_NOT_NULL(p_ant_mesg);
+
+ uint32_t err_code;
+
+ ser_ant_sd_handler_evt_data_t item;
+
+ err_code = nrf_queue_pop(&m_sd_ant_evt_mailbox, &item);
+
+ if (err_code == NRF_SUCCESS)
+ {
+ *p_event = ((ant_evt_t *)item.evt_data) -> event;
+ *p_channel = ((ant_evt_t *)item.evt_data) -> channel;
+ memcpy(p_ant_mesg, ((ant_evt_t *)item.evt_data)->message.aucMessage, MESG_BUFFER_SIZE);
+ } else {
+ err_code = NRF_ERROR_NOT_FOUND;
+ }
+
+ return err_code;
+}
+#endif
+
+#if defined(BLE_STACK_SUPPORT_REQD)
+uint32_t sd_ble_evt_mailbox_length_get(uint32_t * p_mailbox_length)
+{
+ *p_mailbox_length = nrf_queue_utilization_get(&m_sd_ble_evt_mailbox);
+ return NRF_SUCCESS;
+}
+#endif
+
+#if (defined(S332) || defined(S212))
+uint32_t sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg,
+ nrf_fault_handler_t fault_handler,
+ const char* p_license_key)
+#else
+uint32_t sd_softdevice_enable(nrf_clock_lf_cfg_t const * p_clock_lf_cfg,
+ nrf_fault_handler_t assertion_handler)
+#endif
+{
+ uint32_t err_code;
+
+ err_code = ser_app_hal_hw_init(ser_softdevice_flash_operation_success_evt);
+
+ if (err_code == NRF_SUCCESS)
+ {
+ connectivity_reset_low();
+
+ nrf_queue_reset(&m_sd_soc_evt_mailbox);
+ ser_sd_transport_evt_handler_t ble_evt_handler = NULL;
+ ser_sd_transport_evt_handler_t ant_evt_handler = NULL;
+
+#ifdef BLE_STACK_SUPPORT_REQD
+ ble_evt_handler = ser_softdevice_ble_evt_handler;
+ nrf_queue_reset(&m_sd_ble_evt_mailbox);
+#endif // BLE_STACK_SUPPORT_REQD
+
+#ifdef ANT_STACK_SUPPORT_REQD
+ ant_evt_handler = ser_softdevice_ant_evt_handler;
+ nrf_queue_reset(&m_sd_ant_evt_mailbox);
+#endif // ANT_STACK_SUPPORT_REQD
+ err_code = ser_sd_transport_open(ble_evt_handler,
+ ant_evt_handler,
+ ser_sd_rsp_wait,
+ os_rsp_set_handler,
+ NULL);
+
+ if (err_code == NRF_SUCCESS)
+ {
+ connectivity_reset_high();
+ }
+
+ ser_app_hal_nrf_evt_irq_priority_set();
+ }
+
+ return err_code;
+}
+
+
+uint32_t sd_softdevice_disable(void)
+{
+ return ser_sd_transport_close();
+}
+
diff --git a/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.h b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.h
new file mode 100644
index 0000000..a07bf51
--- /dev/null
+++ b/thirdparty/nRF5_SDK_15.0.0_a53641a/components/serialization/application/transport/ser_softdevice_handler.h
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2014 - 2018, 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, except as embedded into a Nordic
+ * Semiconductor ASA integrated circuit in a product or a software update for
+ * such product, 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 its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * 4. This software, with or without modification, must only be used with a
+ * Nordic Semiconductor ASA integrated circuit.
+ *
+ * 5. Any software provided in binary form under this license must not be reverse
+ * engineered, decompiled, modified and/or disassembled.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
+ *
+ */
+/**
+ * @addtogroup ser_app Application side code
+ * @ingroup ble_sdk_lib_serialization
+ */
+
+/** @file
+ *
+ * @defgroup ser_softdevice_handler Serialization SoftDevice Handler
+ * @{
+ * @ingroup ser_app
+ *
+ * @brief Serialization SoftDevice Handler on application side.
+ *
+ */
+#ifndef SER_SOFTDEVICE_HANDLER_H_
+#define SER_SOFTDEVICE_HANDLER_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**@brief Function for checking if there are any more events in the internal mailbox.
+ *
+ * @param[in] p_mailbox_length Pointer to mailbox length.
+ *
+ * @retval ::NRF_SUCCESS Length succesfully obtained.
+ * @retval ::NRF_ERROR_NULL Null pointer provided.
+ */
+uint32_t sd_ble_evt_mailbox_length_get(uint32_t * p_mailbox_length);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SER_SOFTDEVICE_HANDLER_H_ */
+/** @} */