NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
Bluetooth Host

Bluetooth Host. More...

Modules

 Bluetooth Attribute Protocol (ATT)
 Bluetooth Attribute Protocol (ATT)
 
 Eddystone - BLE beacon from Google
 Eddystone - BLE beacon from Google.
 
 Bluetooth Host Generic Access Profile (GAP)
 Bluetooth Host Generic Access Profile (GAP)
 
 Bluetooth Generic Attribute Profile (GATT)
 Bluetooth Generic Attribute Profile (GATT)
 
 Bluetooth Host Error Code
 Bluetooth Host Error Code.
 
 Bluetooth Host Configuration
 Bluetooth Host Configuration.
 
 Bluetooth Host HCI utils
 Bluetooth Host HCI utils.
 
 Bluetooth Host Identity
 Bluetooth Host Identity.
 
 Bluetooth Host chained memory buffer (mbuf)
 Bluetooth Host chained memory buffer (mbuf)
 
 Bluetooth UUID
 Bluetooth UUID.
 

Macros

#define BLE_HS_CONN_HANDLE_NONE   0xffff
 

Functions

int ble_hs_is_enabled (void)
 Indicates whether the host is enabled. The host is enabled if it is starting or fully started. It is disabled if it is stopping or stopped.
 
int ble_hs_synced (void)
 
int ble_hs_start (void)
 
void ble_hs_sched_start (void)
 
void ble_hs_sched_reset (int reason)
 
void ble_hs_evq_set (struct ble_npl_eventq *evq)
 
void ble_hs_init (void)
 
int ble_hs_shutdown (int reason)
 Called when the system is shutting down. Stops the BLE host.
 

Detailed Description

Bluetooth Host.

Macro Definition Documentation

◆ BLE_HS_CONN_HANDLE_NONE

#define BLE_HS_CONN_HANDLE_NONE   0xffff

Connection handle not present

Function Documentation

◆ ble_hs_evq_set()

void ble_hs_evq_set ( struct ble_npl_eventq *  evq)

Designates the specified event queue for NimBLE host work. By default, the host uses the default event queue and runs in the main task. This function is useful if you want the host to run in a different task.

Parameters
evqThe event queue to use for host work.

◆ ble_hs_init()

void ble_hs_init ( void  )

Initializes the NimBLE host. This function must be called before the OS is started. The NimBLE stack requires an application task to function. One application task in particular is designated as the "host parent task". In addition to application-specific work, the host parent task does work for NimBLE by processing events generated by the host.

◆ ble_hs_is_enabled()

int ble_hs_is_enabled ( void  )

Indicates whether the host is enabled. The host is enabled if it is starting or fully started. It is disabled if it is stopping or stopped.

Returns
1 if the host is enabled; 0 if the host is disabled.

◆ ble_hs_sched_reset()

void ble_hs_sched_reset ( int  reason)

Causes the host to reset the NimBLE stack as soon as possible. The application is notified when the reset occurs via the host reset callback.

Parameters
reasonThe host error code that gets passed to the reset callback.

◆ ble_hs_sched_start()

void ble_hs_sched_start ( void  )

Enqueues a host start event to the default event queue. The actual host startup is performed in the host parent task, but using the default queue here ensures the event won't run until the end of main() when this is called during system initialization. This allows the application to configure the host package in the meantime.

If auto-start is disabled, the application should use this function to start the BLE stack. This function can be called at any time as long as the host is stopped. When the host successfully starts, the application is notified via the ble_hs_cfg.sync_cb callback.

◆ ble_hs_shutdown()

int ble_hs_shutdown ( int  reason)

Called when the system is shutting down. Stops the BLE host.

Parameters
reasonThe reason for the shutdown. One of the HAL_RESET_[...] codes or an implementation-defined value.
Returns
SYSDOWN_IN_PROGRESS.

◆ ble_hs_start()

int ble_hs_start ( void  )

Synchronizes the host with the controller by sending a sequence of HCI commands. This function must be called before any other host functionality is used, but it must be called after both the host and controller are initialized. Typically, the host-parent-task calls this function at the top of its task routine. This function must only be called in the host parent task. A safe alternative for starting the stack from any task is to call ble_hs_sched_start().

If the host fails to synchronize with the controller (if the controller is not fully booted, for example), the host will attempt to resynchronize every 100 ms. For this reason, an error return code is not necessarily fatal.

Returns
0 on success; nonzero on error.

◆ ble_hs_synced()

int ble_hs_synced ( void  )

Indicates whether the host has synchronized with the controller. Synchronization must occur before any host procedures can be performed.

Returns
1 if the host and controller are in sync; 0 if the host and controller are out of sync.