mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-30 06:32:43 +00:00
gap: allow to set Page Timeout with gap_set_page_timeout
This commit is contained in:
parent
9c1f3c5616
commit
32a127304c
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
- HCI: hci_remove_event_handler to remove packet handler
|
||||
- hci_cmd: support variable length fields and arrayed parameters
|
||||
- GAP: ENABLE_EXPLICIT_LINK_KEY_REPLY allows for asynchronous link key lookup by application
|
||||
- GAP: gap_set_page_timeout to set Page Timeout
|
||||
- POSIX: btstack_signal allows to register for callback on signal, e.g. ctrl-c
|
||||
- Windows: btstack_stdin_window_register_ctrl_c_callback allows to register for ctrl-c
|
||||
- A2DP: allow to register media codec validator for sink and source with:
|
||||
|
@ -359,6 +359,12 @@ void gap_set_page_scan_activity(uint16_t page_scan_interval, uint16_t page_scan_
|
||||
*/
|
||||
void gap_set_page_scan_type(page_scan_type_t page_scan_type);
|
||||
|
||||
/**
|
||||
* @brief Set Page Timeout
|
||||
* @param page_timeout * 0.625 ms, range: 0x0001..0xffff, default: 0x6000 (ca 15 seconds)
|
||||
*/
|
||||
void gap_set_page_timeout(uint16_t page_timeout);
|
||||
|
||||
// LE
|
||||
|
||||
/**
|
||||
|
26
src/hci.c
26
src/hci.c
@ -1347,6 +1347,12 @@ static void hci_run_gap_tasks_classic(void){
|
||||
hci_send_cmd(&hci_write_page_scan_type, hci_stack->new_page_scan_type);
|
||||
return;
|
||||
}
|
||||
// write page timeout
|
||||
if ((hci_stack->gap_tasks & GAP_TASK_WRITE_PAGE_TIMEOUT) != 0) {
|
||||
hci_stack->gap_tasks &= ~GAP_TASK_WRITE_PAGE_TIMEOUT;
|
||||
hci_send_cmd(&hci_write_page_timeout, hci_stack->page_timeout);
|
||||
return;
|
||||
}
|
||||
// send scan enable
|
||||
if ((hci_stack->gap_tasks & GAP_TASK_WRITE_SCAN_ENABLE) != 0) {
|
||||
hci_stack->gap_tasks &= ~GAP_TASK_WRITE_SCAN_ENABLE;
|
||||
@ -1654,15 +1660,6 @@ static void hci_initializing_run(void){
|
||||
break;
|
||||
}
|
||||
|
||||
/* fall through */
|
||||
|
||||
case HCI_INIT_WRITE_PAGE_TIMEOUT:
|
||||
if (hci_classic_supported()){
|
||||
hci_stack->substate = HCI_INIT_W4_WRITE_PAGE_TIMEOUT;
|
||||
hci_send_cmd(&hci_write_page_timeout, 0x6000); // ca. 15 sec
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SCO_OVER_HCI
|
||||
/* fall through */
|
||||
|
||||
@ -3452,12 +3449,15 @@ static void hci_state_reset(void){
|
||||
|
||||
#ifdef ENABLE_CLASSIC
|
||||
hci_stack->inquiry_lap = GAP_IAC_GENERAL_INQUIRY;
|
||||
hci_stack->page_timeout = 0x6000; // ca. 15 sec
|
||||
|
||||
hci_stack->gap_tasks =
|
||||
GAP_TASK_SET_DEFAULT_LINK_POLICY |
|
||||
GAP_TASK_SET_CLASS_OF_DEVICE |
|
||||
GAP_TASK_SET_LOCAL_NAME |
|
||||
GAP_TASK_SET_EIR_DATA |
|
||||
GAP_TASK_WRITE_SCAN_ENABLE;
|
||||
GAP_TASK_WRITE_SCAN_ENABLE |
|
||||
GAP_TASK_WRITE_PAGE_TIMEOUT;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_CLASSIC_PAIRING_OOB
|
||||
@ -6846,6 +6846,12 @@ void gap_set_page_scan_type(page_scan_type_t page_scan_type){
|
||||
hci_run();
|
||||
}
|
||||
|
||||
void gap_set_page_timeout(uint16_t page_timeout){
|
||||
hci_stack->page_timeout = page_timeout;
|
||||
hci_stack->gap_tasks |= GAP_TASK_WRITE_PAGE_TIMEOUT;
|
||||
hci_run();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void hci_halting_defer(void){
|
||||
|
10
src/hci.h
10
src/hci.h
@ -720,8 +720,6 @@ typedef enum hci_init_state{
|
||||
HCI_INIT_W4_WRITE_INQUIRY_MODE,
|
||||
HCI_INIT_WRITE_SECURE_CONNECTIONS_HOST_ENABLE,
|
||||
HCI_INIT_W4_WRITE_SECURE_CONNECTIONS_HOST_ENABLE,
|
||||
HCI_INIT_WRITE_PAGE_TIMEOUT,
|
||||
HCI_INIT_W4_WRITE_PAGE_TIMEOUT,
|
||||
|
||||
#ifdef ENABLE_SCO_OVER_HCI
|
||||
// SCO over HCI
|
||||
@ -786,6 +784,7 @@ typedef enum hci_init_state{
|
||||
#define GAP_TASK_WRITE_SCAN_ENABLE 0x10
|
||||
#define GAP_TASK_WRITE_PAGE_SCAN_ACTIVITY 0x20
|
||||
#define GAP_TASK_WRITE_PAGE_SCAN_TYPE 0x40
|
||||
#define GAP_TASK_WRITE_PAGE_TIMEOUT 0x80
|
||||
|
||||
enum {
|
||||
// Tasks
|
||||
@ -878,13 +877,16 @@ typedef struct {
|
||||
/* GAP tasks, see GAP_TASK_* */
|
||||
uint16_t gap_tasks;
|
||||
|
||||
/* write page scan activity, 0xffff is no change */
|
||||
/* write page scan activity */
|
||||
uint16_t new_page_scan_interval;
|
||||
uint16_t new_page_scan_window;
|
||||
|
||||
/* write page scan type, 0xff is no change */
|
||||
/* write page scan type */
|
||||
uint8_t new_page_scan_type;
|
||||
|
||||
/* write page timeout */
|
||||
uint16_t page_timeout;
|
||||
|
||||
// Errata-11838 mandates 7 bytes for GAP Security Level 1-3, we use 16 as default
|
||||
uint8_t gap_required_encyrption_key_size;
|
||||
uint16_t link_supervision_timeout;
|
||||
|
Loading…
x
Reference in New Issue
Block a user