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

Referenced by app_connected_state(), app_disconnected_event_handler(), and main().

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_characteristic_found_handler ( void *  params)

Handler for characteristic found event.

Parameters
[in]characteristicfound event parameter containing details like characteristic handle,uuid
Note
Called by the ble_manager after receiving characteristic found 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)

Handler for descriptor found event.

Parameters
[in]descriptorfound event parameter containing details like descriptor handle,uuid
Note
Called by the ble_manager after receiving descriptor found event
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
at_ble_status_t anp_client_discovery_complete_handler ( void *  params)

Handler for discovery complete event.

Parameters
[in]discoverycomplete event which contains result of discovery event
Note
Called by the ble_manager after receiving discovery complete event
void anp_client_init ( void *  params)

invoked by application for initializing the profile

Function used for profile initialization and also enable the advertisement.

Referenced by main().

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
at_ble_status_t anp_client_service_found_handler ( void *  params)

Handler for service found event.

Parameters
[in]servicefound event parameter containing details like service handle,uuid
Note
Called by the ble_manager after receiving service found event
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.

Referenced by anp_client_read_response_handler(), and anp_custom_event().

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
void anp_info_init ( void  )

Initializing the info init.

Initialize the profile specific information.

Referenced by anp_client_init().

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)
Handler for disconnection event.
Definition: ancs_profile.c:217
at_ble_status_t anp_client_write_notification_handler(void *param)
Handler for enabling the notification.
Definition: ancs_profile.c:300
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_discovery_complete_handler(void *params)
Handler for discovery complete event.
Definition: ancs_profile.c:138
at_ble_status_t anp_client_notification_handler(void *params)
Handler for notification event.
Definition: ancs_profile.c:274
at_ble_status_t anp_client_write_response_handler(void *params)
Handler for write response.
Definition: ancs_profile.c:262
at_ble_status_t anp_client_service_found_handler(void *params)
Handler for service found event.
Definition: ancs_profile.c:169
at_ble_status_t anp_client_characteristic_found_handler(void *params)
Handler for characteristic found event.
Definition: ancs_profile.c:186
at_ble_status_t anp_client_descriptor_found_handler(void *params)
Handler for descriptor found event.
Definition: ancs_profile.c:230
app_anp_data_t app_anp_info