diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1f881b6..77f69f682 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - 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 +- GAP: gap_inquiry_set_scan_activity to set Inquiry Scan Activity - 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: diff --git a/src/gap.h b/src/gap.h index 0a6c0035e..d0f6ccb8e 100644 --- a/src/gap.h +++ b/src/gap.h @@ -749,6 +749,13 @@ int gap_inquiry_stop(void); */ void gap_inquiry_set_lap(uint32_t lap); +/** + * @brief Set Inquiry Scan Activity + * @param inquiry_scan_interval range: 0x0012 to 0x1000; only even values are valid, Time = N * 0.625 ms + * @param inquiry_scan_window range: 0x0011 to 0x1000; Time = N * 0.625 ms + */ +void gap_inquiry_set_activity(uint16_t inquiry_scan_interval, uint16_t inquiry_scan_window); + /** * @brief Remote Name Request * @param addr diff --git a/src/hci.c b/src/hci.c index bb89db308..8d44fed38 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1359,6 +1359,12 @@ static void hci_run_gap_tasks_classic(void){ hci_send_cmd(&hci_write_scan_enable, hci_stack->new_scan_enable_value); return; } + // send write scan activity + if ((hci_stack->gap_tasks & GAP_TASK_WRITE_INQUIRY_SCAN_ACTIVITY) != 0) { + hci_stack->gap_tasks &= ~GAP_TASK_WRITE_INQUIRY_SCAN_ACTIVITY; + hci_send_cmd(&hci_write_inquiry_scan_activity, hci_stack->inquiry_scan_interval, hci_stack->inquiry_scan_window); + return; + } } #endif @@ -6398,6 +6404,13 @@ void gap_inquiry_set_lap(uint32_t lap){ hci_stack->inquiry_lap = lap; } +void gap_inquiry_set_activity(uint16_t inquiry_scan_interval, uint16_t inquiry_scan_window){ + hci_stack->inquiry_scan_interval = inquiry_scan_interval; + hci_stack->inquiry_scan_window = inquiry_scan_window; + hci_stack->gap_tasks |= GAP_TASK_WRITE_INQUIRY_SCAN_ACTIVITY; + hci_run(); +} + /** * @brief Remote Name Request diff --git a/src/hci.h b/src/hci.h index c89d5f2c3..f77e7a6a4 100644 --- a/src/hci.h +++ b/src/hci.h @@ -779,14 +779,15 @@ typedef enum hci_init_state{ } hci_substate_t; -#define GAP_TASK_SET_LOCAL_NAME 0x01 -#define GAP_TASK_SET_EIR_DATA 0x02 -#define GAP_TASK_SET_CLASS_OF_DEVICE 0x04 -#define GAP_TASK_SET_DEFAULT_LINK_POLICY 0x08 -#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 +#define GAP_TASK_SET_LOCAL_NAME 0x01 +#define GAP_TASK_SET_EIR_DATA 0x02 +#define GAP_TASK_SET_CLASS_OF_DEVICE 0x04 +#define GAP_TASK_SET_DEFAULT_LINK_POLICY 0x08 +#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 +#define GAP_TASK_WRITE_INQUIRY_SCAN_ACTIVITY 0x100 enum { // Tasks @@ -897,7 +898,9 @@ typedef struct { gap_security_mode_t gap_security_mode; uint32_t inquiry_lap; // GAP_IAC_GENERAL_INQUIRY or GAP_IAC_LIMITED_INQUIRY - + uint16_t inquiry_scan_interval; + uint16_t inquiry_scan_window; + bool gap_secure_connections_only_mode; #endif