Functions
Functions
BLE Services » Profile/Service Utilities

## Functions
void | prf_pack_char_pres_fmt (uint8_t *p_packed_val, const prf_char_pres_fmt_t *p_char_pres_fmt)
| Pack Characteristic Presentation Format descriptor value to a buffer. More...
void | prf_unpack_char_pres_fmt (const uint8_t *p_packed_val, prf_char_pres_fmt_t *p_char_pres_fmt)
| Unpack the data in a buffer to the structure of Characteristic Presentation Format descriptor value. More...
uint8_t | prf_pack_date_time (uint8_t *p_packed_val, const prf_date_time_t *p_date_time)
| Pack the value in date-time structure to a buffer. More...
uint8_t | prf_unpack_date_time (const uint8_t *p_packed_val, prf_date_time_t *p_date_time)
| Unpack the data in buffer to the date-time structure. More...
uint8_t | prf_find_idx_by_handle (uint16_t handle, uint16_t start_hdl, uint8_t char_nb, uint8_t *p_char_mask)
| Find the attribute index by handle. More...
uint16_t | prf_find_handle_by_idx (uint8_t idx, uint16_t start_hdl, uint8_t *p_char_mask)
| Find the attribute handle by index. More...
bool | prf_is_cccd_value_valid (uint16_t cccd_value)
| Check if a CCCD value is valid. More...
bool | prf_is_notification_enabled (uint16_t cccd_value)
| Check if a CCCD value is notification enabled. More...
bool | prf_is_indication_enabled (uint16_t cccd_value)
| Check if a CCCD value is indication enabled. More...

## Detailed Description

## Function Documentation

## ◆ prf_find_handle_by_idx()

uint16_t prf_find_handle_by_idx | ( | uint8_t | idx,
|  | uint16_t | start_hdl,
|  | uint8_t * | p_char_mask
| ) |  |

Find the attribute handle by index.

Parameters

  [in] | idx | The attribute index in the service's attribute table.
  [in] | start_hdl | The start handle value in the database.
  [in] | p_char_mask | Pointer to the mask of characteristics which are added into BLE Stack database from the service's attribute table.

Returns
  The handle of the attribute with the index in BLE Stack database.

## ◆ prf_find_idx_by_handle()

uint8_t prf_find_idx_by_handle | ( | uint16_t | handle,
|  | uint16_t | start_hdl,
|  | uint8_t | char_nb,
|  | uint8_t * | p_char_mask
| ) |  |

Find the attribute index by handle.

Parameters

  [in] | handle | The handle of a characteristic in BLE Stack database.
  [in] | start_hdl | The start handle of a service in BLE Stack database.
  [in] | char_nb | The number of the characteristics in a service's attribute table.
  [in] | p_char_mask | Pointer to the mask of characteristics which are added into BLE Stack database from the service's attribute table.

Returns
  The handle's index in the service's attribute table.

## ◆ prf_is_cccd_value_valid()

bool prf_is_cccd_value_valid | ( | uint16_t | cccd_value | ) |

Check if a CCCD value is valid.

Parameters

  [in] | cccd_value | The CCCD value to be checked.

Returns
  True if valid, otherwise false.

## ◆ prf_is_indication_enabled()

bool prf_is_indication_enabled | ( | uint16_t | cccd_value | ) |

Check if a CCCD value is indication enabled.

Parameters

  [in] | cccd_value | The CCCD value to be checked

Returns
  true if enabled, otherwise false.

## ◆ prf_is_notification_enabled()

bool prf_is_notification_enabled | ( | uint16_t | cccd_value | ) |

Check if a CCCD value is notification enabled.

Parameters

  [in] | cccd_value | The CCCD value to be checked.

Returns
  true if enabled, otherwise false.

## ◆ prf_pack_char_pres_fmt()

void prf_pack_char_pres_fmt | ( | uint8_t * | p_packed_val,
|  | const prf_char_pres_fmt_t * | p_char_pres_fmt
| ) |  |

Pack Characteristic Presentation Format descriptor value to a buffer.

Parameters

  [out] | p_packed_val | Pointer to the packed buffer.
  [in] | p_char_pres_fmt | Pointer to the structure of Characteristic Presentation Format value. See prf_char_pres_fmt_t.

## ◆ prf_pack_date_time()

uint8_t prf_pack_date_time | ( | uint8_t * | p_packed_val,
|  | const prf_date_time_t * | p_date_time
| ) |  |

Pack the value in date-time structure to a buffer.

Parameters

  [out] | p_packed_val | Pointer to a packed buffer.
  [in] | p_date_time | Pointer to the date-time structure, see prf_date_time_t.

Returns
  The size of packed value.

## ◆ prf_unpack_char_pres_fmt()

void prf_unpack_char_pres_fmt | ( | const uint8_t * | p_packed_val,
|  | prf_char_pres_fmt_t * | p_char_pres_fmt
| ) |  |

Unpack the data in a buffer to the structure of Characteristic Presentation Format descriptor value.

Parameters

  [in] | p_packed_val | Pointer to the packed buffer.
  [out] | p_char_pres_fmt | Pointer to the structure of Characteristic Presentation Format value. See prf_char_pres_fmt_t.

## ◆ prf_unpack_date_time()

uint8_t prf_unpack_date_time | ( | const uint8_t * | p_packed_val,
|  | prf_date_time_t * | p_date_time
| ) |  |

Unpack the data in buffer to the date-time structure.

Parameters

  [in] | p_packed_val | Pointer to the packed buffer.
  [out] | p_date_time | Pointer to date-time structure, see prf_date_time_t.

Returns
  The size of packed value