Microchip® Advanced Software Framework

pas_client.h File Reference

Phone Alert Status Profile declarations.

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

Data Structures

struct  char_info
 
struct  desc_info
 
struct  pas_service_handler
 
struct  serv_info
 

Macros

#define AD_TYPE_128BIT_UUID_LEN   (16)
 
#define AD_TYPE_16BIT_UUID_LEN   (2)
 ADV type UUID Type & Length. More...
 
#define AD_TYPE_32BIT_UUID_LEN   (4)
 
#define ADV_TYPE_LEN   (0x01)
 
#define ALERT_STATUS_UUID   (0x2a3f)
 characteristic uuids More...
 
#define ANP_MAX_DESCRIPTOR   (2)
 
#define APP_PAS_ADV_TIMEOUT   (655)
 APP_PAS_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out. More...
 
#define APP_PAS_FAST_ADV   (1600)
 Advertisement Interval. More...
 
#define CLIENT_CONF_CHAR_DESCRIPTOR_UUID   (0x2902)
 
#define END_HANDLE   (0xffff)
 
#define FALSE   (0)
 True False. More...
 
#define PAS_ADV_DATA_NAME_DATA   ("ATMEL-PAS")
 
#define PAS_ADV_DATA_NAME_LEN   (9)
 Advertisement Name Type Length & data. More...
 
#define PAS_ADV_DATA_NAME_TYPE   (0x09)
 
#define PAS_ADV_DATA_UUID_LEN   (2)
 The length of 16bit uuid. More...
 
#define PAS_ADV_DATA_UUID_TYPE   (0x3)
 
#define PAS_MAX_CHARACTERISTIC   (3)
 No of Characteristics and No of descriptors. More...
 
#define PAS_SERVICE_UUID   (0x180E)
 
#define RINGER_CONTROL_POINT_UUID   (0x2a40)
 
#define RINGER_SETTING_UUID   (0x2a41)
 
#define SCAN_RESP_LEN   (10)
 Scan Response length. More...
 
#define START_HANDLE   (0x0001)
 start and end handle More...
 
#define TP_ADV_DATA_SERVSOLICITATION_128UUID_TYPE   (0x15)
 
#define TP_ADV_DATA_SERVSOLICITATION_16UUID_TYPE   (0x14)
 TIP Service Solicitation Info. More...
 
#define TRUE   (1)
 
#define UUID_128BIT_LEN   (16)
 
#define UUID_16BIT_LEN   (2)
 UUID Type & Length. More...
 
#define UUID_32BIT_LEN   (4)
 

Typedefs

typedef struct char_info char_info_t
 
typedef struct desc_info desc_info_t
 
typedef void(* notification_callback_t )(uint8_t *, uint8_t)
 
typedef struct pas_service_handler pas_service_handler_t
 
typedef void(* read_callback_t )(uint8_t *, uint8_t)
 
typedef struct serv_info serv_info_t
 

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 ble manager to read the alert status characteristic More...
 
at_ble_status_t pas_client_read_ringer_setting_char (void)
 invoked by ble manager 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 ble manager 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...
 

#define AD_TYPE_128BIT_UUID_LEN   (16)
#define AD_TYPE_16BIT_UUID_LEN   (2)

ADV type UUID Type & Length.

#define AD_TYPE_32BIT_UUID_LEN   (4)
#define ADV_TYPE_LEN   (0x01)
#define ALERT_STATUS_UUID   (0x2a3f)

characteristic uuids

Referenced by pas_client_characteristic_found_handler().

#define ANP_MAX_DESCRIPTOR   (2)
#define APP_PAS_ADV_TIMEOUT   (655)

APP_PAS_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out.

#define APP_PAS_FAST_ADV   (1600)

Advertisement Interval.

Preface

This is the reference manual for the Time Information Profile

Referenced by pas_client_adv().

#define CLIENT_CONF_CHAR_DESCRIPTOR_UUID   (0x2902)
#define END_HANDLE   (0xffff)
#define FALSE   (0)

True False.

#define PAS_ADV_DATA_NAME_DATA   ("ATMEL-PAS")
#define PAS_ADV_DATA_NAME_LEN   (9)

Advertisement Name Type Length & data.

#define PAS_ADV_DATA_NAME_TYPE   (0x09)
#define PAS_ADV_DATA_UUID_LEN   (2)

The length of 16bit uuid.

#define PAS_ADV_DATA_UUID_TYPE   (0x3)
#define PAS_MAX_CHARACTERISTIC   (3)

No of Characteristics and No of descriptors.

#define PAS_SERVICE_UUID   (0x180E)
#define RINGER_CONTROL_POINT_UUID   (0x2a40)
#define RINGER_SETTING_UUID   (0x2a41)
#define SCAN_RESP_LEN   (10)

Scan Response length.

#define START_HANDLE   (0x0001)

start and end handle

#define TP_ADV_DATA_SERVSOLICITATION_128UUID_TYPE   (0x15)
#define TP_ADV_DATA_SERVSOLICITATION_16UUID_TYPE   (0x14)

TIP Service Solicitation Info.

#define TRUE   (1)
#define UUID_128BIT_LEN   (16)

Referenced by ancs_enable().

#define UUID_16BIT_LEN   (2)

UUID Type & Length.

#define UUID_32BIT_LEN   (4)

typedef struct char_info char_info_t
typedef struct desc_info desc_info_t
typedef void(* notification_callback_t)(uint8_t *, uint8_t)
typedef void(* read_callback_t)(uint8_t *, uint8_t)
typedef struct serv_info serv_info_t

void pas_client_adv ( void  )

sets the advertisement data and triggers advertisement

Parameters
[in]none
Returns
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)
at_ble_status_t pas_client_char_write_response_handler ( void *  event_params)
at_ble_status_t pas_client_disconnected_event_handler ( void *  params)

disconnected event handler invoked by ble manager

Parameters
[in]at_ble_disconnected_tcontains the disconnection info

References ALL_UNUSED, and AT_BLE_SUCCESS.

at_ble_status_t pas_client_enable_char_notification ( bool  char_id,
bool  enable 
)

invoked by ble manager for setting the notification of characteristics

Parameters
[in]char_idrepresents the characteristic,0 for alert status,1 for ringer setting
[in]enableweather notifications has to enabled or disabled.1 for enable 0 for disable
Returns
AT_BLE_SUCCESS if success or AT_BLE_FAILURE
Parameters
[in]char_idrepresents the characteristic,1 for alert status,0 for ringer setting
[in]enableweather notifications has to enabled or disabled.1 for enable 0 for disable
Returns
AT_BLE_SUCCESS for success or refer at_ble_err_status_t

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

Parameters
[in]none
Returns
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, status, and UNUSED.

Referenced by main().

at_ble_status_t pas_client_read_alert_status_char ( void  )

invoked by ble manager to read the alert status characteristic

Returns
AT_BLE_SUCCESS if success or AT_BLE_FAILURE

invoked by ble manager to read the alert status characteristic

Returns
AT_BLE_SUCCESS for success or refer at_ble_err_status_t

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 ble manager to read the write status characteristic

Returns
AT_BLE_SUCCESS if success or AT_BLE_FAILURE

invoked by ble manager to read the write status characteristic

Returns
AT_BLE_SUCCESS for success or refer at_ble_err_status_t

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

Parameters
[in]connectionparameters
Returns
AT_BLE_SUCCESS for success and AT_BLE_FAILURE for failure
Precondition
Called after connection by the ble manager

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_start_service_discovery ( void  )
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, pas_client_enable_char_notification(), and status.

Referenced by pas_client_discovery_complete_handler().

at_ble_status_t pas_client_write_ringer_control_point ( uint8_t  ringer)

invoked by ble manager to read the write ringer control point characteristic

Returns
AT_BLE_SUCCESS if success or AT_BLE_FAILURE

invoked by ble manager to read the write ringer control point characteristic

Returns
AT_BLE_SUCCESS for success or refer at_ble_err_status_t

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

Parameters
[in]notification_callback_ttype application callback
Returns
none

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

Parameters
[in]read_callback_ttype application callback
Returns
none

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

Parameters
[in]notification_callback_ttype application callback
Returns
none

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

Parameters
[in]read_callback_ttype application callback
Returns
none

References ringer_setting_read_cb.

Referenced by main().