Microchip® Advanced Software Framework

ancs_profile.c File Reference

ANCS Profile.

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

#include <string.h>
#include "at_ble_api.h"
#include "ble_manager.h"
#include "ble_utils.h"
#include "ancs_profile.h"
#include "ancs.h"

Functions

void anp_client_adv (void)
 anp_client_adv sets the advertisement data and starts advertisement More...
 
void anp_client_char_changed_handler (at_ble_characteristic_changed_t *params)
 Handler for char changed handler. More...
 
at_ble_status_t anp_client_characteristic_found_handler (void *params)
 Handler for characteristic found event. More...
 
at_ble_status_t anp_client_connected_state_handler (void *params)
 Handler for connection event. More...
 
at_ble_status_t anp_client_descriptor_found_handler (void *params)
 Handler for descriptor found event. More...
 
at_ble_status_t anp_client_disconnected_event_handler (void *params)
 Handler for disconnection event. More...
 
at_ble_status_t anp_client_discovery_complete_handler (void *params)
 Handler for discovery complete event. More...
 
void anp_client_init (void *params)
 invoked by application for initializing the profile More...
 
at_ble_status_t anp_client_notification_handler (void *params)
 Handler for notification event. More...
 
at_ble_status_t anp_client_service_found_handler (void *params)
 Handler for service found event. More...
 
at_ble_status_t anp_client_write_notification_handler (void *param)
 Handler for enabling the notification. More...
 
at_ble_status_t anp_client_write_response_handler (void *params)
 Handler for write response. More...
 
void anp_info_init (void)
 Initializing the info init. More...
 

Variables

ancs_prf_t ancs_data
 
static const ble_gap_event_cb_t ancs_gap_handle
 
static const
ble_gatt_client_event_cb_t 
ancs_gatt_client_handle
 
app_anp_data_t app_anp_info
 

void anp_client_adv ( void  )

anp_client_adv sets the advertisement data and starts advertisement

does all the profile initialization and starts the advertisement

References APP_ANP_ADV_TIMEOUT, APP_ANP_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, DBG_LOG, and NULL.

void anp_client_char_changed_handler ( at_ble_characteristic_changed_t params)

Handler for char changed handler.

Parameters
[in]characteristicchanged event parameter containing details like characteristic handle,value
Note
Called by the ble_manager after receiving characteristic change event
at_ble_status_t anp_client_connected_state_handler ( void *  params)

Handler for connection event.

Parameters
[in]connectedevent parameter containing details like handle
Note
Called by the ble_manager after receiving connection event

References ancs_enable(), ancs_prf::ancs_serv, at_ble_primary_service_discover_by_uuid(), AT_BLE_SUCCESS, app_anp_data::conn_params, DBG_LOG, app_anp_data::devicedb, END_HANDLE, at_ble_connected_t::handle, at_ble_primary_service_found_t::service_uuid, START_HANDLE, and status.

at_ble_status_t anp_client_descriptor_found_handler ( void *  params)
at_ble_status_t anp_client_disconnected_event_handler ( void *  params)

Handler for disconnection event.

Parameters
[in]disconnectedevent parameter containing details like handle
Note
Called by the ble_manager after receiving disconnection event

References ALL_UNUSED, AT_BLE_SUCCESS, connected_cb, app_anp_data::devicedb, and FALSE.

void anp_client_init ( void *  params)

invoked by application for initializing the profile

Function used for profile initialization and also enable the advertisement.

References ancs_init(), anp_info_init(), AT_BLE_SUCCESS, ble_advertisement_data_set(), BLE_GAP_EVENT_TYPE, BLE_GATT_CLIENT_EVENT_TYPE, ble_mgr_events_callback_handler(), DBG_LOG, REGISTER_CALL_BACK, status, and UNUSED.

at_ble_status_t anp_client_notification_handler ( void *  params)

Handler for notification event.

Parameters
[in]notificationreceived parameter containing the notification value
Note
Called by the ble_manager after receiving the notification

References anp_alert_notify_response(), AT_BLE_SUCCESS, CATEGORY_ID_INCOMINGCALL, at_ble_notification_recieved_t::char_value, DBG_LOG, NOTIFICATION_ADDED, and NOTIFICATION_REMOVED.

at_ble_status_t anp_client_service_found_handler ( void *  params)
at_ble_status_t anp_client_write_notification_handler ( void *  param)

Handler for enabling the notification.

Note
Called by the ble_manager for enabling the notification in the gatt server

References at_ble_characteristic_write(), AT_BLE_FAILURE, AT_BLE_SUCCESS, at_ble_descriptor_found_t::conn_handle, data, DBG_LOG, at_ble_descriptor_found_t::desc_handle, FALSE, ancs_prf::notification_source_desc, TRUE, and UNUSED.

at_ble_status_t anp_client_write_response_handler ( void *  params)

Handler for write response.

Parameters
[in]writeresponse parameter contacting the result of write request
Note
Called by the ble_manager after receiving write response event

References AT_BLE_SUCCESS, at_ble_characteristic_write_response_t::char_handle, DBG_LOG_DEV, gatt_anp_handler::new_alert_desc_handle, and gatt_anp_handler::unread_alert_desc_handle.

ancs_prf_t ancs_data
const ble_gap_event_cb_t ancs_gap_handle
static
Initial value:
= {
.encryption_status_changed = anp_client_write_notification_handler
}
at_ble_status_t anp_client_disconnected_event_handler(void *params)
disconnected event handler invoked by ble manager
Definition: alert_notification_profile.c:474
void anp_client_write_notification_handler(void)
Handler for enabling the notification.
Definition: alert_notification_profile.c:544
at_ble_status_t anp_client_connected_state_handler(void *params)
Handler for connection event.
Definition: ancs_profile.c:112
const ble_gatt_client_event_cb_t ancs_gatt_client_handle
static
Initial value:
= {
.primary_service_found = anp_client_service_found_handler,
.characteristic_found = anp_client_characteristic_found_handler,
.characteristic_write_response = anp_client_write_response_handler,
.notification_recieved = anp_client_notification_handler
}
at_ble_status_t anp_client_notification_handler(void *params)
invoked by ble manager on receiving notification
Definition: alert_notification_profile.c:505
at_ble_status_t anp_client_write_response_handler(void *params)
write response handler invoked by ble manager
Definition: alert_notification_profile.c:488
at_ble_status_t anp_client_service_found_handler(void *params)
Service found handler invoked by ble manager.
Definition: alert_notification_profile.c:292
at_ble_status_t anp_client_discovery_complete_handler(void *params)
Discovery Complete handler invoked by ble manager.
Definition: alert_notification_profile.c:223
at_ble_status_t anp_client_descriptor_found_handler(void *params)
client descriptor found handler invoked by ble manager
Definition: alert_notification_profile.c:436
at_ble_status_t anp_client_characteristic_found_handler(void *params)
characteristic found handler invoked by ble manager
Definition: alert_notification_profile.c:324
app_anp_data_t app_anp_info