gap: support configuring inquiry transmit power level

This commit is contained in:
Andrey Fominykh 2023-08-08 18:22:02 +03:00 committed by Matthias Ringwald
parent c9c0cbe99a
commit f50ed5accd
3 changed files with 30 additions and 9 deletions

View File

@ -1205,6 +1205,12 @@ void gap_inquiry_set_lap(uint32_t lap);
*/
void gap_inquiry_set_scan_activity(uint16_t inquiry_scan_interval, uint16_t inquiry_scan_window);
/**
* @brief Set Inquiry Transmit Power Level
* @param tx_power range: -70 to 20 dBm
*/
void gap_inquiry_set_transmit_power_level(int8_t tx_power);
/**
* @brief Remote Name Request
* @param addr

View File

@ -1730,6 +1730,12 @@ static void hci_run_gap_tasks_classic(void){
hci_send_cmd(&hci_write_inquiry_scan_activity, hci_stack->inquiry_scan_interval, hci_stack->inquiry_scan_window);
return;
}
// send write inquiry transmit power level
if ((hci_stack->gap_tasks_classic & GAP_TASK_WRITE_INQUIRY_TX_POWER_LEVEL) != 0) {
hci_stack->gap_tasks_classic &= ~GAP_TASK_WRITE_INQUIRY_TX_POWER_LEVEL;
hci_send_cmd(&hci_write_inquiry_transmit_power_level, hci_stack->inquiry_tx_power_level);
return;
}
}
#endif
@ -8919,6 +8925,13 @@ void gap_inquiry_set_scan_activity(uint16_t inquiry_scan_interval, uint16_t inqu
hci_run();
}
void gap_inquiry_set_transmit_power_level(int8_t tx_power)
{
hci_stack->inquiry_tx_power_level = tx_power;
hci_stack->gap_tasks_classic |= GAP_TASK_WRITE_INQUIRY_TX_POWER_LEVEL;
hci_run();
}
/**
* @brief Remote Name Request

View File

@ -896,15 +896,16 @@ 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_WRITE_INQUIRY_SCAN_ACTIVITY 0x100
#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
#define GAP_TASK_WRITE_INQUIRY_TX_POWER_LEVEL 0x200
enum {
// Tasks
@ -1072,6 +1073,7 @@ typedef struct {
uint32_t inquiry_lap; // GAP_IAC_GENERAL_INQUIRY or GAP_IAC_LIMITED_INQUIRY
uint16_t inquiry_scan_interval;
uint16_t inquiry_scan_window;
int8_t inquiry_tx_power_level;
bool gap_secure_connections_only_mode;
#endif