1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #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;
- }
|