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) |
Referenced by time_info_discovery_complete_handler(), and tip_discovery_complete_cb().
#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(* 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_found_handler | ( | void * | param | ) |
Handler for characteristic found event.
[in] | characteristic | found event parameter containing details like characteristic handle,uuid |
Handler for characteristic found event.
References AT_BLE_SUCCESS, at_ble_characteristic_found_t::char_handle, at_ble_characteristic_found_t::char_uuid, gatt_cts_handler::curr_char_handle, current_time_char_found, CURRENT_TIME_CHAR_UUID, DBG_LOG_PTS, gatt_cts_handler::desc_discovery, gatt_dst_handler::dst_char_handle, local_time_char_found, LOCAL_TIME_CHAR_UUID, gatt_cts_handler::lti_char_handle, at_ble_characteristic_found_t::properties, ref_time_char_found, REF_TIME_CHAR_UUID, gatt_cts_handler::rti_char_handle, time_update_cp_char_found, TIME_UPDATE_CP_CHAR_UUID, time_update_state_char_found, TIME_UPDATE_STATE_CHAR_UUID, time_with_dst_char_found, TIME_WITH_DST_CHAR_UUID, gatt_rtu_handler::tp_control_char_handle, gatt_rtu_handler::tp_state_char_handle, at_ble_uuid_t::uuid, and at_ble_characteristic_found_t::value_handle.
at_ble_status_t time_info_characteristic_read_response | ( | void * | param | ) |
Handler for characteristic read.
[in] | read | response param which gives the status of read and value |
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.
[in] | connected | event parameter containing details like handle |
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.
[in] | descriptor | found event parameter containing details like characteristic handle,uuid |
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 | ) |
Handler for disconnection event.
[in] | disconnected | event parameter containing details like handle |
Handler for disconnection event.
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_INVALID_PARAM, AT_BLE_SUCCESS, gatt_dst_handler::char_discovery, gatt_rtu_handler::char_discovery, gatt_cts_handler::char_discovery, current_time_char_found, DBG_LOG, gatt_cts_handler::desc_discovery, Desc_found, local_time_char_found, NULL, ref_time_char_found, time_update_cp_char_found, time_update_state_char_found, time_with_dst_char_found, and UNUSED.
at_ble_status_t time_info_discovery_complete_handler | ( | void * | param | ) |
Handler for discovery complete event.
[in] | discovery | complete event which contains result of discovery event |
Handler for discovery complete event.
References at_ble_characteristic_discover_all(), at_ble_descriptor_discover_all(), at_ble_disconnect(), AT_BLE_DISCOVER_SUCCESS, AT_BLE_FAILURE, AT_BLE_INVALID_PARAM, AT_BLE_INVALID_STATE, AT_BLE_SUCCESS, AT_BLE_TERMINATED_BY_USER, gatt_dst_handler::char_discovery, gatt_rtu_handler::char_discovery, gatt_cts_handler::char_discovery, at_ble_cmd_complete_event_t::conn_handle, DBG_LOG, DBG_LOG_DEV, gatt_cts_handler::desc_discovery, gatt_dst_handler::end_handle, gatt_rtu_handler::end_handle, gatt_cts_handler::end_handle, gatt_dst_handler::start_handle, gatt_rtu_handler::start_handle, gatt_cts_handler::start_handle, and at_ble_cmd_complete_event_t::status.
void time_info_encryption_status_changed_handler | ( | at_ble_encryption_status_changed_t * | param | ) |
Handler for AT_BLE_ENCRYPTION_STATUS_CHANGED event from stack.
[in] | param | at_ble_encryption_status_changed_t |
References bonding_cb, and UNUSED.
void time_info_init | ( | void | ) |
Initialize the Time information Profile.
Initialize the Time information Profile.
References BLE_GAP_EVENT_TYPE, BLE_GATT_CLIENT_EVENT_TYPE, ble_mgr_events_callback_handler(), curr_char_data, gatt_cts_handler::curr_char_data, gatt_dst_handler::dst_char_data, dst_char_data, lti_char_data, gatt_cts_handler::lti_char_data, REGISTER_CALL_BACK, rti_char_data, gatt_cts_handler::rti_char_data, time_info_adv(), gatt_rtu_handler::tp_control_char_data, tp_control_char_data, gatt_rtu_handler::tp_state_char_data, and tp_state_char_data.
Referenced by main().
at_ble_status_t time_info_notification_handler | ( | void * | param | ) |
Handler for notification received found event.
[in] | descriptor | found event parameter containing details like characteristic handle,uuid |
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.
[in] | pair_done_param | at_ble_pair_done_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.
[in] | read_response_cb | callback of application read_response_callback_t |
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.
[in] | read_response_cb | callback of application read_response_callback_t |
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.
[in] | scan | info data data buffer containing scan data of all the scanned device |
[in] | Device | count |
at_ble_status_t time_info_service_discover | ( | void * | param | ) |
Discovering the services of time server.
[in] | connection | parameter 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 | ) |
Discovering the services of time server used by applications.
References AT_BLE_FAILURE, at_ble_primary_service_discover_all(), AT_BLE_SUCCESS, DBG_LOG, DBG_LOG_DEV, GATT_DISCOVERY_ENDING_HANDLE, GATT_DISCOVERY_STARTING_HANDLE, and time_info_conn_handle.
Referenced by time_info_service_discover(), and tip_app_custom_event().
at_ble_status_t time_info_service_found_handler | ( | void * | param | ) |
Handler for service found event.
[in] | service | found event parameter containing details like service handle,uuid |
Handler for service found event.
References AT_BLE_SUCCESS, AT_BLE_UUID_16, gatt_dst_handler::char_discovery, gatt_rtu_handler::char_discovery, gatt_cts_handler::char_discovery, CURRENT_TIME_SERVICE_UUID, DBG_LOG_PTS, gatt_dst_handler::end_handle, gatt_rtu_handler::end_handle, gatt_cts_handler::end_handle, at_ble_primary_service_found_t::end_handle, NEXT_DST_SERVICE_UUID, REFERENCE_TIME_SERVICE_UUID, at_ble_primary_service_found_t::service_uuid, gatt_dst_handler::start_handle, gatt_rtu_handler::start_handle, gatt_cts_handler::start_handle, at_ble_primary_service_found_t::start_handle, at_ble_uuid_t::type, and at_ble_uuid_t::uuid.
void time_info_write_notification_handler | ( | uint16_t | value | ) |
Handler for write notification found event.
[in] | value | to 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().