You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by st...@apache.org on 2016/07/27 23:13:33 UTC
[04/51] [partial] incubator-mynewt-core git commit: add stm32 and
nordic sdks based on new structure
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c
new file mode 100644
index 0000000..e03daf1
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_rw_authorize_reply.c
@@ -0,0 +1,57 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gatts_app.h"
+#include "ble_serialization.h"
+#include "app_util.h"
+#include "cond_field_serialization.h"
+#include "ble_gatts_struct_serialization.h"
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint32_t index = 0;
+ uint32_t buf_len = *p_buf_len;
+ uint8_t opcode = SD_BLE_GATTS_RW_AUTHORIZE_REPLY;
+ uint32_t err_code = NRF_SUCCESS;
+
+ err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&conn_handle, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc(p_reply_params, p_buf, buf_len, &index,
+ ble_gatts_rw_authorize_reply_params_t_enc);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_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)
+{
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_RW_AUTHORIZE_REPLY, p_result_code);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c
new file mode 100644
index 0000000..c450be1
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_add.c
@@ -0,0 +1,83 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gatts_app.h"
+#include "ble_serialization.h"
+#include "ble_gatts.h"
+#include "app_util.h"
+
+
+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)
+{
+ uint32_t index = 0;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ SER_ASSERT_LENGTH_LEQ(index + 1 + 1 + 1 + 1, *p_buf_len);
+
+ p_buf[index++] = SD_BLE_GATTS_SERVICE_ADD;
+ p_buf[index++] = type;
+
+ p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
+
+ if (p_uuid != NULL)
+ {
+ SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
+ index += uint16_encode(p_uuid->uuid, &p_buf[index]);
+ p_buf[index++] = p_uuid->type;
+ }
+
+ SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
+ p_buf[index++] = (p_conn_handle != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+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)
+{
+ uint32_t index = 0;
+
+ uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SD_BLE_GATTS_SERVICE_ADD,
+ p_result_code);
+
+ if (decode_result != NRF_SUCCESS)
+ {
+ return decode_result;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ SER_ASSERT_NOT_NULL(p_conn_handle);
+
+ SER_ASSERT_LENGTH_LEQ(index + 2, packet_len);
+ uint16_dec(p_buf, packet_len, &index, p_conn_handle);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return decode_result;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c
new file mode 100644
index 0000000..92400c8
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_service_changed.c
@@ -0,0 +1,55 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gatts_app.h"
+#include "ble_serialization.h"
+#include "ble_gatts.h"
+#include "app_util.h"
+
+
+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)
+{
+ uint32_t index = 0;
+ uint32_t err_code;
+ uint8_t opcode = SD_BLE_GATTS_SERVICE_CHANGED;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ err_code = uint8_t_enc(&opcode, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&start_handle, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&end_handle, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_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)
+{
+ return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GATTS_SERVICE_CHANGED, p_result_code);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c
new file mode 100644
index 0000000..81a35d4
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_get.c
@@ -0,0 +1,113 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gatts_app.h"
+#include <stdlib.h>
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gap.h"
+#include "app_util.h"
+
+
+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)
+{
+ 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 + 1 + 2 + 1 + 4, *p_buf_len);
+ p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_GET;
+ index += uint16_encode(conn_handle, &p_buf[index]);
+
+ p_buf[index++] = (p_sys_attr_data_len != NULL) ? SER_FIELD_PRESENT :
+ SER_FIELD_NOT_PRESENT;
+
+ if (p_sys_attr_data_len != NULL)
+ {
+ SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
+ index += uint16_encode(*p_sys_attr_data_len, &p_buf[index]);
+ }
+
+ SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
+ p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
+
+ err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+uint32_t ble_gatts_sys_attr_get_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint8_t * const p_sys_attr_data,
+ uint16_t * const p_sys_attr_data_len,
+ 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 decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
+ &index,
+ packet_len,
+ SD_BLE_GATTS_SYS_ATTR_GET,
+ p_result_code);
+
+ if (decode_result != NRF_SUCCESS)
+ {
+ return decode_result;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ SER_ASSERT_LENGTH_LEQ(index + 2 + 1, packet_len);
+
+ uint16_t sys_attr_len;
+ uint16_dec(p_buf, packet_len, &index, &sys_attr_len);
+
+ if (p_buf[index++] == SER_FIELD_PRESENT)
+ {
+ SER_ASSERT_NOT_NULL(p_sys_attr_data);
+ SER_ASSERT_NOT_NULL(p_sys_attr_data_len);
+ SER_ASSERT(sys_attr_len <= *p_sys_attr_data_len, NRF_ERROR_DATA_SIZE);
+
+ SER_ASSERT_LENGTH_LEQ(index + sys_attr_len, packet_len);
+ memcpy(p_sys_attr_data, &p_buf[index], sys_attr_len);
+ *p_sys_attr_data_len = sys_attr_len;
+ index += sys_attr_len;
+ }
+ else
+ {
+ if (p_sys_attr_data_len != NULL)
+ {
+ *p_sys_attr_data_len = sys_attr_len;
+ }
+ }
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c
new file mode 100644
index 0000000..e0467e0
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_sys_attr_set.c
@@ -0,0 +1,65 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gatts_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gatts.h"
+#include "app_util.h"
+
+
+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)
+{
+ 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 + 8, *p_buf_len);
+
+ p_buf[index++] = SD_BLE_GATTS_SYS_ATTR_SET;
+ index += uint16_encode(conn_handle, &p_buf[index]);
+
+ p_buf[index++] = (p_sys_attr_data != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
+
+ if (p_sys_attr_data != NULL)
+ {
+ //lint -save -esym(670,memcpy)
+ SER_ERROR_CHECK(sys_attr_data_len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM);
+ SER_ASSERT_LENGTH_LEQ(index + 2 + sys_attr_data_len + 4, *p_buf_len);
+ index += uint16_encode(sys_attr_data_len, &p_buf[index]);
+ memcpy(&(p_buf[index]), p_sys_attr_data, sys_attr_data_len);
+ //lint -restore
+ index += sys_attr_data_len;
+ }
+
+ err_code = uint32_t_enc(&flags, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+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);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c
new file mode 100644
index 0000000..add50b9
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_get.c
@@ -0,0 +1,126 @@
+/* Copyright (c) Nordic Semiconductor ASA
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
+ * contributors to this software may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * 4. This software must only be used in a processor manufactured by Nordic
+ * Semiconductor ASA, or in a processor manufactured by a third party that
+ * is used in combination with a processor manufactured by Nordic Semiconductor.
+ *
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "ble_gatts_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "app_util.h"
+#include "cond_field_serialization.h"
+#include "ble_gatts_struct_serialization.h"
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t total_len = *p_buf_len;
+
+ SER_ASSERT_LENGTH_LEQ(1 + 2 + 2 + 1, total_len);
+ p_buf[index++] = SD_BLE_GATTS_VALUE_GET;
+
+ err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&handle, p_buf, total_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (p_value != NULL)
+ {
+ p_buf[index++] = SER_FIELD_PRESENT;
+ err_code = uint16_t_enc(&(p_value->len), p_buf, total_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&(p_value->offset), p_buf, total_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_LEQ(1, total_len - index);
+ if (p_value->p_value != NULL)
+ {
+ p_buf[index++] = SER_FIELD_PRESENT;
+ }
+ else
+ {
+ p_buf[index++] = SER_FIELD_NOT_PRESENT;
+ }
+ }
+ else
+ {
+ p_buf[index++] = SER_FIELD_NOT_PRESENT;
+ }
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+ SER_ASSERT_NOT_NULL(p_value);
+
+ uint32_t err_code;
+ uint32_t index = 0;
+ uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf, &index,
+ packet_len, SD_BLE_GATTS_VALUE_GET,
+ p_result_code);
+
+ if (decode_result != NRF_SUCCESS)
+ {
+ return decode_result;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c
new file mode 100644
index 0000000..44b1b16
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gatts_value_set.c
@@ -0,0 +1,84 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gatts_app.h"
+#include <string.h>
+#include "nrf_error.h"
+#include "cond_field_serialization.h"
+#include "ble_serialization.h"
+#include "ble_gatts_struct_serialization.h"
+#include "app_util.h"
+
+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)
+{
+ 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 + 2 + 2, *p_buf_len);
+ p_buf[index++] = SD_BLE_GATTS_VALUE_SET;
+ index += uint16_encode(conn_handle, &p_buf[index]);
+ index += uint16_encode(handle, &p_buf[index]);
+
+ if(p_value != NULL)
+ {
+ SER_ERROR_CHECK(p_value->len <= BLE_GATTS_VAR_ATTR_LEN_MAX, NRF_ERROR_INVALID_PARAM);
+ }
+ err_code = cond_field_enc(p_value, p_buf, *p_buf_len, &index, ble_gatts_value_t_enc);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
+ &index,
+ packet_len,
+ SD_BLE_GATTS_VALUE_SET,
+ p_result_code);
+
+ if (decode_result != NRF_SUCCESS)
+ {
+ return decode_result;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ err_code = ble_gatts_value_t_dec(p_buf, packet_len, &index, p_value);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h
new file mode 100644
index 0000000..d12e83c
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_app.h
@@ -0,0 +1,162 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is confidential property of Nordic Semiconductor. The use,
+ * copying, transfer or disclosure of such information is prohibited except by express written
+ * agreement with Nordic Semiconductor.
+ *
+ */
+
+/**
+ * @addtogroup ser_codecs Serialization codecs
+ * @ingroup ble_sdk_lib_serialization
+ */
+
+/**
+ * @addtogroup ser_app_s130_codecs Application s130 codecs
+ * @ingroup ser_codecs
+ */
+
+/**@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"
+
+/**@brief Register a CID with L2CAP.
+ *
+ * @details This registers a higher protocol layer with the L2CAP multiplexer, and is requried 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 nrf51_adv_start_encoding for packet format,
+ * @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 nrf51_adv_start_encoding for packet format,
+ * @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.
+ * Please 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.
+ *
+ * @return @ref NRF_SUCCESS Successfully queued an L2CAP packet for transmission.
+ * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
+ * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, CIDs must be registered beforehand with @ref sd_ble_l2cap_cid_register.
+ * @return @ref NRF_ERROR_NOT_FOUND CID not found.
+ * @return @ref NRF_ERROR_NO_MEM Not enough memory to complete operation.
+ * @return @ref 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 nrf51_adv_start_encoding for packet format,
+ * @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 //BLE_L2CAP_APP_H__
+
+/**
+ @}
+ */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c
new file mode 100644
index 0000000..0ce42ff
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_register.c
@@ -0,0 +1,45 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gap_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gap.h"
+#include "app_util.h"
+
+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);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c
new file mode 100644
index 0000000..44315cc
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_cid_unregister.c
@@ -0,0 +1,45 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_gap_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gap.h"
+#include "app_util.h"
+
+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);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h
new file mode 100644
index 0000000..5abc7ba
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_app.h
@@ -0,0 +1,61 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+#ifndef BLE_L2CAP_EVT_APP_H__
+#define BLE_L2CAP_EVT_APP_H__
+
+/**
+ * @addtogroup ser_codecs Serialization codecs
+ * @ingroup ble_sdk_lib_serialization
+ */
+
+/**
+ * @addtogroup ser_app_s130_codecs Application s130 codecs
+ * @ingroup ser_codecs
+ */
+
+/**@file
+ *
+ * @defgroup ble_l2cap_evt_app L2CAP Application event decoders
+ * @{
+ * @ingroup ser_app_s130_codecs
+ *
+ * @brief L2CAP Application event decoders.
+ */
+#include "ble.h"
+
+/**
+ * @brief Decodes ble_l2cap_evt_rx event.
+ *
+ * @sa @ref nrf51_l2cap_evt_rx_encoding for packet format.
+ *
+ * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len.
+ *
+ * @param[in] p_buf Pointer to the beginning of an event packet.
+ * @param[in] packet_len Length (in bytes) of the event packet.
+ * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be
+ * stored. If NULL, required length will be returned in \p p_event_len.
+ * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer.
+ * \c out: Length of decoded contents of \p p_event.
+ *
+ * @retval NRF_SUCCESS Decoding success.
+ * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
+ * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
+ * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
+ * hold decoded event.
+ */
+uint32_t ble_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);
+
+/** @} */
+#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c
new file mode 100644
index 0000000..a064d45
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_evt_rx.c
@@ -0,0 +1,56 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_serialization.h"
+#include "ble_struct_serialization.h"
+#include "app_util.h"
+#include "ble_l2cap_evt_app.h"
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_event);
+ SER_ASSERT_NOT_NULL(p_event_len);
+
+ uint32_t index = 0;
+ uint32_t in_event_len = *p_event_len;
+
+ *p_event_len = offsetof(ble_l2cap_evt_t, params);
+
+ uint16_t evt_id;
+
+ uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &evt_id);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ void * p_rx = NULL;
+
+ if (p_event)
+ {
+ err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.l2cap_evt.conn_handle));
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ p_rx = &(p_event->evt.l2cap_evt.params.rx);
+ }
+
+ uint32_t struct_len = in_event_len - *p_event_len;
+ err_code = ble_l2cap_evt_rx_t_dec(p_buf, packet_len, &index, &struct_len, p_rx);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_event_len += struct_len;
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return err_code;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c
new file mode 100644
index 0000000..0beae1c
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_l2cap_tx.c
@@ -0,0 +1,61 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include <string.h>
+#include "ble_l2cap_app.h"
+#include "ble_serialization.h"
+#include "ble_struct_serialization.h"
+#include "ble_gap.h"
+#include "app_util.h"
+#include "cond_field_serialization.h"
+
+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);
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c
new file mode 100644
index 0000000..6df45f5
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_get.c
@@ -0,0 +1,126 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_struct_serialization.h"
+#include "ble_gap_struct_serialization.h"
+#include "app_util.h"
+
+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)
+{
+ uint32_t index = 0;
+ uint32_t err_code;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+ SER_ASSERT_LENGTH_LEQ(1+4+1, *p_buf_len); // [OPCODE][OP_ID][PRESENT]
+ SER_ASSERT(((opt_id == BLE_COMMON_OPT_CONN_BW) ||
+ (opt_id == BLE_GAP_OPT_CH_MAP) ||
+ (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) ||
+ (opt_id == BLE_GAP_OPT_PASSKEY) ||
+ (opt_id == BLE_GAP_OPT_PRIVACY) ||
+ (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) ||
+ (opt_id == BLE_GAP_OPT_COMPAT_MODE)) , NRF_ERROR_INVALID_PARAM);
+
+ p_buf[index++] = SD_BLE_OPT_GET;
+
+ err_code = uint32_t_enc(&opt_id, p_buf, *p_buf_len, &index);
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ p_buf[index++] = (p_opt == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+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)
+{
+ uint32_t index = 0;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_opt_id);
+ SER_ASSERT_NOT_NULL(p_opt);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t err_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SD_BLE_OPT_GET,
+ p_result_code);
+
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ (void) uint32_t_dec(p_buf, packet_len, &index, p_opt_id);
+ SER_ASSERT(((*p_opt_id == BLE_COMMON_OPT_CONN_BW) ||
+ (*p_opt_id == BLE_GAP_OPT_CH_MAP) ||
+ (*p_opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) ||
+ (*p_opt_id == BLE_GAP_OPT_PASSKEY) ||
+ (*p_opt_id == BLE_GAP_OPT_PRIVACY) ||
+ (*p_opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) ||
+ (*p_opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM);
+
+ switch (*p_opt_id)
+ {
+ case BLE_COMMON_OPT_CONN_BW:
+ err_code = ble_common_opt_conn_bw_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->common_opt.conn_bw));
+ break;
+ case BLE_GAP_OPT_CH_MAP:
+ err_code = ble_gap_opt_ch_map_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.ch_map));
+ break;
+ case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
+ err_code = ble_gap_opt_local_conn_latency_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.local_conn_latency));
+ break;
+ case BLE_GAP_OPT_PASSKEY:
+ err_code = ble_gap_opt_passkey_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.passkey));
+ break;
+ case BLE_GAP_OPT_PRIVACY:
+ err_code = ble_gap_opt_privacy_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.privacy));
+ break;
+ case BLE_GAP_OPT_SCAN_REQ_REPORT:
+ err_code = ble_gap_opt_scan_req_report_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.scan_req_report));
+ break;
+ case BLE_GAP_OPT_COMPAT_MODE:
+ err_code = ble_gap_opt_compat_mode_t_dec( p_buf, packet_len, &index, (void *)&(p_opt->gap_opt.compat_mode));
+ break;
+ }
+
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return err_code;
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c
new file mode 100644
index 0000000..d7228d4
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_opt_set.c
@@ -0,0 +1,117 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ */
+
+#include "ble_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_gap_struct_serialization.h"
+#include "ble_struct_serialization.h"
+#include "app_util.h"
+
+
+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)
+{
+ uint32_t index = 0;
+ uint32_t err_code = NRF_SUCCESS;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint32_t initial_buf_len = *p_buf_len;
+
+ SER_ASSERT_LENGTH_LEQ(1 + 4 + 1, initial_buf_len);
+
+ SER_ASSERT(((opt_id == BLE_COMMON_OPT_CONN_BW) ||
+ (opt_id == BLE_GAP_OPT_CH_MAP) ||
+ (opt_id == BLE_GAP_OPT_LOCAL_CONN_LATENCY) ||
+ (opt_id == BLE_GAP_OPT_PASSKEY) ||
+ (opt_id == BLE_GAP_OPT_PRIVACY) ||
+ (opt_id == BLE_GAP_OPT_SCAN_REQ_REPORT) ||
+ (opt_id == BLE_GAP_OPT_COMPAT_MODE)), NRF_ERROR_INVALID_PARAM);
+
+ p_buf[index++] = SD_BLE_OPT_SET;
+
+ err_code = uint32_t_enc(&opt_id, p_buf, initial_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if (p_opt != NULL)
+ {
+ p_buf[index++] = SER_FIELD_PRESENT;
+
+ switch(opt_id)
+ {
+ case BLE_COMMON_OPT_CONN_BW:
+ err_code = ble_common_opt_conn_bw_t_enc(&(p_opt->common_opt.conn_bw),p_buf, initial_buf_len, &index);
+ break;
+ case BLE_GAP_OPT_CH_MAP:
+ err_code = ble_gap_opt_ch_map_t_enc(&(p_opt->gap_opt.ch_map),p_buf, initial_buf_len, &index);
+ break;
+ case BLE_GAP_OPT_LOCAL_CONN_LATENCY:
+ err_code = ble_gap_opt_local_conn_latency_t_enc(&(p_opt->gap_opt.local_conn_latency),p_buf, initial_buf_len, &index);
+ break;
+ case BLE_GAP_OPT_PASSKEY:
+ err_code = ble_gap_opt_passkey_t_enc(&(p_opt->gap_opt.passkey),p_buf, initial_buf_len, &index);
+ break;
+ case BLE_GAP_OPT_PRIVACY:
+ err_code = ble_gap_opt_privacy_t_enc(&(p_opt->gap_opt.privacy),p_buf, initial_buf_len, &index);
+ break;
+ case BLE_GAP_OPT_SCAN_REQ_REPORT:
+ err_code = ble_gap_opt_scan_req_report_t_enc(&(p_opt->gap_opt.scan_req_report),p_buf, initial_buf_len, &index);
+ break;
+ case BLE_GAP_OPT_COMPAT_MODE:
+ err_code = ble_gap_opt_compat_mode_t_enc(&(p_opt->gap_opt.compat_mode),p_buf, initial_buf_len, &index);
+ break;
+ }
+ }
+ else
+ {
+ p_buf[index++] = SER_FIELD_NOT_PRESENT;
+ }
+
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ble_opt_set_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ uint32_t * const p_result_code)
+{
+ uint32_t index = 0;
+ uint32_t error_code;
+
+ error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SD_BLE_OPT_SET, p_result_code);
+
+ if (error_code != NRF_SUCCESS)
+ {
+ return error_code;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c
new file mode 100644
index 0000000..6dacfc1
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_tx_packet_count_get.c
@@ -0,0 +1,72 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_app.h"
+#include "ble_serialization.h"
+#include "app_util.h"
+#include "cond_field_serialization.h"
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint32_t index = 0;
+ uint8_t opcode = SD_BLE_TX_PACKET_COUNT_GET;
+ uint32_t err_code;
+ uint32_t total_len = *p_buf_len;
+
+ err_code = uint8_t_enc(&opcode, p_buf, total_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = uint16_t_enc(&conn_handle, p_buf, total_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc(p_count, p_buf, total_len, &index, NULL);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_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)
+{
+ 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,
+ SD_BLE_TX_PACKET_COUNT_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 = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_count, uint8_t_dec);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c
new file mode 100644
index 0000000..7321434
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_user_mem_reply.c
@@ -0,0 +1,65 @@
+/* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "ble_struct_serialization.h"
+#include "cond_field_serialization.h"
+#include "app_util.h"
+
+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)
+{
+ uint32_t index = 0;
+ uint32_t err_code;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ p_buf[index++] = SD_BLE_USER_MEM_REPLY;
+
+ err_code = uint16_t_enc(&conn_handle, p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ if(p_block != NULL)
+ {
+ p_buf[index++] = SER_FIELD_PRESENT;
+
+ // Encoding order is different than structure elements order because
+ // mem block length should be sent first
+ err_code = uint16_t_enc(&(p_block->len), p_buf, *p_buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc(p_block->p_mem, p_buf, *p_buf_len, &index, NULL);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+ }
+ else
+ {
+ p_buf[index++] = SER_FIELD_NOT_PRESENT;
+ }
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+uint32_t ble_user_mem_reply_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_USER_MEM_REPLY, p_result_code);
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c
new file mode 100644
index 0000000..1bfa233
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_decode.c
@@ -0,0 +1,84 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_app.h"
+#include <stdlib.h>
+#include <string.h>
+#include "ble_serialization.h"
+#include "cond_field_serialization.h"
+#include "ble_struct_serialization.h"
+#include "app_util.h"
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint32_t err_code;
+ uint32_t index = 0;
+ uint32_t buf_len = *p_buf_len;
+ uint8_t opcode = SD_BLE_UUID_DECODE;
+
+ err_code = uint8_t_enc((void *)&opcode, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = len8data_enc(p_uuid_le, uuid_le_len, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc((void *)p_uuid, p_buf, buf_len, &index, NULL);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ble_uuid_decode_rsp_dec(uint8_t const * const p_buf,
+ uint32_t buf_len,
+ ble_uuid_t * * const pp_uuid,
+ 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;
+
+ uint32_t decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
+ &index,
+ buf_len,
+ SD_BLE_UUID_DECODE,
+ p_result_code);
+
+ if (decode_result != NRF_SUCCESS)
+ {
+ return decode_result;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, buf_len);
+ return NRF_SUCCESS;
+ }
+
+ err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid, ble_uuid_t_dec);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, buf_len);
+
+ return err_code;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c
new file mode 100644
index 0000000..f7a25d8
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_encode.c
@@ -0,0 +1,93 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ */
+
+#include "ble_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "app_util.h"
+
+
+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)
+{
+ uint32_t index = 0;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ SER_ASSERT_LENGTH_LEQ(1 + 1, *p_buf_len);
+
+ p_buf[index++] = SD_BLE_UUID_ENCODE;
+
+ p_buf[index++] = (p_uuid != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT;
+
+ if (p_uuid != NULL)
+ {
+ SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len);
+ index += uint16_encode(p_uuid->uuid, &p_buf[index]);
+ p_buf[index++] = p_uuid->type;
+ }
+
+ SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
+ p_buf[index++] = (p_uuid_le_len == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
+ p_buf[index++] = (p_uuid_le == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+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)
+{
+ uint32_t index = 0;
+ uint32_t error_code;
+
+ error_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SD_BLE_UUID_ENCODE, p_result_code);
+
+ if (error_code != NRF_SUCCESS)
+ {
+ return error_code;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ SER_ASSERT_LENGTH_LEQ(index + 1, packet_len);
+ uint8_t uuid_le_len = p_buf[index++];
+
+ if (p_uuid_le_len != NULL)
+ {
+ if (p_uuid_le != NULL)
+ {
+ SER_ASSERT_LENGTH_LEQ(index + uuid_le_len, packet_len);
+ memcpy(p_uuid_le, &(p_buf[index]), uuid_le_len);
+ index += uuid_le_len;
+ }
+ *p_uuid_le_len = uuid_le_len;
+ }
+
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c
new file mode 100644
index 0000000..6b392d6
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_uuid_vs_add.c
@@ -0,0 +1,83 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ */
+
+#include "ble_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "cond_field_serialization.h"
+#include "ble_struct_serialization.h"
+#include "app_util.h"
+
+
+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_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint32_t err_code;
+ uint32_t index = 0;
+ uint32_t buf_len = *p_buf_len;
+ uint8_t opcode = SD_BLE_UUID_VS_ADD;
+
+ err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc((void *)p_vs_uuid, p_buf, buf_len, &index, ble_uuid128_t_enc);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc((void *)p_uuid_type, p_buf, buf_len, &index, NULL);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return err_code;
+}
+
+
+uint32_t ble_uuid_vs_add_rsp_dec(uint8_t const * const p_buf,
+ uint32_t buf_len,
+ uint8_t * * const pp_uuid_type,
+ uint32_t * const p_result_code)
+{
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+ SER_ASSERT_NOT_NULL(pp_uuid_type);
+
+ uint32_t err_code = NRF_SUCCESS;
+ uint32_t index = 0;
+
+ err_code = ser_ble_cmd_rsp_result_code_dec(p_buf,
+ &index,
+ buf_len,
+ SD_BLE_UUID_VS_ADD,
+ p_result_code);
+
+ if (err_code != NRF_SUCCESS)
+ {
+ return err_code;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, buf_len);
+ return NRF_SUCCESS;
+ }
+
+ err_code = cond_field_dec(p_buf, buf_len, &index, (void * *)pp_uuid_type, uint8_t_dec);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, buf_len);
+
+ return err_code;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c
new file mode 100644
index 0000000..e55b876
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_version_get.c
@@ -0,0 +1,73 @@
+/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "ble_app.h"
+#include <string.h>
+#include "ble_serialization.h"
+#include "app_util.h"
+
+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)
+{
+ uint32_t index = 0;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len);
+
+ p_buf[index++] = SD_BLE_VERSION_GET;
+
+ SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len);
+
+ p_buf[index++] = (p_version == NULL) ? SER_FIELD_NOT_PRESENT : SER_FIELD_PRESENT;
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+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)
+{
+ uint32_t index = 0;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_result_code);
+
+ uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len,
+ SD_BLE_VERSION_GET,
+ p_result_code);
+
+ if (status_code != NRF_SUCCESS)
+ {
+ return status_code;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+ uint8_dec(p_buf, packet_len, &index, &(p_version->version_number));
+ uint16_dec(p_buf, packet_len, &index, &(p_version->company_id));
+ uint16_dec(p_buf, packet_len, &index, &p_version->subversion_number);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+
+ return status_code;
+}
+
+
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c
new file mode 100644
index 0000000..bc499df
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ecb_block_encrypt.c
@@ -0,0 +1,79 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+#include "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)
+{
+ uint32_t index = 0;
+ uint32_t err_code;
+ uint32_t buf_len = *p_buf_len;
+
+ SER_ASSERT_NOT_NULL(p_buf);
+ SER_ASSERT_NOT_NULL(p_buf_len);
+
+ uint8_t opcode = SD_ECB_BLOCK_ENCRYPT;
+
+ err_code = uint8_t_enc(&opcode, p_buf, buf_len, &index);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ err_code = cond_field_enc(p_ecb_data, p_buf, buf_len, &index,nrf_ecb_hal_data_t_in_enc);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ *p_buf_len = index;
+
+ return NRF_SUCCESS;
+}
+
+
+uint32_t ecb_block_encrypt_rsp_dec(uint8_t const * const p_buf,
+ uint32_t packet_len,
+ nrf_ecb_hal_data_t * p_ecb_data,
+ 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 decode_result = ser_ble_cmd_rsp_result_code_dec(p_buf,
+ &index,
+ packet_len,
+ SD_ECB_BLOCK_ENCRYPT,
+ p_result_code);
+
+ if (decode_result != NRF_SUCCESS)
+ {
+ return decode_result;
+ }
+
+ if (*p_result_code != NRF_SUCCESS)
+ {
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+ }
+
+ uint32_t err_code = cond_field_dec(p_buf, packet_len, &index, (void **)&p_ecb_data, nrf_ecb_hal_data_t_out_dec);
+ SER_ASSERT(err_code == NRF_SUCCESS, err_code);
+
+ SER_ASSERT_LENGTH_EQ(index, packet_len);
+ return NRF_SUCCESS;
+}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f06c2d2b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h
new file mode 100644
index 0000000..716a59a
--- /dev/null
+++ b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/nrf_soc_app.h
@@ -0,0 +1,126 @@
+/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
+ *
+ * The information contained herein is property of Nordic Semiconductor ASA.
+ * Terms and conditions of usage are described in detail in NORDIC
+ * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
+ *
+ * Licensees are granted free, non-transferable use of the information. NO
+ * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
+ * the file.
+ *
+ */
+
+/**
+ * @addtogroup ser_codecs Serialization codecs
+ * @ingroup ble_sdk_lib_serialization
+ */
+
+/**
+ * @addtogroup ser_app_s130_codecs Application s130 codecs
+ * @ingroup ser_codecs
+ */
+
+/**@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"
+/**@brief Encodes @ref sd_power_system_off command request.
+ *
+ * @sa @ref nrf51_sd_power_off for packet format.
+ *
+ * @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 nrf51_sd_temp_get for packet format.
+ @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 nrf51_sd_temp_get for packet format,
+ * @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] p_temp Pointer to result of temperature measurement.
+ *
+ * @return 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 p_temp);
+
+/**@brief Encodes @ref sd_ecb_block_encrypt command request.
+ *
+ * @sa @ref nrf51_sd_ecb_block_encrypt for packet format.
+ @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 nrf51_sd_ecb_block_encrypt for packet format,
+ * @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.
+ *
+ * @return 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 * p_ecb_data,
+ uint32_t * const p_result_code);
+/** @} */
+
+#endif // NRF_SOC_APP_H__