Phone Alert Status 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 "pas_client.h"
#include "pas_service.h"
Functions | |
void | pas_client_adv (void) |
sets the advertisement data and triggers advertisement More... | |
at_ble_status_t | pas_client_char_read_response_handler (void *event_params) |
called by the ble manager after receiving the read response event More... | |
at_ble_status_t | pas_client_char_write_response_handler (void *event_params) |
invoked by ble manager for setting the write response handler More... | |
at_ble_status_t | pas_client_characteristic_found_handler (void *params) |
characteristic found handler invoked by ble manager More... | |
at_ble_status_t | pas_client_descriptor_found_handler (void *param) |
client descriptor found handler invoked by ble manager More... | |
at_ble_status_t | pas_client_disconnected_event_handler (void *params) |
disconnected event handler invoked by ble manager More... | |
at_ble_status_t | pas_client_discovery_complete_handler (void *params) |
Discovery Complete handler invoked by ble manager. More... | |
at_ble_status_t | pas_client_enable_char_notification (bool char_id, bool enable) |
invoked by ble manager for setting the notification of characteristics More... | |
void | pas_client_init (void *params) |
invoked by ble manager for initializing the profile More... | |
at_ble_status_t | pas_client_notification_handler (void *params) |
invoked by ble manager on receiving notification More... | |
at_ble_status_t | pas_client_read_alert_status_char (void) |
invoked by app to read the alert status characteristic More... | |
at_ble_status_t | pas_client_read_ringer_setting_char (void) |
invoked by app to read the write status characteristic More... | |
at_ble_status_t | pas_client_service_discovery (void *params) |
to perform the service discovery More... | |
at_ble_status_t | pas_client_service_found_handler (void *params) |
Service found handler invoked by ble manager. More... | |
at_ble_status_t | pas_client_start_service_discovery (void) |
starts the service discovery More... | |
at_ble_status_t | pas_client_write_notifications (void *params) |
invoked by ble manager for setting the notification More... | |
at_ble_status_t | pas_client_write_ringer_control_point (uint8_t ringer) |
invoked by app to read the write ringer control point characteristic More... | |
void | pas_data_init (void) |
void | register_alert_status_notification_callback (notification_callback_t app_notify_cb) |
register the call back for notification of alert status More... | |
void | register_alert_status_read_callback (read_callback_t app_read_cb) |
register the call back for reading alert status More... | |
void | register_ringer_setting_notification_callback (notification_callback_t app_notify_cb) |
register the call back for notification of ringer setting More... | |
void | register_ringer_setting_read_callback (read_callback_t app_read_cb) |
register the call back for reading ringer setting More... | |
void pas_client_adv | ( | void | ) |
sets the advertisement data and triggers advertisement
[in] | none |
References APP_PAS_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.
Referenced by app_disconnected_event_handler(), and main().
at_ble_status_t pas_client_char_read_response_handler | ( | void * | event_params | ) |
called by the ble manager after receiving the read response event
[in] | characteristic | read response parameters |
References pas_service_handler::alert_status_char, alert_status_read_cb, AT_BLE_SUCCESS, at_ble_characteristic_read_response_t::char_len, at_ble_characteristic_read_response_t::char_offset, at_ble_characteristic_read_response_t::char_value, DBG_LOG_DEV, pas_service_handler::ringer_setting_char, ringer_setting_read_cb, and char_info::value_handle.
at_ble_status_t pas_client_char_write_response_handler | ( | void * | event_params | ) |
invoked by ble manager for setting the write response handler
[in] | at_ble_characteristic_write_response_t | response data contains status and handle |
References pas_service_handler::alert_status_desc, AT_BLE_SUCCESS, at_ble_characteristic_write_response_t::char_handle, DBG_LOG, DBG_LOG_DEV, desc_info::desc_handle, pas_service_handler::ringer_setting_desc, and at_ble_characteristic_write_response_t::status.
at_ble_status_t pas_client_characteristic_found_handler | ( | void * | params | ) |
characteristic found handler invoked by ble manager
[in] | at_ble_characteristic_found_t | when a characteristic is found in peer device |
References pas_service_handler::alert_status_char, ALERT_STATUS_UUID, AT_BLE_SUCCESS, char_info::char_handle, at_ble_characteristic_found_t::char_handle, at_ble_characteristic_found_t::char_uuid, at_ble_characteristic_found_t::conn_handle, DBG_LOG_DEV, DBG_LOG_PTS, char_info::discovery, char_info::properties, at_ble_characteristic_found_t::properties, pas_service_handler::ringer_control_point_char, RINGER_CONTROL_POINT_UUID, pas_service_handler::ringer_setting_char, RINGER_SETTING_UUID, at_ble_uuid_t::type, at_ble_uuid_t::uuid, char_info::value_handle, and at_ble_characteristic_found_t::value_handle.
at_ble_status_t pas_client_descriptor_found_handler | ( | void * | param | ) |
client descriptor found handler invoked by ble manager
[in] | at_ble_descriptor_found_t | invoked when a descriptor is found in peer device |
References pas_service_handler::alert_status_char, pas_service_handler::alert_status_desc, AT_BLE_SUCCESS, AT_BLE_UUID_16, char_info::char_handle, CLIENT_CONF_CHAR_DESCRIPTOR_UUID, DBG_LOG_DEV, DBG_LOG_PTS, desc_info::desc_handle, at_ble_descriptor_found_t::desc_handle, at_ble_descriptor_found_t::desc_uuid, desc_info::discovery, pas_service_handler::ringer_control_point_char, pas_service_handler::ringer_setting_char, pas_service_handler::ringer_setting_desc, at_ble_uuid_t::type, and at_ble_uuid_t::uuid.
at_ble_status_t pas_client_disconnected_event_handler | ( | void * | params | ) |
disconnected event handler invoked by ble manager
[in] | at_ble_disconnected_t | contains the disconnection info |
References ALL_UNUSED, and AT_BLE_SUCCESS.
at_ble_status_t pas_client_discovery_complete_handler | ( | void * | params | ) |
Discovery Complete handler invoked by ble manager.
[in] | at_ble_discovery_complete_t | disconnected handler |
References AT_BLE_ATT_ATTRIBUTE_NOT_FOUND, 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_disconnect(), AT_BLE_SUCCESS, AT_BLE_TERMINATED_BY_USER, pas_service_handler::conn_handle, DBG_LOG, DBG_LOG_DEV, serv_info::discovery, char_info::discovery, serv_info::end_handle, NULL, at_ble_cmd_complete_event_t::operation, pas_client_write_notifications(), pas_service_handler::pas_service_info, pas_service_handler::ringer_control_point_char, serv_info::start_handle, and at_ble_cmd_complete_event_t::status.
at_ble_status_t pas_client_enable_char_notification | ( | bool | char_id, |
bool | enable | ||
) |
invoked by ble manager for setting the notification of characteristics
[in] | char_id | represents the characteristic,1 for alert status,0 for ringer setting |
[in] | enable | weather notifications has to enabled or disabled.1 for enable 0 for disable |
References pas_service_handler::alert_status_desc, pas_service_handler::conn_handle, desc_info::desc_handle, pas_char_write_notification(), and pas_service_handler::ringer_setting_desc.
Referenced by pas_client_write_notifications().
void pas_client_init | ( | void * | params | ) |
invoked by ble manager for initializing the profile
[in] | none |
References AT_BLE_SUCCESS, ble_advertisement_data_set(), BLE_GAP_EVENT_TYPE, BLE_GATT_CLIENT_EVENT_TYPE, ble_mgr_events_callback_handler(), DBG_LOG, pas_data_init(), REGISTER_CALL_BACK, and UNUSED.
Referenced by main().
at_ble_status_t pas_client_notification_handler | ( | void * | params | ) |
invoked by ble manager on receiving notification
[in] | at_ble_notification_recieved_t | notification information containing handle data |
References pas_service_handler::alert_status_char, alert_status_notification_cb, AT_BLE_SUCCESS, at_ble_notification_recieved_t::char_handle, at_ble_notification_recieved_t::char_len, at_ble_notification_recieved_t::char_value, DBG_LOG_DEV, pas_service_handler::ringer_setting_char, ringer_setting_notification_cb, and char_info::value_handle.
at_ble_status_t pas_client_read_alert_status_char | ( | void | ) |
invoked by app to read the alert status characteristic
invoked by ble manager to read the alert status characteristic
References pas_service_handler::alert_status_char, pas_service_handler::conn_handle, pas_read_alert_status_char(), and char_info::value_handle.
Referenced by main().
at_ble_status_t pas_client_read_ringer_setting_char | ( | void | ) |
invoked by app to read the write status characteristic
invoked by ble manager to read the write status characteristic
References pas_service_handler::conn_handle, pas_read_ringer_setting_char(), pas_service_handler::ringer_setting_char, and char_info::value_handle.
Referenced by main().
at_ble_status_t pas_client_service_discovery | ( | void * | params | ) |
to perform the service discovery
[in] | connection | parameters |
References AT_BLE_SUCCESS, pas_service_handler::conn_handle, at_ble_connected_t::conn_status, at_ble_connected_t::handle, and pas_client_start_service_discovery().
at_ble_status_t pas_client_service_found_handler | ( | void * | params | ) |
Service found handler invoked by ble manager.
[in] | at_ble_primary_service_found_t | invoked when a primary service is found in peer device |
References AT_BLE_SUCCESS, AT_BLE_UUID_16, DBG_LOG, DBG_LOG_PTS, serv_info::discovery, serv_info::end_handle, at_ble_primary_service_found_t::end_handle, pas_service_handler::pas_service_info, PAS_SERVICE_UUID, at_ble_primary_service_found_t::service_uuid, serv_info::start_handle, at_ble_primary_service_found_t::start_handle, at_ble_uuid_t::type, and at_ble_uuid_t::uuid.
at_ble_status_t pas_client_start_service_discovery | ( | void | ) |
starts the service discovery
References AT_BLE_FAILURE, at_ble_primary_service_discover_by_uuid(), AT_BLE_SUCCESS, AT_BLE_UUID_16, pas_service_handler::conn_handle, DBG_LOG, DBG_LOG_DEV, GATT_DISCOVERY_ENDING_HANDLE, GATT_DISCOVERY_STARTING_HANDLE, PAS_SERVICE_UUID, at_ble_uuid_t::type, and at_ble_uuid_t::uuid.
Referenced by main(), and pas_client_service_discovery().
at_ble_status_t pas_client_write_notifications | ( | void * | params | ) |
invoked by ble manager for setting the notification
References ALL_UNUSED, AT_BLE_SUCCESS, DBG_LOG, and pas_client_enable_char_notification().
Referenced by pas_client_discovery_complete_handler().
at_ble_status_t pas_client_write_ringer_control_point | ( | uint8_t | ringer | ) |
invoked by app to read the write ringer control point characteristic
invoked by ble manager to read the write ringer control point characteristic
References pas_service_handler::conn_handle, pas_char_set_ringer_control_point(), pas_service_handler::ringer_control_point_char, and char_info::value_handle.
Referenced by main().
void pas_data_init | ( | void | ) |
Referenced by pas_client_init().
void register_alert_status_notification_callback | ( | notification_callback_t | app_notify_cb | ) |
register the call back for notification of alert status
[in] | notification_callback_t | type application callback |
References alert_status_notification_cb.
Referenced by main().
void register_alert_status_read_callback | ( | read_callback_t | app_read_cb | ) |
register the call back for reading alert status
[in] | read_callback_t | type application callback |
References alert_status_read_cb.
Referenced by main().
void register_ringer_setting_notification_callback | ( | notification_callback_t | app_notify_cb | ) |
register the call back for notification of ringer setting
[in] | notification_callback_t | type application callback |
References ringer_setting_notification_cb.
Referenced by main().
void register_ringer_setting_read_callback | ( | read_callback_t | app_read_cb | ) |
register the call back for reading ringer setting
[in] | read_callback_t | type application callback |
References ringer_setting_read_cb.
Referenced by main().
notification_callback_t alert_status_notification_cb |
Referenced by pas_client_notification_handler(), and register_alert_status_notification_callback().
read_callback_t alert_status_read_cb |
Referenced by pas_client_char_read_response_handler(), and register_alert_status_read_callback().
|
static |
|
static |
pas_service_handler_t pas_service_data |
notification_callback_t ringer_setting_notification_cb |
Referenced by pas_client_notification_handler(), and register_ringer_setting_notification_callback().
read_callback_t ringer_setting_read_cb |
Referenced by pas_client_char_read_response_handler(), and register_ringer_setting_read_callback().