SmartSnippets DA1459x SDK
Files | Data Structures | Typedefs | Enumerations | Functions

BLE Manager API. More...

Files

file  ble_mgr.h
 BLE Manager API.
 

Data Structures

struct  ble_dev_params_tag
 
struct  ble_mgr_interface_t
 

Typedefs

typedef struct ble_dev_params_tag ble_dev_params_t
 
typedef enum ble_stack_msg_types ble_stack_msg_type_t
 

Enumerations

enum  ble_stack_msg_types
 

Functions

void ble_mgr_init (void)
 Initialize BLE Manager - create command and event queues. More...
 
OS_BASE_TYPE ble_mgr_command_queue_send (const void *item, OS_TICK_TIME wait_ticks)
 Send a message to the BLE Manager's command queue. More...
 
OS_BASE_TYPE ble_mgr_event_queue_send (const void *item, OS_TICK_TIME wait_ticks)
 Send a message to the BLE Manager's event queue. More...
 
void ble_mgr_event_queue_flush (void)
 Flush BLE Manager's event queue. More...
 
OS_BASE_TYPE ble_mgr_event_queue_get (void *item, OS_TICK_TIME wait_ticks)
 Get message from BLE Manager's event queue. More...
 
OS_BASE_TYPE ble_mgr_event_queue_peek (void *item, OS_TICK_TIME wait_ticks)
 Peek message from BLE Manager's event queue. More...
 
OS_BASE_TYPE ble_mgr_command_queue_send_from_isr (const void *item)
 Send a message to the BLE Manager's command queue from an ISR. More...
 
const ble_mgr_interface_tble_mgr_get_interface (void)
 Get BLE Manager interface structure. More...
 
void ble_mgr_register_application (OS_TASK task)
 Register application in BLE Manager. More...
 
OS_BASE_TYPE ble_mgr_response_queue_send (const void *item, OS_TICK_TIME wait_ticks)
 Send message to BLE Manager's response queue. More...
 
OS_BASE_TYPE ble_mgr_response_queue_get (void *item, OS_TICK_TIME wait_ticks)
 Get message from BLE Manager's response queue. More...
 
void ble_mgr_notify_app_task (uint32_t notif_value)
 Send a task notification to the application task registered to the BLE Manager. More...
 
ble_dev_params_tble_mgr_dev_params_acquire (void)
 Get a pointer to the BLE device parameters structure. More...
 
void ble_mgr_dev_params_release (void)
 Release the BLE device parameters. More...
 
void ble_mgr_acquire (void)
 Acquire the BLE manager interface. More...
 
void ble_mgr_release (void)
 Release the BLE manager interface. More...
 
void ble_mgr_waitqueue_acquire (void)
 Acquire the BLE manager waitqueue. More...
 
void ble_mgr_waitqueue_release (void)
 Release the BLE manager waitqueue. More...
 
bool ble_mgr_is_own_task (void)
 Checks if current task is BLE Manager task. More...
 
void ble_mgr_dev_params_set_default (void)
 Set default dev_params. More...
 
void ble_mgr_notify_commit_storage (void)
 Notifies BLE manager to commit storage changes, if any. More...
 
void ble_mgr_notify_adapter_blocked (bool status)
 Notifies BLE manager that BLE adapter is blocked or unblocked on its event queue. More...
 
void ble_mgr_notify_event_consumed (void)
 Notifies BLE manager that posted event was consumed. More...
 
bool ble_mgr_adapter_is_blocked (void)
 Returns current adapter status (blocked or not) More...
 
ble_status_t ble_mgr_get_status (void)
 Get the status of BLE. More...
 
void ble_mgr_set_status (ble_status_t status)
 Set BLE status. More...
 

Detailed Description

BLE Manager API.

Typedef Documentation

◆ ble_dev_params_t

BLE device parameters

◆ ble_stack_msg_type_t

Types of stack API messages

Enumeration Type Documentation

◆ ble_stack_msg_types

Types of stack API messages

Function Documentation

◆ ble_mgr_acquire()

void ble_mgr_acquire ( void  )

Acquire the BLE manager interface.

Acquires a mutex that guards the BLE manager interface (command and response queues) so that only one task can use the BLE API at a given moment.

◆ ble_mgr_adapter_is_blocked()

bool ble_mgr_adapter_is_blocked ( void  )

Returns current adapter status (blocked or not)

Returns
true if adapter is blocked, false otherwise

◆ ble_mgr_command_queue_send()

OS_BASE_TYPE ble_mgr_command_queue_send ( const void *  item,
OS_TICK_TIME  wait_ticks 
)

Send a message to the BLE Manager's command queue.

Sends a message to the BLE Manager's command queue and notifies BLE Manager task

Parameters
[in]itemPointer to the item to be sent to the queue.
[in]wait_ticksMax time in ticks to wait for space in queue.
Returns
OS_OK if the message was successfully sent to the queue, OS_FAIL otherwise.

◆ ble_mgr_command_queue_send_from_isr()

OS_BASE_TYPE ble_mgr_command_queue_send_from_isr ( const void *  item)

Send a message to the BLE Manager's command queue from an ISR.

Sends a message to the BLE Manager's command queue

Parameters
[in]itemPointer to the item to be sent to the queue.
Returns
OS_OK if the message was successfully sent to the queue, OS_FAIL otherwise.

◆ ble_mgr_dev_params_acquire()

ble_dev_params_t* ble_mgr_dev_params_acquire ( void  )

Get a pointer to the BLE device parameters structure.

Returns
Pointer to ble_dev_params

◆ ble_mgr_dev_params_release()

void ble_mgr_dev_params_release ( void  )

Release the BLE device parameters.

Releases the structure that holds the BLE device parameters, previously acquired using ble_mgr_dev_params_acquire().

◆ ble_mgr_dev_params_set_default()

void ble_mgr_dev_params_set_default ( void  )

Set default dev_params.

Function set default dev_params

◆ ble_mgr_event_queue_flush()

void ble_mgr_event_queue_flush ( void  )

Flush BLE Manager's event queue.

Remove all events currently on BLE Manager's event queue and free corresponding event buffers.

◆ ble_mgr_event_queue_get()

OS_BASE_TYPE ble_mgr_event_queue_get ( void *  item,
OS_TICK_TIME  wait_ticks 
)

Get message from BLE Manager's event queue.

Parameters
[out]itemEvent buffer to receive data
[in]wait_tickstime to wait
Returns
OS_OK if the message was successfully received from the queue, OS_FAIL otherwise.

◆ ble_mgr_event_queue_peek()

OS_BASE_TYPE ble_mgr_event_queue_peek ( void *  item,
OS_TICK_TIME  wait_ticks 
)

Peek message from BLE Manager's event queue.

Message is not removed from queue, it will be returned by subsequent call to ble_mgr_event_queue_get().

Parameters
[out]itemEvent buffer to receive data
[in]wait_tickstime to wait
Returns
OS_OK if the message was successfully received from the queue, OS_FAIL otherwise.

◆ ble_mgr_event_queue_send()

OS_BASE_TYPE ble_mgr_event_queue_send ( const void *  item,
OS_TICK_TIME  wait_ticks 
)

Send a message to the BLE Manager's event queue.

Sends a message to the BLE Manager's event queue and notifies application task, if any registered.

Parameters
[in]itemPointer to the item to be sent to the queue.
[in]wait_ticksMax time in ticks to wait for space in queue.
Returns
OS_OK if the message was successfully sent to the queue, OS_FAIL otherwise.

◆ ble_mgr_get_interface()

const ble_mgr_interface_t* ble_mgr_get_interface ( void  )

Get BLE Manager interface structure.

Returns
pointer to interface structure

◆ ble_mgr_get_status()

ble_status_t ble_mgr_get_status ( void  )

Get the status of BLE.

This function returns the status of BLE.

Returns
BLE_IS_DISABLED if BLE has not been enabled yet, BLE_IS_ENABLED if BLE is up and running, BLE_IS_BUSY if BLE is currently busy and cannot accept requests, or BLE_IS_RESET if a BLE reset is currently in progress.
See also
ble_status_t

◆ ble_mgr_init()

void ble_mgr_init ( void  )

Initialize BLE Manager - create command and event queues.

Function declarations

◆ ble_mgr_is_own_task()

bool ble_mgr_is_own_task ( void  )

Checks if current task is BLE Manager task.

Returns
true if currect task is BLE Manager task, false otherwise

◆ ble_mgr_notify_adapter_blocked()

void ble_mgr_notify_adapter_blocked ( bool  status)

Notifies BLE manager that BLE adapter is blocked or unblocked on its event queue.

BLE adapter uses this function to indicate it has blocked on a full event queue (if status is true) or that it has just been unblocked (if status is false).

Parameters
[in]statustrue to indicate the adapter has just blocked, false to indicate the adapter just unblocked.

◆ ble_mgr_notify_app_task()

void ble_mgr_notify_app_task ( uint32_t  notif_value)

Send a task notification to the application task registered to the BLE Manager.

Parameters
[in]notif_valueThe notification value (as a 32-bit bitfield)

◆ ble_mgr_notify_commit_storage()

void ble_mgr_notify_commit_storage ( void  )

Notifies BLE manager to commit storage changes, if any.

◆ ble_mgr_notify_event_consumed()

void ble_mgr_notify_event_consumed ( void  )

Notifies BLE manager that posted event was consumed.

◆ ble_mgr_register_application()

void ble_mgr_register_application ( OS_TASK  task)

Register application in BLE Manager.

This can be called only once as there can be only single application registered right now.

Parameters
[in]tasktask handle of application to register

◆ ble_mgr_release()

void ble_mgr_release ( void  )

Release the BLE manager interface.

Releases the mutex acquired using ble_mgr_acquire().

◆ ble_mgr_response_queue_get()

OS_BASE_TYPE ble_mgr_response_queue_get ( void *  item,
OS_TICK_TIME  wait_ticks 
)

Get message from BLE Manager's response queue.

Parameters
[out]itemMessage buffer to receive data
[in]wait_tickstime to wait
Returns
OS_OK if the message was successfully received from the queue, OS_FAIL otherwise.

◆ ble_mgr_response_queue_send()

OS_BASE_TYPE ble_mgr_response_queue_send ( const void *  item,
OS_TICK_TIME  wait_ticks 
)

Send message to BLE Manager's response queue.

Parameters
[in]itemMessage to send to queue
[in]wait_tickstime to wait
Returns
OS_OK if the message was successfully sent to the queue, OS_FAIL otherwise.

◆ ble_mgr_set_status()

void ble_mgr_set_status ( ble_status_t  status)

Set BLE status.

Set BLE in a specific status.

Parameters
[in]statusThe status to be set

◆ ble_mgr_waitqueue_acquire()

void ble_mgr_waitqueue_acquire ( void  )

Acquire the BLE manager waitqueue.

Acquires the mutex that guards the BLE manager waitqueue so that only one task can modify it at a given moment.

◆ ble_mgr_waitqueue_release()

void ble_mgr_waitqueue_release ( void  )

Release the BLE manager waitqueue.

Releases the mutex acquired using ble_mgr_waitqueue_acquire().