Microchip® Advanced Software Framework

time_info.h File Reference

Time Information Profile declarations.

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

Macros

#define ADV_TYPE_LEN   (0x01)
 Time Profile type, UUid & Length. More...
 
#define APP_TP_ADV_TIMEOUT   (655)
 APP_TP_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out. More...
 
#define APP_TP_FAST_ADV   (160)
 Advertisement Interval. More...
 
#define AT_BLE_DISCOVER_SUCCESS   (10)
 
#define CT_ADV_DATA_UUID_LEN   (0x02)
 
#define DBG_LOG_PTS   ALL_UNUSED
 
#define NEXT_DST_ADV_DATA_UUID_LEN   (0x02)
 
#define REF_TIM_ADV_DATA_UUID_LEN   (0x02)
 
#define SCAN_RESP_LEN   (10)
 Scan Response length. More...
 
#define TIME_INFO
 
#define TIP_ANDRIOD   1
 
#define TP_ADV_DATA_16BIT_UUID_LEN   (2)
 
#define TP_ADV_DATA_APPEARANCE_DATA   ("\x00\x01")
 
#define TP_ADV_DATA_APPEARANCE_LEN   (2)
 Appearance type & Length. More...
 
#define TP_ADV_DATA_APPEARANCE_TYPE   (0x19)
 
#define TP_ADV_DATA_NAME_DATA   ("ATMEL-TIP")
 
#define TP_ADV_DATA_NAME_LEN   (9)
 Advertisement Name Type Length & data. More...
 
#define TP_ADV_DATA_NAME_TYPE   (0x09)
 
#define TP_ADV_DATA_SERVSOLICITATION_128UUID_TYPE   (0x15)
 
#define TP_ADV_DATA_SERVSOLICITATION_16UUID_TYPE   (0x14)
 TIP Service Solicitation Info. More...
 
#define TP_ADV_DATA_UUID_CTS_DATA   ("\x05\x18")
 
#define TP_ADV_DATA_UUID_LEN   (2)
 
#define TP_ADV_DATA_UUID_TYPE   (0x03)
 Current Time Service UUId for Android. More...
 

Typedefs

typedef void(* bonding_complete_t )(bool flag)
 
typedef void(* read_response_callback_t )(at_ble_characteristic_read_response_t *char_read_resp)
 

Functions

void time_info_adv (void)
 setting time profile advertisement data and triggering of advertisement More...
 
at_ble_status_t time_info_characteristic_found_handler (void *param)
 Handler for characteristic found event. More...
 
at_ble_status_t time_info_characteristic_read_response (void *param)
 Handler for characteristic read. More...
 
at_ble_status_t time_info_connected_state_handler (void *param)
 Handler for connection event. More...
 
at_ble_status_t time_info_descriptor_found_handler (void *param)
 Handler for descriptor found event. More...
 
at_ble_status_t time_info_disconnected_event_handler (void *param)
 Handler for disconnection event. More...
 
at_ble_status_t time_info_discovery_complete_handler (void *param)
 Handler for discovery complete event. More...
 
void time_info_encryption_status_changed_handler (at_ble_encryption_status_changed_t *param)
 Handler for AT_BLE_ENCRYPTION_STATUS_CHANGED event from stack. More...
 
void time_info_init (void)
 Initialize the Time information Profile. More...
 
at_ble_status_t time_info_notification_handler (void *param)
 Handler for notification received found event. More...
 
at_ble_status_t time_info_pair_done_handler (void *param)
 Handler for AT_BLE_PAIR_DONE event from stack. More...
 
void time_info_register_bonding_callback (bonding_complete_t bonding_complete_cb)
 Application registering callback for both paired done event encryption status changed event. More...
 
void time_info_register_read_response_callback (read_response_callback_t read_response_cb)
 Application registering callback for characteristic read response received. More...
 
at_ble_status_t time_info_scan_data_handler (at_ble_scan_info_t *scan_buffer, uint8_t scanned_dev_count)
 Handler for scan info data. More...
 
at_ble_status_t time_info_service_discover (void *param)
 Discovering the services of time server. More...
 
at_ble_status_t time_info_service_discovery (void)
 Discovering the services of time server used by applications. More...
 
at_ble_status_t time_info_service_found_handler (void *param)
 Handler for service found event. More...
 
void time_info_write_notification_handler (uint16_t value)
 Handler for write notification found event. More...
 

#define ADV_TYPE_LEN   (0x01)

Time Profile type, UUid & Length.

#define APP_TP_ADV_TIMEOUT   (655)

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

Referenced by time_info_adv(), and time_info_disconnected_event_handler().

#define APP_TP_FAST_ADV   (160)

Advertisement Interval.

Referenced by time_info_adv(), and time_info_disconnected_event_handler().

#define AT_BLE_DISCOVER_SUCCESS   (10)
#define CT_ADV_DATA_UUID_LEN   (0x02)
#define DBG_LOG_PTS   ALL_UNUSED
#define NEXT_DST_ADV_DATA_UUID_LEN   (0x02)
#define REF_TIM_ADV_DATA_UUID_LEN   (0x02)
#define SCAN_RESP_LEN   (10)

Scan Response length.

#define TIME_INFO
#define TIP_ANDRIOD   1
#define TP_ADV_DATA_16BIT_UUID_LEN   (2)
#define TP_ADV_DATA_APPEARANCE_DATA   ("\x00\x01")
#define TP_ADV_DATA_APPEARANCE_LEN   (2)

Appearance type & Length.

#define TP_ADV_DATA_APPEARANCE_TYPE   (0x19)
#define TP_ADV_DATA_NAME_DATA   ("ATMEL-TIP")
#define TP_ADV_DATA_NAME_LEN   (9)

Advertisement Name Type Length & data.

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

TIP Service Solicitation Info.

#define TP_ADV_DATA_UUID_CTS_DATA   ("\x05\x18")
#define TP_ADV_DATA_UUID_LEN   (2)
#define TP_ADV_DATA_UUID_TYPE   (0x03)

Current Time Service UUId for Android.

typedef void(* bonding_complete_t)(bool flag)
typedef void(* read_response_callback_t)(at_ble_characteristic_read_response_t *char_read_resp)

void time_info_adv ( void  )

setting time profile advertisement data and triggering of advertisement

setting time profile advertisement data and triggering of advertisement

References APP_TP_ADV_TIMEOUT, APP_TP_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, ble_advertisement_data_set(), DBG_LOG, and NULL.

Referenced by time_info_init().

at_ble_status_t time_info_characteristic_read_response ( void *  param)

Handler for characteristic read.

Parameters
[in]readresponse param which gives the status of read and value
Note
Called by the ble_manager after receiving read response event

Handler for characteristic read.

References at_ble_disconnect(), AT_BLE_GAP_TIMEOUT, AT_BLE_SUCCESS, AT_BLE_TERMINATED_BY_USER, at_ble_characteristic_read_response_t::conn_handle, DBG_LOG, read_response_callback, at_ble_characteristic_read_response_t::status, tis_current_time_read_response(), tis_dst_change_read_response(), and tis_rtu_update_read_response().

at_ble_status_t time_info_connected_state_handler ( void *  param)

Handler for connection event.

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

References AT_BLE_FAILURE, AT_BLE_SUCCESS, ble_send_slave_sec_request(), at_ble_connected_t::conn_status, DBG_LOG, DBG_LOG_DEV, and at_ble_connected_t::handle.

at_ble_status_t time_info_descriptor_found_handler ( void *  param)

Handler for descriptor found event.

Parameters
[in]descriptorfound event parameter containing details like characteristic handle,uuid
Note
Called by the ble_manager after receiving characteristic found event

Handler for descriptor found event.

References AT_BLE_SUCCESS, CTS_CLIENT_CHAR_DESCRIPTOR, gatt_cts_handler::curr_desc_handle, DBG_LOG_PTS, Desc_found, at_ble_descriptor_found_t::desc_handle, at_ble_descriptor_found_t::desc_uuid, and at_ble_uuid_t::uuid.

at_ble_status_t time_info_disconnected_event_handler ( void *  param)
void time_info_encryption_status_changed_handler ( at_ble_encryption_status_changed_t param)

Handler for AT_BLE_ENCRYPTION_STATUS_CHANGED event from stack.

Parameters
[in]paramat_ble_encryption_status_changed_t
Returns
None

References bonding_cb, and UNUSED.

at_ble_status_t time_info_notification_handler ( void *  param)

Handler for notification received found event.

Parameters
[in]descriptorfound event parameter containing details like characteristic handle,uuid
Note
Called by the ble_manager after receiving characteristic found event

Handler for notification received found event.

References AT_BLE_SUCCESS, at_ble_characteristic_read_response_t::char_handle, at_ble_notification_recieved_t::char_handle, at_ble_characteristic_read_response_t::char_len, at_ble_notification_recieved_t::char_len, at_ble_characteristic_read_response_t::char_value, at_ble_notification_recieved_t::char_value, tis_current_time_read_response(), tis_dst_change_read_response(), and tis_rtu_update_read_response().

at_ble_status_t time_info_pair_done_handler ( void *  param)

Handler for AT_BLE_PAIR_DONE event from stack.

Parameters
[in]pair_done_paramat_ble_pair_done_t
Returns
at_ble_status_t

References AT_BLE_SUCCESS, bonding_cb, and UNUSED.

void time_info_register_bonding_callback ( bonding_complete_t  bonding_complete_cb)

Application registering callback for both paired done event encryption status changed event.

Parameters
[in]read_response_cbcallback of application read_response_callback_t
Returns
None

References bonding_cb.

void time_info_register_read_response_callback ( read_response_callback_t  read_response_cb)

Application registering callback for characteristic read response received.

Parameters
[in]read_response_cbcallback of application read_response_callback_t
Returns
None

References read_response_callback.

at_ble_status_t time_info_scan_data_handler ( at_ble_scan_info_t scan_buffer,
uint8_t  scanned_dev_count 
)

Handler for scan info data.

Parameters
[in]scaninfo data data buffer containing scan data of all the scanned device
[in]Devicecount
at_ble_status_t time_info_service_discover ( void *  param)

Discovering the services of time server.

Parameters
[in]connectionparameter which includes the connection handle device address

References AT_BLE_SUCCESS, at_ble_connected_t::conn_status, at_ble_connected_t::handle, time_info_conn_handle, and time_info_service_discovery().

at_ble_status_t time_info_service_discovery ( void  )
void time_info_write_notification_handler ( uint16_t  value)

Handler for write notification found event.

Parameters
[in]valueto be set

Handler for write notification found event.

References AT_BLE_SUCCESS, gatt_cts_handler::curr_desc_handle, DBG_LOG, Desc_found, and tis_current_time_noti().

Referenced by tip_app_custom_event().