Microchip® Advanced Software Framework

link_loss.c File Reference

Linkloss service.

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

#include "link_loss.h"

Functions

void init_linkloss_service (gatt_service_handler_t *linkloss_serv)
 Linkloss service initialization. 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)
 linkloss service definition More...
 
uint8_t lls_set_alert_value (at_ble_characteristic_changed_t *change_params, gatt_service_handler_t *lls_handler)
 Setting the alert value of linkloss service. More...
 

Variables

uint8_t linkloss_initial_value = 0
 
static const char * lls_gs_str [] = {"NO_ALERT", "MILD_ALERT", "HIGH_ALERT"}
 

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.

References AT_BLE_ATT_INVALID_HANDLE, at_ble_characteristic_read(), LLS_INVALID_CHAR_HANDLE, LLS_READ_LENGTH, and LLS_READ_OFFSET.

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.

References at_ble_characteristic_write(), LLS_NO_SIGNED_WRITE, LLS_WRITE_LENGTH, LLS_WRITE_OFFSET, and LLS_WRITE_WITH_RESPONSE.

Referenced by pxp_monitor_app_button_event(), and pxp_monitor_discovery_complete_handler().

int8_t lls_alert_read_response ( at_ble_characteristic_read_response_t read_resp,
gatt_lls_char_handler_t lls_handler 
)
at_ble_status_t lls_primary_service_define ( gatt_service_handler_t lls_service)

linkloss service definition

Defining linkloss service to the attribute data base.

References at_ble_primary_service_define(), LLS_CHARACTERISTIC_COUNT, LLS_INCLUDED_SERVICE_COUNT, and NULL.

Referenced by pxp_service_define().

uint8_t lls_set_alert_value ( at_ble_characteristic_changed_t change_params,
gatt_service_handler_t lls_handler 
)

Setting the alert value of linkloss service.

sets the alert value of the Linkloss service

References at_ble_characteristic_changed_t::char_handle, at_ble_characteristic_changed_t::char_new_value, DBG_LOG, INVALID_LLS_PARAM, lls_gs_str, and LLS_HIGH_ALERT.

Referenced by pxp_reporter_char_changed_handler().

uint8_t linkloss_initial_value = 0

Referenced by init_linkloss_service().

const char* lls_gs_str[] = {"NO_ALERT", "MILD_ALERT", "HIGH_ALERT"}
static

Referenced by lls_set_alert_value().