Bluetooth Low Energy (BLE)

BLE functions. More...

Data Structures

struct  zos_ble_address_t
 BLE address. More...
 
struct  zos_ble_scan_parameters_t
 BLE scan parameters. More...
 
struct  zos_ble_scan_result_t
 BLE scan result. More...
 
struct  zos_ble_adv_data_t
 BLE advertisement data. More...
 
struct  zos_ble_connection_parameters_t
 BLE connection parameters. More...
 
struct  zos_ble_connection_callbacks_t
 BLE connection callbacks. More...
 

Typedefs

typedef void(* zos_ble_scan_result_handler_t) (const zos_ble_scan_result_t *result)
 BLE scan result callback.
 
typedef uint32_t zos_ble_connection_t
 BLE connection handle.
 

Enumerations

enum  zos_ble_scan_duplicate_filter_t {
  ZOS_BLE_SCAN_DUPLICATE_FILTER_DISABLED,
  ZOS_BLE_SCAN_DUPLICATE_FILTER_ENABLED
}
 BLE scan duplicate filter. More...
 
enum  zos_ble_scan_type_t {
  ZOS_BLE_SCAN_PASSIVE,
  ZOS_BLE_SCAN_ACTIVE
}
 BLE scan type. More...
 
enum  zos_ble_own_address_type_t {
  ZOS_BLE_OWN_ADDRESS_PUBLIC = 0,
  ZOS_BLE_OWN_ADDRESS_RANDOM = ( ( 0x01 ) ),
  ZOS_BLE_OWN_ADDRESS_RPA_OR_PUBLIC = ( ( 0x02 ) ),
  ZOS_BLE_OWN_ADDRESS_RPA_OR_RANDOM = ( ( 0x02 ) | ( 0x01 ) )
}
 BLE own address type. More...
 
enum  zos_ble_scan_filter_t {
  ZOS_BLE_SCAN_FILTER_NONE,
  ZOS_BLE_SCAN_FILTER_WHITELIST
}
 BLE scan filter. More...
 
enum  zos_ble_scan_extended_filter_t {
  ZOS_BLE_SCAN_IGNORE_DIRECTED_ADV_WITH_RPA,
  ZOS_BLE_SCAN_PROCESS_DIRECTED_ADV_WITH_RPA
}
 BLE extended scan filter. More...
 
enum  zos_ble_adv_type_t {
  ZOS_BLE_ADV_IND,
  ZOS_BLE_ADV_DIRECT_IND,
  ZOS_BLE_ADV_SCAN_IND,
  ZOS_BLE_ADV_NONCONN_IND,
  ZOS_BLE_ADV_SCAN_RSP
}
 BLE advertisement type. More...
 
enum  zos_ble_address_type_t {
  ZOS_BLE_ADDRESS_PUBLIC,
  ZOS_BLE_ADDRESS_STATIC_RANDOM,
  ZOS_BLE_ADDRESS_PRIVATE_RESOLVABLE,
  ZOS_BLE_ADDRESS_PRIVATE_NONRESOLVEABLE
}
 BLE address type. More...
 
enum  zos_ble_connection_state_t {
  ZOS_BLE_CONNECTION_DISCONNECTED,
  ZOS_BLE_CONNECTION_CONNECT_SCAN,
  ZOS_BLE_CONNECTION_CONNECTING,
  ZOS_BLE_CONNECTION_CONNECTED,
  ZOS_BLE_CONNECTION_DISCONNECTING
}
 BLE connection state. More...
 

Functions

zos_result_t zn_ble_start_scan (zos_ble_scan_duplicate_filter_t filter, zos_ble_scan_result_handler_t handler)
 Start Bluetooth Low Energy (BLE) scan. More...
 
zos_result_t zn_ble_stop_scan (void)
 Stop BLE scan. More...
 
zos_result_t zn_ble_register_connection_callbacks (const zos_ble_connection_callbacks_t *callbacks)
 Register BLE connection callbacks. More...
 
zos_result_t zn_ble_connect (const zos_ble_address_t *peer_address, zos_ble_connection_t *connection, void *arg)
 Connect to a peer BLE device. More...
 
zos_result_t zn_ble_disconnect (zos_ble_connection_t connection)
 Disconnect a BLE connection. More...
 
zos_ble_connection_state_t zn_ble_get_connection_status (zos_ble_connection_t connection)
 Retrieve BLE connection status. More...
 

Detailed Description

BLE functions.

Enumeration Type Documentation

BLE address type.

Enumerator
ZOS_BLE_ADDRESS_PUBLIC 

Public address.

ZOS_BLE_ADDRESS_STATIC_RANDOM 

Static random address.

ZOS_BLE_ADDRESS_PRIVATE_RESOLVABLE 

Resolvable private address (RPA)

ZOS_BLE_ADDRESS_PRIVATE_NONRESOLVEABLE 

Non-resolvable private address.

BLE advertisement type.

Enumerator
ZOS_BLE_ADV_IND 

Undirected advertisement.

ZOS_BLE_ADV_DIRECT_IND 

Directed advertisement.

ZOS_BLE_ADV_SCAN_IND 

Scannable undirected advertisement.

ZOS_BLE_ADV_NONCONN_IND 

Non-connectable undirected advertisement.

ZOS_BLE_ADV_SCAN_RSP 

Scan response.

BLE connection state.

Enumerator
ZOS_BLE_CONNECTION_DISCONNECTED 

Disconnected.

ZOS_BLE_CONNECTION_CONNECT_SCAN 

Connection initiated. Device listens for advertisement from targeted peer device.

ZOS_BLE_CONNECTION_CONNECTING 

Connection created, but not yet established.

ZOS_BLE_CONNECTION_CONNECTED 

Connection established.

ZOS_BLE_CONNECTION_DISCONNECTING 

Non-resolvable private address.

BLE own address type.

Enumerator
ZOS_BLE_OWN_ADDRESS_PUBLIC 

Public address.

ZOS_BLE_OWN_ADDRESS_RANDOM 

Random address.

ZOS_BLE_OWN_ADDRESS_RPA_OR_PUBLIC 

Resolvable Private Address (RPA) or public.

ZOS_BLE_OWN_ADDRESS_RPA_OR_RANDOM 

Resolvable Private Address (RPA) or random.

BLE scan duplicate filter.

Enumerator
ZOS_BLE_SCAN_DUPLICATE_FILTER_DISABLED 

Scan result is generated every time an advertising packet is received.

ZOS_BLE_SCAN_DUPLICATE_FILTER_ENABLED 

Duplicate advertising reports are filtered out.

BLE extended scan filter.

Enumerator
ZOS_BLE_SCAN_IGNORE_DIRECTED_ADV_WITH_RPA 

Ignore directed advertisements with Resolvable Private Address (RPA)

ZOS_BLE_SCAN_PROCESS_DIRECTED_ADV_WITH_RPA 

Process directed advertisements with RPA.

BLE scan filter.

Enumerator
ZOS_BLE_SCAN_FILTER_NONE 

No scan filter.

ZOS_BLE_SCAN_FILTER_WHITELIST 

Whitelist filter.

BLE scan type.

Enumerator
ZOS_BLE_SCAN_PASSIVE 

Passive scan. Scanning device only listens for advertising packets.

ZOS_BLE_SCAN_ACTIVE 

Active scan. Scanning device sends requests for additional scan responses.

Function Documentation

zos_result_t zn_ble_connect ( const zos_ble_address_t peer_address,
zos_ble_connection_t connection,
void *  arg 
)

Connect to a peer BLE device.

Parameters
[in]peer_addressAddress of the BLE device to connect
[out]connectionConnection handle
[in]argArgument that will be passed to connection callbacks
Returns
zos_result_t result of api call
zos_result_t zn_ble_disconnect ( zos_ble_connection_t  connection)

Disconnect a BLE connection.

Parameters
[in]connectionConnection handle
Returns
zos_result_t result of api call
zos_ble_connection_state_t zn_ble_get_connection_status ( zos_ble_connection_t  connection)

Retrieve BLE connection status.

Parameters
[in]connectionConnection handle
Returns
zos_result_t result of api call
zos_result_t zn_ble_register_connection_callbacks ( const zos_ble_connection_callbacks_t callbacks)

Register BLE connection callbacks.

Parameters
[in]callbacksPointer to connection callback object.
Returns
zos_result_t result of api call
zos_result_t zn_ble_start_scan ( zos_ble_scan_duplicate_filter_t  filter,
zos_ble_scan_result_handler_t  handler 
)

Start Bluetooth Low Energy (BLE) scan.

Parameters
[in]filterDuplicate filter
[in]handlerScan result callback handler
Returns
zos_result_t result of api call
Examples:
cloud/ble2bluemix/scan.c.
zos_result_t zn_ble_stop_scan ( void  )

Stop BLE scan.

Returns
zos_result_t result of api call
Examples:
cloud/ble2bluemix/scan.c.