http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c deleted file mode 100644 index 095f6c2..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_conn_sec_get.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include "ble_serialization.h" -#include "app_util.h" -#include "cond_field_serialization.h" -#include "ble_gap_struct_serialization.h" - -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_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - uint32_t index = 0; - uint32_t total_len = *p_buf_len; - uint32_t err_code = NRF_SUCCESS; - uint8_t opcode = SD_BLE_GAP_CONN_SEC_GET; - - - 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_conn_sec, p_buf, total_len, &index, NULL); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - *p_buf_len = index; - - return err_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) -{ - 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_GAP_CONN_SEC_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_conn_sec, - ble_gap_conn_sec_t_dec); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - return err_code; -}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c deleted file mode 100644 index dd02fcc..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include "ble_serialization.h" -#include "cond_field_serialization.h" -#include "ble_gap_struct_serialization.h" - -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, - uint8_t * const p_buf, - uint32_t * const p_buf_len) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - uint8_t op_code = SD_BLE_GAP_CONNECT; - uint32_t err_code = NRF_SUCCESS; - uint32_t buf_len = *p_buf_len; - uint32_t index = 0; - - err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = cond_field_enc(p_peer_addr, p_buf, buf_len, &index, ble_gap_addr_enc); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = cond_field_enc(p_scan_params, p_buf, buf_len, &index, ble_gap_scan_params_t_enc); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = cond_field_enc(p_conn_params, p_buf, buf_len, &index, ble_gap_conn_params_t_enc); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - *p_buf_len = index; - - return err_code; -} - -uint32_t ble_gap_connect_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_GAP_CONNECT, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c deleted file mode 100644 index 06c87b2..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_connect_cancel.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include "ble_serialization.h" -#include "cond_field_serialization.h" -#include "ble_gap_struct_serialization.h" - -uint32_t ble_gap_connect_cancel_req_enc(uint8_t * const p_buf, - uint32_t * const p_buf_len) -{ - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - uint8_t op_code = SD_BLE_GAP_CONNECT_CANCEL; - uint32_t err_code = NRF_SUCCESS; - uint32_t buf_len = *p_buf_len; - uint32_t index = 0; - - err_code = uint8_t_enc(&op_code, p_buf, buf_len, &index); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - *p_buf_len = index; - - return err_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) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_CONNECT_CANCEL, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c deleted file mode 100644 index e74558b..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_get.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - -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) -{ - 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_GAP_DEVICE_NAME_GET; - p_buf[index++] = (p_len != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_len != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + 2, *p_buf_len); - index += uint16_encode(*p_len, &p_buf[index]); - } - - SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); - p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -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_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_result_code); - uint32_t index = 0; - uint32_t status_code = ser_ble_cmd_rsp_result_code_dec(p_buf, &index, packet_len, - SD_BLE_GAP_DEVICE_NAME_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; - } - - SER_ASSERT_NOT_NULL(p_dev_name_len); - status_code = len16data_dec(p_buf, packet_len, &index, (uint8_t * *)&p_dev_name, p_dev_name_len); - - if (status_code != NRF_SUCCESS) - { - return status_code; - } - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - return status_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c deleted file mode 100644 index 15bdf3a..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_device_name_set.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(2, *p_buf_len); - p_buf[index++] = SD_BLE_GAP_DEVICE_NAME_SET; - - p_buf[index++] = (p_write_perm != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_write_perm != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); - p_buf[index++] = (uint8_t) ((p_write_perm->sm) | (p_write_perm->lv << 4)); - } - - SER_ERROR_CHECK(len <= BLE_GAP_DEVNAME_MAX_LEN, NRF_ERROR_INVALID_PARAM); - - SER_ASSERT_LENGTH_LEQ(index + 3, *p_buf_len); - index += uint16_encode(len, &p_buf[index]); - - p_buf[index++] = (p_dev_name != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_dev_name != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + len, *p_buf_len); - memcpy(&p_buf[index], p_dev_name, len); - index += len; - } - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -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) -{ - return ser_ble_cmd_rsp_dec(p_buf, packet_len, SD_BLE_GAP_DEVICE_NAME_SET, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c deleted file mode 100644 index bd947dd..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_disconnect.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(index + 4, *p_buf_len); - - p_buf[index++] = SD_BLE_GAP_DISCONNECT; - index += uint16_encode(conn_handle, &p_buf[index]); - p_buf[index++] = hci_status_code; - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -uint32_t ble_gap_disconnect_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_GAP_DISCONNECT, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c deleted file mode 100644 index 214d8dd..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_encrypt.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "ble_gap.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_buf_len); - - SER_ASSERT_LENGTH_LEQ(index + 1 + 2 + 1, *p_buf_len); - - p_buf[index++] = SD_BLE_GAP_ENCRYPT; - index += uint16_encode(conn_handle, &p_buf[index]); - - SER_ASSERT_LENGTH_LEQ(index + 1, *p_buf_len); - p_buf[index++] = (p_master_id != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_master_id != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_RAND_LEN + 2, *p_buf_len); - index += uint16_encode(p_master_id->ediv, &p_buf[index]); - memcpy(&p_buf[index], p_master_id->rand, BLE_GAP_SEC_RAND_LEN); - index += BLE_GAP_SEC_RAND_LEN; - } - - p_buf[index++] = (p_enc_info != NULL) ? SER_FIELD_PRESENT : SER_FIELD_NOT_PRESENT; - - if (p_enc_info != NULL) - { - SER_ASSERT_LENGTH_LEQ(index + BLE_GAP_SEC_KEY_LEN + 1, *p_buf_len); - memcpy(&p_buf[index], p_enc_info->ltk, BLE_GAP_SEC_KEY_LEN); - index += BLE_GAP_SEC_KEY_LEN; - p_buf[index++] = (p_enc_info->auth | (p_enc_info->ltk_len << 1)); - } - - *p_buf_len = index; - - return NRF_SUCCESS; -} - - -uint32_t ble_gap_encrypt_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_GAP_ENCRYPT, p_result_code); -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c deleted file mode 100644 index 7064b71..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_adv_report.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - uint32_t err_code = NRF_SUCCESS; - uint8_t byte; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE+7+1+1, packet_len); // assumed size(data) = 0 - - uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.adv_report)) + - sizeof (ble_gap_evt_adv_report_t) - - sizeof (ble_evt_hdr_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_ADV_REPORT; - p_event->header.evt_len = event_len; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.peer_addr)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.adv_report.rssi)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, packet_len, &index, &byte); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - p_event->evt.gap_evt.params.adv_report.scan_rsp = byte & 0x01; - p_event->evt.gap_evt.params.adv_report.type = (byte >> 1) & 0x03; - p_event->evt.gap_evt.params.adv_report.dlen = (byte >> 3) & 0x1F; - - err_code = uint8_vector_dec(p_buf, packet_len, &index, - p_event->evt.gap_evt.params.adv_report.data, (uint16_t)(p_event->evt.gap_evt.params.adv_report.dlen)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h deleted file mode 100644 index 12c1f1b..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_app.h +++ /dev/null @@ -1,466 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ -#ifndef BLE_GAP_EVT_APP_H__ -#define BLE_GAP_EVT_APP_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @addtogroup ser_codecs Serialization codecs - * @ingroup ble_sdk_lib_serialization - */ - -/** - * @addtogroup ser_app_s130_codecs Application s130 codecs - * @ingroup ser_codecs - */ - -/**@file - * - * @defgroup ble_gap_evt_app GAP Application event decoders - * @{ - * @ingroup ser_app_s130_codecs - * - * @brief GAP Application event decoders. - */ -#include "ble.h" - -/** - * @brief Decodes ble_gap_evt_auth_key_request event. - * - * @sa @ref nrf51_evt_auth_key_request_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_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. - * - * @sa @ref nrf51_evt_auth_status_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_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. - * - * @sa @ref nrf51_evt_conn_param_update_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_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. - * - * @sa @ref nrf51_evt_conn_sec_update_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_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. - * - * @sa @ref nrf51_evt_connected_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_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. - * - * @sa @ref nrf51_evt_disconnected_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_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. - * - * @sa @ref nrf51_evt_passkey_display 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_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. - * - * @sa @ref nrf51_evt_rssi_changed_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_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. - * - * @sa @ref nrf51_evt_sec_info_request_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_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. - * - * @sa @ref nrf51_evt_sec_param_request_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_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. - * - * @sa @ref nrf51_evt_timeout_encoding for packet format. - * - * If \p p_event is null, the required length of \p p_event is returned in \p p_event_len. - * - * @param[in] p_buf Pointer to the beginning of an event packet. - * @param[in] packet_len Length (in bytes) of the event packet. - * @param[in,out] p_event Pointer to a \ref ble_evt_t buffer where the decoded event will be - * stored. If NULL, required length will be returned in \p p_event_len. - * @param[in,out] p_event_len \c in: Size (in bytes) of \p p_event buffer. - * \c out: Length of decoded contents of \p p_event. - * - * @retval NRF_SUCCESS Decoding success. - * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied. - * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length. - * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to - * hold decoded event. - */ -uint32_t ble_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. - * - * @sa @ref nrf51_evt_sec_request_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_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. - * - * @sa @ref nrf51_evt_conn_param_update_request_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_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. - * - * @sa @ref nrf51_evt_adv_report_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_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. - * - * @sa @ref nrf51_evt_scan_req_report_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_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. - * - * @sa @ref nrf51_evt_key_pressed_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_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. - * - * @sa @ref nrf51_evt_lesc_dhkey_request_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_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); -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c deleted file mode 100644 index 122381c..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_key_request.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - uint32_t event_len; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(3, packet_len); - - event_len = SER_EVT_CONN_HANDLE_SIZE + 1; - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_AUTH_KEY_REQUEST; - p_event->header.evt_len = event_len; - - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - - uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.auth_key_request.key_type); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c deleted file mode 100644 index 95d5a51..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_auth_status.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "app_util.h" -#include "app_ble_gap_sec_keys.h" - -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) -{ - uint32_t index = 0; - uint32_t err_code = NRF_SUCCESS; - uint32_t conn_index; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 6, packet_len); - - uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.auth_status)) + - sizeof (ble_gap_evt_adv_report_t) - - sizeof (ble_evt_hdr_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - p_event->header.evt_id = BLE_GAP_EVT_AUTH_STATUS; - p_event->header.evt_len = event_len; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gap_evt_auth_status_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.auth_status)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - if (p_event->evt.gap_evt.params.auth_status.bonded) - { - // keyset is an extension of standard event data - used to synchronize keys at application - 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); - - err_code = ble_gap_sec_keyset_t_dec(p_buf, packet_len, &index, &(m_app_keys_table[conn_index].keyset)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = app_ble_gap_sec_context_destroy(p_event->evt.gap_evt.conn_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - } - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c deleted file mode 100644 index 10599f8..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); - - uint32_t event_len = (uint16_t) (offsetof(ble_gap_evt_t, params.conn_param_update)) + - sizeof (ble_gap_evt_conn_param_update_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update.conn_params.min_conn_interval); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update.conn_params.max_conn_interval); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update.conn_params.slave_latency); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update.conn_params.conn_sup_timeout); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c deleted file mode 100644 index a84ba68..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_param_update_request.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); - - uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_param_update_request)) + - sizeof (ble_gap_evt_conn_param_update_request_t) - - sizeof (ble_evt_hdr_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.min_conn_interval); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.max_conn_interval); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.slave_latency); - uint16_dec(p_buf, packet_len, &index, - &p_event->evt.gap_evt.params.conn_param_update_request.conn_params.conn_sup_timeout); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c deleted file mode 100644 index 98b0a65..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_conn_sec_update.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); - - uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.conn_sec_update)) + - sizeof (ble_gap_evt_conn_sec_update_t) - - sizeof (ble_evt_hdr_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_CONN_SEC_UPDATE; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - - p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.sm = p_buf[index] & 0x0F; - p_event->evt.gap_evt.params.conn_sec_update.conn_sec.sec_mode.lv = (p_buf[index] >> 4) & 0x0F; - index++; - - uint8_dec(p_buf, packet_len, - &index, &p_event->evt.gap_evt.params.conn_sec_update.conn_sec.encr_key_size); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c deleted file mode 100644 index d83f2cc..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_connected.c +++ /dev/null @@ -1,53 +0,0 @@ -/* 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_gap_evt_app.h" -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - uint32_t err_code = NRF_SUCCESS; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - uint32_t event_len = sizeof (ble_gap_evt_connected_t) + - sizeof (p_event->evt.gap_evt.conn_handle); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_len = event_len; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gap_evt_connected_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.connected)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c deleted file mode 100644 index 0937116..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_disconnected.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(3, packet_len); - - uint32_t event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_disconnected_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_DISCONNECTED; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - uint8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.disconnected.reason); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c deleted file mode 100644 index 87b52dd..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_key_pressed.c +++ /dev/null @@ -1,52 +0,0 @@ -/* 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_gap_evt_app.h" -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - uint32_t err_code = NRF_SUCCESS; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - uint32_t event_len = offsetof (ble_gap_evt_t, params) + sizeof(ble_gap_evt_key_pressed_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_len = event_len; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.key_pressed.kp_not); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c deleted file mode 100644 index ff30f47..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_lesc_dhkey_request.c +++ /dev/null @@ -1,71 +0,0 @@ -/* 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_gap_evt_app.h" -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "cond_field_serialization.h" -#include "app_util.h" -#include "app_ble_gap_sec_keys.h" -extern ser_ble_gap_app_keyset_t m_app_keys_table[]; - -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) -{ - uint32_t index = 0; - uint32_t err_code = NRF_SUCCESS; - uint32_t conn_index; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - // [minimal packet is: 'conn_handle' + 'p_pk_peer' SER_FIELD_NOT_PRESENT + - // 'oobd_req'] - SER_ASSERT_LENGTH_LEQ(sizeof(uint16_t) + sizeof(uint8_t) + sizeof(uint8_t), - packet_len); - - uint32_t event_len = offsetof (ble_gap_evt_t, params) + sizeof(uint8_t) + sizeof(uint8_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_len = event_len; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - // keyset is an extension of standard event data - used to synchronize keys at application - 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; - - err_code = cond_field_dec(p_buf, packet_len, &index, - (void **)&p_event->evt.gap_evt.params.lesc_dhkey_request.p_pk_peer, ble_gap_lesc_p256_pk_t_dec); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - uint8_t data; - err_code = uint8_t_dec(p_buf, packet_len, &index, &data); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - p_event->evt.gap_evt.params.lesc_dhkey_request.oobd_req = data & 0x01; - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c deleted file mode 100644 index 0b93930..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_passkey_display.c +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include <string.h> -#include "ble_serialization.h" -#include "app_util.h" - -#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) -{ - uint32_t index = 0; - uint32_t event_len; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - event_len = offsetof(ble_gap_evt_t, params.passkey_display) + sizeof (ble_gap_evt_passkey_display_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_PASSKEY_DISPLAY; - p_event->header.evt_len = event_len; - - uint32_t err_code = uint16_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - memcpy(p_event->evt.gap_evt.params.passkey_display.passkey, &p_buf[index], PASSKEY_LEN); - index += PASSKEY_LEN; - uint8_t match_req; - - err_code = uint8_t_dec(p_buf, packet_len, &index, &match_req); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - p_event->evt.gap_evt.params.passkey_display.match_request = (match_req & 0x01); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - *p_event_len = event_len; - - return NRF_SUCCESS; -} - http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c deleted file mode 100644 index 8e0c602..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_rssi_changed.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - uint32_t event_len; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 1, packet_len); - - event_len = SER_EVT_CONN_HANDLE_SIZE + sizeof (ble_gap_evt_rssi_changed_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_RSSI_CHANGED; - p_event->header.evt_len = event_len; - - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - int8_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.rssi_changed.rssi); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - - *p_event_len = event_len; - - return NRF_SUCCESS; -} - http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c deleted file mode 100644 index 6fc6de4..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_scan_req_report.c +++ /dev/null @@ -1,58 +0,0 @@ -/* 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_gap_evt_app.h" -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - uint32_t err_code = NRF_SUCCESS; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - - uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.scan_req_report)) + - sizeof (ble_gap_evt_scan_req_report_t) - - sizeof (ble_evt_hdr_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_SCAN_REQ_REPORT; - p_event->header.evt_len = event_len; - - err_code = uint16_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.conn_handle)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = ble_gap_addr_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.peer_addr)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_event->evt.gap_evt.params.scan_req_report.rssi)); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return err_code; -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a1481cb2/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c ---------------------------------------------------------------------- diff --git a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c b/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c deleted file mode 100644 index c1de6e8..0000000 --- a/hw/mcu/nordic/src/ext/nRF5_SDK_11.0.0_89a8197/components/serialization/application/codecs/s130/serializers/ble_gap_evt_sec_info_request.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. - * - * The information contained herein is property of Nordic Semiconductor ASA. - * Terms and conditions of usage are described in detail in NORDIC - * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. - * - * Licensees are granted free, non-transferable use of the information. NO - * WARRANTY of ANY KIND is provided. This heading must NOT be removed from - * the file. - * - */ - -#include "ble_gap_evt_app.h" -#include "ble_serialization.h" -#include "ble_gap_struct_serialization.h" -#include "app_util.h" - - -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) -{ - uint32_t index = 0; - - SER_ASSERT_NOT_NULL(p_buf); - SER_ASSERT_NOT_NULL(p_event_len); - uint32_t err_code = NRF_SUCCESS; - - SER_ASSERT_LENGTH_LEQ(SER_EVT_CONN_HANDLE_SIZE + 2, packet_len); - - uint32_t event_len = (uint16_t) (offsetof(ble_evt_t, evt.gap_evt.params.sec_info_request)) + - sizeof (ble_gap_evt_sec_info_request_t) - - sizeof (ble_evt_hdr_t); - - if (p_event == NULL) - { - *p_event_len = event_len; - return NRF_SUCCESS; - } - - SER_ASSERT(event_len <= *p_event_len, NRF_ERROR_DATA_SIZE); - - p_event->header.evt_id = BLE_GAP_EVT_SEC_INFO_REQUEST; - p_event->header.evt_len = event_len; - uint16_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.conn_handle); - - err_code = ble_gap_evt_sec_info_request_t_dec(p_buf, packet_len, &index, &p_event->evt.gap_evt.params.sec_info_request); - SER_ASSERT(err_code == NRF_SUCCESS, err_code); - - SER_ASSERT_LENGTH_EQ(index, packet_len); - *p_event_len = event_len; - - return NRF_SUCCESS; -}
