Classes | Macros | Typedefs | Enumerations | Functions
ras_ad.h File Reference

Ranging Service Adaptor. More...

`#include "gr_includes.h"`
`#include <stdbool.h>`
`#include <stdint.h>`
Include dependency graph for ras_ad.h:

Go to the source code of this file.

## Classes
struct | ras_ad_send_nti_ind_cmp_info_t
| Event parameter for RAS_AD_EVT_SEND_NTI_IND_CMP. More...
struct | ras_ad_set_cccd_info_t
| Event parameter for set cccd. More...
struct | ras_ad_evt_t
| Raning Service Adaptor event. More...

## Macros
#define | RAS_AD_FEA_MAX_LEN 4
| Maximun length of feature value. More...
#define | RAS_AD_DATA_MAX_LEN 244
| Maximun length of ranging data value(251 - 4 - 3). More...
#define | RAS_AD_CP_MAX_LEN 5
| Maximun length of control point value. More...
#define | RAS_AD_DATA_READY_MAX_LEN 2
| Maximun length of ranging data ready value. More...
#define | RAS_AD_DATA_OW_MAX_LEN 2
| Maximun length of ranging data overwritten value. More...

## Typedefs
typedef void(* | ras_ad_evt_handler_t) (ras_ad_evt_t *p_evt)
| Ranging Service event handler type. More...

## Enumerations
enum | ras_ad_attr_idx_t { RAS_AD_IDX_SVC, RAS_AD_IDX_FEA_CHAR, RAS_AD_IDX_FEA_VAL, RAS_AD_IDX_RT_DATA_CHAR, RAS_AD_IDX_RT_DATA_VAL, RAS_AD_IDX_RT_DATA_CCCD_CFG, RAS_AD_IDX_OD_DATA_CHAR, RAS_AD_IDX_OD_DATA_VAL, RAS_AD_IDX_OD_DATA_CCCD_CFG, RAS_AD_IDX_CP_CHAR, RAS_AD_IDX_CP_VAL, RAS_AD_IDX_CP_CCCD_CFG, RAS_AD_IDX_DATA_READY_CHAR, RAS_AD_IDX_DATA_READY_VAL, RAS_AD_IDX_DATA_READY_CCCD_CFG, RAS_AD_IDX_DATA_OW_CHAR, RAS_AD_IDX_DATA_OW_VAL, RAS_AD_IDX_DATA_OW_CCCD_CFG, RAS_AD_IDX_NB }
| Ranging Service Adaptor Attributes Indexes. More...
enum | ras_ad_evt_type_t { RAS_AD_EVT_INVALID, RAS_AD_EVT_SET_RT_DATA_CCCD, RAS_AD_EVT_SET_OD_DATA_CCCD, RAS_AD_EVT_SET_CP_CCCD, RAS_AD_EVT_SET_DATA_READY_CCCD, RAS_AD_EVT_SET_DATA_OW_CCCD, RAS_AD_EVT_WRITE_CP, RAS_AD_EVT_SEND_NTI_IND_CMP }
| Ranging Service Adaptor event types. More...
enum | ras_ad_send_data_type_t { RAS_AD_SEND_DATA_TYPE_INVALID, RAS_AD_SEND_DATA_TYPE_NOTIFY, RAS_AD_SEND_DATA_TYPE_INDICATE }
| The type for sending data. More...

## Functions
sdk_err_t | ras_ad_init (ras_ad_evt_handler_t evt_handler, uint32_t features)
| Initialize Ranging Service Adaptor instances and add to the DB. More...
sdk_err_t | ras_ad_send_noti_ind (uint8_t conn_idx, uint8_t type, uint8_t att_idx, uint16_t data_len, uint8_t *p_data)
| Send notification or indication. More...

## Detailed Description

Ranging Service Adaptor.

Attention

  ##### Copyright (c) 2024 GOODIX

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND 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.

Definition in file ras_ad.h.

## Macro Definition Documentation

## ◆ RAS_AD_CP_MAX_LEN

#define RAS_AD_CP_MAX_LEN 5

Maximun length of control point value.

Definition at line 47 of file ras_ad.h.

## ◆ RAS_AD_DATA_MAX_LEN

#define RAS_AD_DATA_MAX_LEN 244

Maximun length of ranging data value(251 - 4 - 3).

Definition at line 46 of file ras_ad.h.

## ◆ RAS_AD_DATA_OW_MAX_LEN

#define RAS_AD_DATA_OW_MAX_LEN 2

Maximun length of ranging data overwritten value.

Definition at line 49 of file ras_ad.h.

## ◆ RAS_AD_DATA_READY_MAX_LEN

#define RAS_AD_DATA_READY_MAX_LEN 2

Maximun length of ranging data ready value.

Definition at line 48 of file ras_ad.h.

## ◆ RAS_AD_FEA_MAX_LEN

#define RAS_AD_FEA_MAX_LEN 4

Maximun length of feature value.

Definition at line 45 of file ras_ad.h.

## Typedef Documentation

## ◆ ras_ad_evt_handler_t

typedef void(* ras_ad_evt_handler_t) (ras_ad_evt_t *p_evt)

Ranging Service event handler type.

Definition at line 127 of file ras_ad.h.

## Enumeration Type Documentation

## ◆ ras_ad_attr_idx_t

enum ras_ad_attr_idx_t

Ranging Service Adaptor Attributes Indexes.

Enumerator
RAS_AD_IDX_SVC |
RAS_AD_IDX_FEA_CHAR |
RAS_AD_IDX_FEA_VAL |
RAS_AD_IDX_RT_DATA_CHAR |
RAS_AD_IDX_RT_DATA_VAL |
RAS_AD_IDX_RT_DATA_CCCD_CFG |
RAS_AD_IDX_OD_DATA_CHAR |
RAS_AD_IDX_OD_DATA_VAL |
RAS_AD_IDX_OD_DATA_CCCD_CFG |
RAS_AD_IDX_CP_CHAR |
RAS_AD_IDX_CP_VAL |
RAS_AD_IDX_CP_CCCD_CFG |
RAS_AD_IDX_DATA_READY_CHAR |
RAS_AD_IDX_DATA_READY_VAL |
RAS_AD_IDX_DATA_READY_CCCD_CFG |
RAS_AD_IDX_DATA_OW_CHAR |
RAS_AD_IDX_DATA_OW_VAL |
RAS_AD_IDX_DATA_OW_CCCD_CFG |
RAS_AD_IDX_NB |

Definition at line 52 of file ras_ad.h.

## ◆ ras_ad_evt_type_t

enum ras_ad_evt_type_t

Ranging Service Adaptor event types.

Enumerator
RAS_AD_EVT_INVALID | That it's an invalid event.
RAS_AD_EVT_SET_RT_DATA_CCCD | Set CCCD for real time data.
RAS_AD_EVT_SET_OD_DATA_CCCD | Set CCCD for on demand data.
RAS_AD_EVT_SET_CP_CCCD | Set CCCD for control point.
RAS_AD_EVT_SET_DATA_READY_CCCD | Set CCCD for data ready.
RAS_AD_EVT_SET_DATA_OW_CCCD | Set CCCD for data overwritten.
RAS_AD_EVT_WRITE_CP | Write control point.
RAS_AD_EVT_SEND_NTI_IND_CMP | Send notification or indication complete.

Definition at line 83 of file ras_ad.h.

## ◆ ras_ad_send_data_type_t

enum ras_ad_send_data_type_t

The type for sending data.

Enumerator
RAS_AD_SEND_DATA_TYPE_INVALID | Invalid type.
RAS_AD_SEND_DATA_TYPE_NOTIFY | Send data using notification.
RAS_AD_SEND_DATA_TYPE_INDICATE | Send data using indication.

Definition at line 96 of file ras_ad.h.

## Function Documentation

## ◆ ras_ad_init()

sdk_err_t ras_ad_init | ( | ras_ad_evt_handler_t | evt_handler,
|  | uint32_t | features
| ) |  |

Initialize Ranging Service Adaptor instances and add to the DB.

Parameters

  [in] | evt_handler | Event handler for the gatt operation.
  [in] | features | Features to support.

Returns
  Result of Ranging Service Adaptor initialization.

## ◆ ras_ad_send_noti_ind()

sdk_err_t ras_ad_send_noti_ind | ( | uint8_t | conn_idx,
|  | uint8_t | type,
|  | uint8_t | att_idx,
|  | uint16_t | data_len,
|  | uint8_t * | p_data
| ) |  |

Send notification or indication.

Parameters

  [in] | conn_idx | Connection index.
  [in] | type | Type for sending data, ras_ad_send_data_type_t.
  [in] | att_idx | Attribute index, ras_ad_attr_idx_t.
  [in] | data_len | Data length.
  [in] | p_data | Pointer to the data.

Returns
  Result of Ranging Service Adaptor initialization.