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, and DBG_LOG.
Referenced by app_disconnected_event_handler(), and main().
void anp_client_char_changed_handler | ( | at_ble_characteristic_changed_t * | params | ) |
Handler for char changed handler.
[in] | characteristic | changed event parameter containing details like characteristic handle,value |
at_ble_status_t anp_client_characteristic_found_handler | ( | void * | params | ) |
Handler for characteristic found event.
[in] | characteristic | found event parameter containing details like characteristic handle,uuid |
References ANCS_CHAR_CONTROL_POINT, ANCS_CHAR_DATA_SOURCE, ANCS_CHAR_NOTIFICATION_SOURCE_UUID, AT_BLE_SUCCESS, at_ble_characteristic_found_t::char_handle, app_anp_data::char_info, at_ble_characteristic_found_t::char_uuid, at_ble_characteristic_found_t::conn_handle, ancs_prf::control_point_char, ancs_prf::data_source_char, DBG_LOG_DEV, ancs_prf::notification_source_char, at_ble_characteristic_found_t::properties, at_ble_uuid_t::uuid, and at_ble_characteristic_found_t::value_handle.
at_ble_status_t anp_client_connected_state_handler | ( | void * | params | ) |
Handler for connection event.
[in] | connected | event parameter containing details like handle |
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, and START_HANDLE.
at_ble_status_t anp_client_descriptor_found_handler | ( | void * | params | ) |
Handler for descriptor found event.
[in] | descriptor | found event parameter containing details like descriptor handle,uuid |
References AT_BLE_SUCCESS, at_ble_descriptor_found_t::conn_handle, DBG_LOG_DEV, at_ble_descriptor_found_t::desc_handle, at_ble_descriptor_found_t::desc_uuid, ancs_prf::notification_source_desc, and at_ble_uuid_t::uuid.
at_ble_status_t anp_client_disconnected_event_handler | ( | void * | params | ) |
Handler for disconnection event.
[in] | disconnected | event parameter containing details like handle |
References AT_BLE_SUCCESS, app_anp_data::devicedb, and FALSE.
at_ble_status_t anp_client_discovery_complete_handler | ( | void * | params | ) |
Handler for discovery complete event.
[in] | discovery | complete event which contains result of discovery event |
References ancs_prf::ancs_serv, at_ble_characteristic_discover_all(), at_ble_descriptor_discover_all(), AT_BLE_DISC_ALL_CHAR, AT_BLE_DISC_BY_UUID_SVC, AT_BLE_DISC_DESC_CHAR, AT_BLE_SUCCESS, AT_DISCOVER_SUCCESS, at_ble_characteristic_found_t::char_handle, at_ble_characteristic_found_t::conn_handle, app_anp_data::conn_params, ancs_prf::data_source_char, DBG_LOG, app_anp_data::devicedb, at_ble_primary_service_found_t::end_handle, at_ble_connected_t::handle, ancs_prf::notification_source_char, at_ble_cmd_complete_event_t::operation, at_ble_primary_service_found_t::start_handle, at_ble_cmd_complete_event_t::status, TRUE, and at_ble_characteristic_found_t::value_handle.
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, and UNUSED.
Referenced by main().
at_ble_status_t anp_client_notification_handler | ( | void * | params | ) |
Handler for notification event.
[in] | notification | received parameter containing the notification value |
References 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 | ) |
Handler for service found event.
[in] | service | found event parameter containing details like service handle,uuid |
References ancs_prf::ancs_serv, AT_BLE_SUCCESS, at_ble_primary_service_found_t::conn_handle, DBG_LOG_DEV, at_ble_primary_service_found_t::end_handle, and at_ble_primary_service_found_t::start_handle.
at_ble_status_t anp_client_write_notification_handler | ( | void * | param | ) |
Handler for enabling the notification.
References at_ble_characteristic_write(), AT_BLE_FAILURE, AT_BLE_SUCCESS, at_ble_descriptor_found_t::conn_handle, 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.
[in] | write | response parameter contacting the result of write request |
References AT_BLE_SUCCESS.
void anp_info_init | ( | void | ) |
Initializing the info init.
Initialize the profile specific information.
References app_anp_data::devicedb, app_anp_data::discover_role, DISCOVER_SERVICE, and FALSE.
Referenced by anp_client_init().
ancs_prf_t ancs_data |
|
static |
|
static |
app_anp_data_t app_anp_info |