初始版本

This commit is contained in:
xiaozhengsheng
2025-08-19 09:49:41 +08:00
parent 10f1ddf1c1
commit 6df0f7d96e
2974 changed files with 1712873 additions and 54 deletions

View File

@@ -0,0 +1,84 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_acknowledge_message_tx_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_size,
uint8_t * * const pp_mesg)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_size);
SER_ASSERT_NOT_NULL(*pp_mesg);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_dec(p_buf, packet_len, &index, *pp_mesg, *p_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_acknowledge_message_tx_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_TX_ACKNOWLEDGED_MESSAGE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_active_search_sharing_cycles_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_active_search_sharing_cycles_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t const * const p_cycles)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_t_enc(p_cycles, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_active_search_sharing_cycles_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_cycles)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_cycles);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_cycles);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_active_search_sharing_cycles_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_ACTIVE_SEARCH_SHARING_CYCLES_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,79 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_adv_burst_config_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_config,
uint8_t * const p_size)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_size);
SER_ASSERT_NOT_NULL(p_config);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_dec(p_buf, packet_len, &index, p_config, *p_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_adv_burst_config_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_ADV_BURST_CONFIG_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,84 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_broadcast_message_tx_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_size,
uint8_t * * const pp_mesg)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_size);
SER_ASSERT_NOT_NULL(*pp_mesg);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_dec(p_buf, packet_len, &index, *pp_mesg, *p_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_broadcast_message_tx_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_TX_BROADCAST_MESSAGE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,71 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_capabilities_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t const * const p_capabilities)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_CAPABILITIES, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_vector_enc(p_capabilities, MESG_CAPABILITIES_SIZE, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_assign_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_type,
uint8_t * const p_network,
uint8_t * const p_ext_assign)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_type);
SER_ASSERT_NOT_NULL(p_network);
SER_ASSERT_NOT_NULL(p_ext_assign);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_type);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_network);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_ext_assign);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_assign_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_ASSIGN, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_close_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_close_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_CLOSE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,97 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_id_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_id_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint16_t const * const p_device_number,
uint8_t const * const p_device_type,
uint8_t const * const p_transmit_type)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_CHANNEL_ID_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint16_t_enc(p_device_number, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_enc(p_device_type, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_enc(p_transmit_type, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_id_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint16_t * const p_device_number,
uint8_t * const p_device_type,
uint8_t * const p_transmission_type)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_device_number);
SER_ASSERT_NOT_NULL(p_device_type);
SER_ASSERT_NOT_NULL(p_transmission_type);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint16_t_dec(p_buf, packet_len, &index, p_device_number);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_device_type);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_transmission_type);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_id_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_ID_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_low_priority_rx_search_timeout_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_timeout)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_timeout);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_timeout);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_low_priority_rx_search_timeout_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_LOW_PRIO_RX_SEARCH_TIMEOUT_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_open_with_offset_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint16_t * const p_usOffset)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint16_t_dec(p_buf, packet_len, &index, p_usOffset);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_open_with_offset_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_OPEN, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_period_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_period_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint16_t const * const p_period)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_CHANNEL_PERIOD_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint16_t_enc(p_period, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_period_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint16_t * const p_period)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_period);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint16_t_dec(p_buf, packet_len, &index, p_period);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_period_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_PERIOD_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_radio_freq_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_radio_freq_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t const * const p_r_freq)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_CHANNEL_RADIO_FREQ_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_t_enc(p_r_freq, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_radio_freq_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_freq)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_freq);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_freq);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_radio_freq_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_RADIO_FREQ_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,83 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_radio_tx_power_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_tx_power,
uint8_t * const p_custom_tx_power)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_tx_power);
SER_ASSERT_NOT_NULL(p_custom_tx_power);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_tx_power);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_custom_tx_power);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_radio_tx_power_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_RADIO_TX_POWER_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_rx_search_timeout_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_timeout)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_timeout);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_timeout);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_rx_search_timeout_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_SEARCH_TIMEOUT_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,89 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_status_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_status_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t const * const p_status)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_CHANNEL_STATUS_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_t_enc(p_status, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_channel_unassign_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_channel_unassign_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CHANNEL_UNASSIGN, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,107 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_coex_config_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_channel)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_coex_config_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
ANT_BUFFER_PTR * const p_coex_config,
ANT_BUFFER_PTR * const p_adv_coex_config)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_COEX_CONFIG_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_t_enc(&(p_coex_config->ucBufferSize), p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_enc(p_coex_config->pucBuffer,
p_coex_config->ucBufferSize,
p_buf,
total_len,
p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_enc(&(p_adv_coex_config->ucBufferSize), p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_enc(p_adv_coex_config->pucBuffer,
p_adv_coex_config->ucBufferSize,
p_buf,
total_len,
p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,101 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_coex_config_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
ANT_BUFFER_PTR * const p_coex_config,
ANT_BUFFER_PTR * const p_adv_coex_config)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_coex_config);
SER_ASSERT_NOT_NULL(p_adv_coex_config);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
// Decode coex config buffer size
err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_coex_config->ucBufferSize));
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
// Decode coex config buffer
err_code = uint8_vector_dec(p_buf,
packet_len,
&index,
p_coex_config->pucBuffer,
p_coex_config->ucBufferSize);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
// Decode advanced coex config buffer size
err_code = uint8_t_dec(p_buf, packet_len, &index, &(p_adv_coex_config->ucBufferSize));
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
// Decode advanced coex config buffer
err_code = uint8_vector_dec(p_buf,
packet_len,
&index,
p_adv_coex_config->pucBuffer,
p_adv_coex_config->ucBufferSize);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_coex_config_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_COEX_CONFIG_SET, return_code, p_buf, p_buf_len, &index);
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_crypto_channel_enable_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_enable,
uint8_t * const p_key_num,
uint8_t * const p_decimation_rate)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_enable);
SER_ASSERT_NOT_NULL(p_key_num);
SER_ASSERT_NOT_NULL(p_decimation_rate);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_enable);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_key_num);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_decimation_rate);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_crypto_channel_enable_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CRYPTO_CHANNEL_ENABLE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,96 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_crypto_info_get_req_dec(uint8_t const * const p_buf,
uint16_t packet_len,
uint8_t * const p_type)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_type);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_type);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_crypto_info_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t type,
uint8_t const * const p_info)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_CRYPTO_INFO_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_t_enc(&type, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
uint8_t crypto_info_size = (MESG_CONFIG_ENCRYPT_REQ_CONFIG_USER_DATA_SIZE -
MESG_CHANNEL_NUM_SIZE);
err_code = uint8_vector_enc(p_info, crypto_info_size, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,84 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_crypto_info_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_type,
uint8_t * * const pp_info)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_type);
SER_ASSERT_NOT_NULL(*pp_info);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_type);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
uint8_t crypto_info_size = (MESG_CONFIG_ENCRYPT_REQ_CONFIG_USER_DATA_SIZE -
MESG_CHANNEL_NUM_SIZE) +
(MESG_CONFIG_ENCRYPT_REQ_CONFIG_ID_SIZE -
MESG_CHANNEL_NUM_SIZE);
err_code = uint8_vector_dec(p_buf, packet_len, &index, *pp_info, crypto_info_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_crypto_info_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CRYPTO_INFO_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,79 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_crypto_key_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_key_num,
uint8_t * * const pp_key)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_key_num);
SER_ASSERT_NOT_NULL(*pp_key);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_key_num);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_dec(p_buf, packet_len, &index, *pp_key, SIZE_OF_ENCRYPTED_KEY);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_crypto_key_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CRYPTO_KEY_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,88 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_cw_test_mode_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_radio_freq,
uint8_t * const p_tx_power,
uint8_t * const p_custom_tx_power,
uint8_t * const p_mode)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_radio_freq);
SER_ASSERT_NOT_NULL(p_tx_power);
SER_ASSERT_NOT_NULL(p_custom_tx_power);
SER_ASSERT_NOT_NULL(p_mode);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_radio_freq);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_tx_power);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_custom_tx_power);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_mode);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_cw_test_mode_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_CW_TEST_MODE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,55 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_cw_test_mode_init_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_INIT_CW_TEST_MODE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,75 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_enable_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
ANT_ENABLE * * const pp_ant_enable_params)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(pp_ant_enable_params);
SER_ASSERT_NOT_NULL(*pp_ant_enable_params);
err_code = cond_field_dec(p_buf, packet_len, &index, (void * *)pp_ant_enable_params, ANT_ENABLE_dec);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_enable_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_ENABLE, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,114 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "ant_parameters.h"
#include "nrf_sdh_ant.h"
#include "ant_struct_serialization.h"
#include "ble_serialization.h"
#include "ant_event_rx.h"
#include "app_util.h"
#include "cond_field_serialization.h"
uint32_t ant_event_enc(ant_evt_t const * const p_event,
uint32_t event_len,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t ret_val = NRF_SUCCESS;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
SER_ASSERT_NOT_NULL(p_event);
switch (p_event->event)
{
case NO_EVENT:
case EVENT_RX_SEARCH_TIMEOUT:
case EVENT_RX_FAIL:
case EVENT_TRANSFER_RX_FAILED:
case EVENT_TRANSFER_TX_COMPLETED:
case EVENT_TRANSFER_TX_FAILED:
case EVENT_CHANNEL_CLOSED:
case EVENT_RX_FAIL_GO_TO_SEARCH:
case EVENT_CHANNEL_COLLISION:
case EVENT_TRANSFER_TX_START:
case EVENT_TRANSFER_NEXT_DATA_BLOCK:
case CHANNEL_IN_WRONG_STATE:
case CHANNEL_NOT_OPENED:
case CHANNEL_ID_NOT_SET:
case CLOSE_ALL_CHANNELS:
case TRANSFER_IN_PROGRESS:
case TRANSFER_SEQUENCE_NUMBER_ERROR:
case TRANSFER_IN_ERROR:
case TRANSFER_BUSY:
case MESSAGE_SIZE_EXCEEDS_LIMIT:
case INVALID_MESSAGE:
case INVALID_NETWORK_NUMBER:
case INVALID_LIST_ID:
case INVALID_SCAN_TX_CHANNEL:
case INVALID_PARAMETER_PROVIDED:
case EVENT_QUE_OVERFLOW:
case EVENT_ENCRYPT_NEGOTIATION_SUCCESS:
case EVENT_ENCRYPT_NEGOTIATION_FAIL:
case EVENT_RFACTIVE_NOTIFICATION:
case EVENT_CONNECTION_START:
case EVENT_CONNECTION_SUCCESS:
case EVENT_CONNECTION_FAIL:
case EVENT_CONNECTION_TIMEOUT:
case EVENT_CONNECTION_UPDATE:
case NO_RESPONSE_MESSAGE:
case EVENT_RX:
case EVENT_BLOCKED:
case EVENT_TX:
{
uint32_t index = 0;
// TO DO - SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len);
uint32_t err_code = ant_evt_t_enc(p_event, p_buf, *p_buf_len, &index);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
*p_buf_len = index;
break;
}
default:
ret_val = NRF_ERROR_NOT_SUPPORTED;
break;
}
return ret_val;
}

View File

@@ -0,0 +1,74 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __ANT_EVENT_H__
#define __ANT_EVENT_H__
#include "ant_parameters.h"
#include "app_util.h"
#include "nrf_sdh_ant.h"
/**
* @addtogroup ser_conn_s212_codecs
* @{
* @ingroup ser_codecs_conn
*/
/**@brief Event encoding dispatcher.
*
* The event encoding dispatcher will route the event packet to the correct encoder which in turn
* encodes the contents of the event and updates the \p p_buf buffer.
*
* @param[in] p_event Pointer to the \ref ant_evt_t buffer that shall be encoded.
* @param[in] event_len Size (in bytes) of \p p_event buffer.
* @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet.
* @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer.
* \c out: Length of encoded contents in \p p_buf.
*
* @retval NRF_SUCCESS Encoding success.
* @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
* @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
* @retval NRF_ERROR_NOT_SUPPORTED Event encoder is not implemented.
*/
uint32_t ant_event_enc(ant_evt_t const * const p_event,
uint32_t event_len,
uint8_t * const p_buf,
uint32_t * const p_buf_len);
/** @} */
#endif

View File

@@ -0,0 +1,70 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_event_rx.h"
#include "ble_serialization.h"
#include "app_util.h"
uint32_t ant_event_rx_enc(ant_evt_t const * const p_event,
uint32_t event_len,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
ANT_MESSAGE * p_message;
uint32_t index = 0;
SER_ASSERT_NOT_NULL(p_event);
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
SER_ASSERT_LENGTH_LEQ(index + SER_EVT_HEADER_SIZE + 2 + 1, *p_buf_len);
p_message = (ANT_MESSAGE *)&p_event->message;
index += uint16_encode(EVENT_RX, &(p_buf[index])); // Mesg ID
p_buf[index++] = p_message->ANT_MESSAGE_ucSize; // Mesg Size
memcpy(&(p_buf[index]), p_message->ANT_MESSAGE_aucPayload,p_message->ANT_MESSAGE_ucSize); // Payload
index += p_message->ANT_MESSAGE_ucSize;
*p_buf_len = index;
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,72 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __ANT_EVENT_RX_H__
#define __ANT_EVENT_RX_H__
#include <string.h>
#include "ant_parameters.h"
#include "nrf_sdh_ant.h"
/**
* @addtogroup ser_conn_s212_codecs
* @{
* @ingroup ser_codecs_conn
*/
/**
* @brief Encodes ant_event_rx event.
*
* @param[in] p_event Pointer to the \ref ant_evt_t buffer that shall be encoded.
* @param[in] event_len Size (in bytes) of \p p_event buffer.
* @param[out] p_buf Pointer to the beginning of a buffer for encoded event packet.
* @param[in,out] p_buf_len \c in: Size (in bytes) of \p p_buf buffer.
* \c out: Length of encoded contents in \p p_buf.
*
* @retval NRF_SUCCESS Encoding success.
* @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
* @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
*/
uint32_t ant_event_rx_enc(ant_evt_t const * const p_event,
uint32_t event_len,
uint8_t * const p_buf,
uint32_t * const p_buf_len);
/** @} */
#endif

View File

@@ -0,0 +1,84 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_id_list_add_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * * const pp_dev_id,
uint8_t * const p_list_index)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(*pp_dev_id);
SER_ASSERT_NOT_NULL(p_list_index);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_dec(p_buf, packet_len, &index, *pp_dev_id, ANT_ID_SIZE);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_list_index);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_id_list_add_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_ID_LIST_ADD, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,84 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_id_list_config_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_id_list_size,
uint8_t * const p_inc_exc_flag)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_id_list_size);
SER_ASSERT_NOT_NULL(p_inc_exc_flag);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_id_list_size);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_inc_exc_flag);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_id_list_config_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_ID_LIST_CONFIG, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_lib_config_clear_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_ant_lib_config)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_ant_lib_config);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_ant_lib_config);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_lib_config_clear_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_LIB_CONFIG_CLEAR, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,71 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_lib_config_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t const * const p_ant_lib_config)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_LIB_CONFIG_GET, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_t_enc(p_ant_lib_config, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_lib_config_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_ant_lib_config)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_ant_lib_config);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_ant_lib_config);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_lib_config_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_LIB_CONFIG_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,79 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_network_address_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_network,
uint8_t * * const pp_network_key)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_network);
SER_ASSERT_NOT_NULL(*pp_network_key);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_network);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_vector_dec(p_buf, packet_len, &index, *pp_network_key, MESG_NETWORK_KEY_SIZE - MESG_CHANNEL_NUM_SIZE);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_network_address_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_NETWORK_KEY_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,83 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_prox_search_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_prox_threshold,
uint8_t * const p_custom_prox_threshold)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_prox_threshold);
SER_ASSERT_NOT_NULL(p_custom_prox_threshold);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_prox_threshold);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_custom_prox_threshold);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_prox_search_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_PROX_SEARCH_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,73 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_rx_scan_mode_start_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_sync_channel_packets_only)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_sync_channel_packets_only);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_sync_channel_packets_only);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_rx_scan_mode_start_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_RX_SCAN_MODE_START, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_search_channel_priority_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint8_t * const p_search_priority)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_search_priority);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_search_priority);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_search_channel_priority_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_SEARCH_CHANNEL_PRIORITY_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,78 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_search_waveform_set_req_dec(uint8_t const * const p_buf,
uint32_t packet_len,
uint8_t * const p_channel,
uint16_t * const p_waveform)
{
uint32_t index = SER_CMD_DATA_POS;
uint32_t err_code;
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_channel);
SER_ASSERT_NOT_NULL(p_waveform);
err_code = uint8_t_dec(p_buf, packet_len, &index, p_channel);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
err_code = uint16_t_dec(p_buf, packet_len, &index, p_waveform);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
SER_ASSERT_LENGTH_EQ(index, packet_len);
return err_code;
}
uint32_t ant_search_waveform_set_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_SEARCH_WAVEFORM_SET, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,55 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_stack_reset_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len)
{
uint32_t index = 0;
return op_status_enc(SVC_ANT_STACK_INIT, return_code, p_buf, p_buf_len, &index);
}

View File

@@ -0,0 +1,71 @@
/**
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <string.h>
#include "ant_conn.h"
#include "ble_serialization.h"
#include "cond_field_serialization.h"
#include "ant_struct_serialization.h"
#include "app_util.h"
uint32_t ant_version_get_rsp_enc(uint32_t return_code,
uint8_t * const p_buf,
uint32_t * const p_buf_len,
uint8_t const * const p_version)
{
SER_ASSERT_NOT_NULL(p_buf);
SER_ASSERT_NOT_NULL(p_buf_len);
uint32_t total_len = *p_buf_len;
uint32_t err_code = ser_ble_cmd_rsp_status_code_enc(SVC_ANT_VERSION, return_code,
p_buf, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
if (return_code != NRF_SUCCESS)
{
return NRF_SUCCESS;
}
err_code = uint8_vector_enc(p_version, MESG_BUFFER_SIZE, p_buf, total_len, p_buf_len);
SER_ASSERT(err_code == NRF_SUCCESS, err_code);
return NRF_SUCCESS;
}