% !TEX root = btstack_gettingstarted.tex
\section{HCI API}
\label{appendix:api_hci}
$ $
\begin{lstlisting}
le_connection_parameter_range_t gap_le_get_connection_parameter_range();
void gap_le_set_connection_parameter_range(le_connection_parameter_range_t range);

/* LE Client Start */

le_command_status_t le_central_start_scan(void);
le_command_status_t le_central_stop_scan(void);
le_command_status_t le_central_connect(bd_addr_t addr, bd_addr_type_t addr_type);
le_command_status_t le_central_connect_cancel(void);
le_command_status_t gap_disconnect(hci_con_handle_t handle);
void le_central_set_scan_parameters(uint8_t scan_type, uint16_t scan_interval, uint16_t scan_window);

/* LE Client End */
    
void hci_connectable_control(uint8_t enable);
void hci_close(void);

/** 
 * @note New functions replacing: hci_can_send_packet_now[_using_packet_buffer]
 */
int hci_can_send_command_packet_now(void);
    
/**
 * @brief Gets local address.
 */
void hci_local_bd_addr(bd_addr_t address_buffer);

/**
 * @brief Set up HCI. Needs to be called before any other function.
 */
void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, remote_device_db_t const* remote_device_db);

/**
 * @brief Set class of device that will be set during Bluetooth init.
 */
void hci_set_class_of_device(uint32_t class_of_device);

/**
 * @brief Set Public BD ADDR - passed on to Bluetooth chipset if supported in bt_control_h
 */
void hci_set_bd_addr(bd_addr_t addr);

/**
 * @brief Registers a packet handler. Used if L2CAP is not used (rarely). 
 */
void hci_register_packet_handler(void (*handler)(uint8_t packet_type, uint8_t *packet, uint16_t size));

/**
 * @brief Requests the change of BTstack power mode.
 */
int  hci_power_control(HCI_POWER_MODE mode);

/**
 * @brief Allows to control if device is discoverable. OFF by default.
 */
void hci_discoverable_control(uint8_t enable);

/**
 * @brief Creates and sends HCI command packets based on a template and a list of parameters. Will return error if outgoing data buffer is occupied. 
 */
int hci_send_cmd(const hci_cmd_t *cmd, ...);

/**
 * @brief Deletes link key for remote device with baseband address.
 */
void hci_drop_link_key_for_bd_addr(bd_addr_t addr);

/* Configure Secure Simple Pairing */

/**
 * @brief Enable will enable SSP during init.
 */
void hci_ssp_set_enable(int enable);

/**
 * @brief If set, BTstack will respond to io capability request using authentication requirement.
 */
void hci_ssp_set_io_capability(int ssp_io_capability);
void hci_ssp_set_authentication_requirement(int authentication_requirement);

/**
 * @brief If set, BTstack will confirm a numeric comparison and enter '000000' if requested.
 */
void hci_ssp_set_auto_accept(int auto_accept);

/**
 * @brief Get addr type and address used in advertisement packets.
 */
void hci_le_advertisement_address(uint8_t * addr_type, bd_addr_t addr);
\end{lstlisting}
\pagebreak