Microchip® Advanced Software Framework

thirdparty/wireless/ble_sdk/ble_services/link_loss/link_loss.h File Reference

Link Loss Service declarations.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include "at_ble_api.h"
#include "ble_utils.h"
#include "ble_manager.h"

Data Structures

struct  gatt_lls_char_handler
 
struct  gatt_lls_char_handler
 

Macros

#define INVALID_LLS_PARAM   (0xff)
 
#define LLS_ALERT_LEVEL   LLS_HIGH_ALERT
 
#define LLS_CHARACTERISTIC_COUNT   (1)
 count of characteristics in linkloss service More...
 
#define LLS_CLIENT   0
 
#define LLS_INCLUDED_SERVICE_COUNT   (0)
 count of included service in Linkloss service More...
 
#define LLS_INVALID_CHAR_HANDLE   (0)
 
#define LLS_LEVEL   (2)
 
#define LLS_NO_SIGNED_WRITE   (false)
 
#define LLS_READ_LENGTH   (1)
 
#define LLS_READ_OFFSET   (0)
 
#define LLS_READ_RESP_INVALID   (-1)
 
#define LLS_SERVER   0
 
#define LLS_WRITE_LENGTH   (1)
 
#define LLS_WRITE_OFFSET   (0)
 
#define LLS_WRITE_WITH_RESPONSE   (true)
 
#define MAX_LLS_CHAR_SIZE   (1)
 

Typedefs

typedef struct
gatt_lls_char_handler 
gatt_lls_char_handler_t
 
typedef enum linkloss_alert_level linkloss_alert_level_t
 

Enumerations

enum  link_loss_alert_level_t {
  LLS_NO_ALERT,
  LLS_MILD_ALERT,
  LLS_HIGH_ALERT,
  LLS_NO_ALERT,
  LLS_LOW_ALERT,
  LLS_HIGH_ALERT
}
 
enum  linkloss_alert_level {
  LLS_NO_ALERT,
  LLS_MILD_ALERT,
  LLS_HIGH_ALERT,
  LLS_NO_ALERT,
  LLS_MILD_ALERT,
  LLS_HIGH_ALERT
}
 

Functions

void init_linkloss_service (gatt_service_handler_t *linkloss_serv)
 Initialize the linkloss service with default values. More...
 
at_ble_status_t lls_alert_level_read (at_ble_handle_t conn_handle, at_ble_handle_t char_handle)
 Send the Read request to link loss handler Read value will be reported via AT_BLE_CHARACTERISTIC_READ_RESPONSE event. More...
 
at_ble_status_t lls_alert_level_write (at_ble_handle_t conn_handle, at_ble_handle_t char_handle, link_loss_alert_level_t alert_level)
 write a characteristic to Link Loss Characteristics More...
 
int8_t lls_alert_read_response (at_ble_characteristic_read_response_t *read_resp, gatt_lls_char_handler_t *lls_handler)
 Read Link Loss Alert Value. More...
 
at_ble_status_t lls_primary_service_define (gatt_service_handler_t *lls_service)
 Defining linkloss service to the attribute data base. More...
 
uint8_t lls_set_alert_value (at_ble_characteristic_changed_t *change_params, gatt_service_handler_t *lls_handler)
 sets the alert value of the Linkloss service More...
 

#define INVALID_LLS_PARAM   (0xff)
#define LLS_ALERT_LEVEL   LLS_HIGH_ALERT
#define LLS_CHARACTERISTIC_COUNT   (1)

count of characteristics in linkloss service

Referenced by lls_primary_service_define().

#define LLS_CLIENT   0
#define LLS_INCLUDED_SERVICE_COUNT   (0)

count of included service in Linkloss service

Referenced by lls_primary_service_define().

#define LLS_INVALID_CHAR_HANDLE   (0)

Referenced by lls_alert_level_read().

#define LLS_LEVEL   (2)
#define LLS_NO_SIGNED_WRITE   (false)

Referenced by lls_alert_level_write().

#define LLS_READ_LENGTH   (1)
#define LLS_READ_OFFSET   (0)
#define LLS_READ_RESP_INVALID   (-1)

Referenced by lls_alert_read_response().

#define LLS_SERVER   0
#define LLS_WRITE_LENGTH   (1)

Referenced by lls_alert_level_write().

#define LLS_WRITE_OFFSET   (0)

Referenced by lls_alert_level_write().

#define LLS_WRITE_WITH_RESPONSE   (true)

Referenced by lls_alert_level_write().

#define MAX_LLS_CHAR_SIZE   (1)

Enumerator
LLS_NO_ALERT 
LLS_MILD_ALERT 
LLS_HIGH_ALERT 
LLS_NO_ALERT 
LLS_LOW_ALERT 
LLS_HIGH_ALERT 
Enumerator
LLS_NO_ALERT 
LLS_MILD_ALERT 
LLS_HIGH_ALERT 
LLS_NO_ALERT 
LLS_MILD_ALERT 
LLS_HIGH_ALERT 

void init_linkloss_service ( gatt_service_handler_t linkloss_serv)

Initialize the linkloss service with default values.

Parameters
[in]gatt_service_handler_tthe service info which has handle range,uuid and characteristic array fields
Precondition
Must be called before lls_primary_service_define
Returns
void

Initialize the linkloss service with default values.

at_ble_status_t lls_alert_level_read ( at_ble_handle_t  conn_handle,
at_ble_handle_t  char_handle 
)

Send the Read request to link loss handler Read value will be reported via AT_BLE_CHARACTERISTIC_READ_RESPONSE event.

Parameters
[in]conn_handlehandle of the connection
[in]char_handlehandle of the characteristic
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_INVALID_PARAM Invalid arguments.
AT_BLE_FAILURE Generic error.

Send the Read request to link loss handler Read value will be reported via AT_BLE_CHARACTERISTIC_READ_RESPONSE event.

Parameters
[in]conn_handlehandle of the connection
[in]char_handlehandle of the characteristic
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_INVALID_PARAM Invalid arguments.
AT_BLE_FAILURE Generic error.
at_ble_status_t lls_alert_level_write ( at_ble_handle_t  conn_handle,
at_ble_handle_t  char_handle,
link_loss_alert_level_t  alert_level 
)

write a characteristic to Link Loss Characteristics

if with_response is True, write completion will be reported via AT_BLE_CHARACTERISTIC_WRITE_RESPONSE event

Parameters
[in]conn_handlehandle of the connection
[in]char_handlehandle of the characteristic
[in]alertlevel need to write
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.
int8_t lls_alert_read_response ( at_ble_characteristic_read_response_t read_resp,
gatt_lls_char_handler_t lls_handler 
)

Read Link Loss Alert Value.

Parameters
[in]read_valueread response data available form at_ble_characteristic_read_response_t
Returns
Link Loss Alert level .
LLS_READ_RESP_INVALID if value are other than alert levels
Parameters
[in]read_valueread response data available form at_ble_characteristic_read_response_t
Returns
Link Loss Alert level.
LLS_READ_RESP_INVALID if value are other than alert levels
at_ble_status_t lls_primary_service_define ( gatt_service_handler_t lls_service)

Defining linkloss service to the attribute data base.

Parameters
[in]gatt_service_handler_tthe service info which has handle range,uuid and characteristic array fields
Precondition
Must be called after init_linkloss_service
Returns
AT_BLE_SUCCESS operation completed successfully
AT_BLE_FAILURE Generic error.

Defining linkloss service to the attribute data base.

uint8_t lls_set_alert_value ( at_ble_characteristic_changed_t change_params,
gatt_service_handler_t lls_handler 
)

sets the alert value of the Linkloss service

Parameters
[in]gatt_service_handler_tthe service info which has handle range,uuid and characteristic array fields
[in]at_ble_characteristic_changed_tthe information of the characteristic changed.
Returns
ias alert value

sets the alert value of the Linkloss service