int att_server_indicate(uint16_t handle, uint8_t *value, uint16_t value_len){ if (att_handle_value_indication_handle) return ATT_HANDLE_VALUE_INDICATION_IN_PORGRESS; if (!l2cap_can_send_fixed_channel_packet_now(att_connection.con_handle)) return BTSTACK_ACL_BUFFERS_FULL; // track indication att_handle_value_indication_handle = handle; run_loop_set_timer_handler(&att_handle_value_indication_timer, att_handle_value_indication_timeout); run_loop_set_timer(&att_handle_value_indication_timer, ATT_TRANSACTION_TIMEOUT_MS); run_loop_add_timer(&att_handle_value_indication_timer); l2cap_reserve_packet_buffer(); uint8_t * packet_buffer = l2cap_get_outgoing_buffer(); uint16_t size = att_prepare_handle_value_indication(&att_connection, handle, value, value_len, packet_buffer); l2cap_send_prepared_connectionless(att_connection.con_handle, L2CAP_CID_ATTRIBUTE_PROTOCOL, size); return 0; }
static void hsp_ringing_timer_start(void){ run_loop_remove_timer(&hs_timeout); run_loop_set_timer_handler(&hs_timeout, hsp_ringing_timeout_handler); run_loop_set_timer(&hs_timeout, 2000); // 2 seconds timeout run_loop_add_timer(&hs_timeout); }