bt_disc_retrieve_devices()

Retrieve a list of Bluetooth-enabled devices that are within range.

Synopsis:

#include <btapi/btdevice.h>
 
bt_remote_device_t** bt_disc_retrieve_devices(const int option, int *device_count_ptr)

Since:

BlackBerry 10.0.0

Arguments:

option

Specifies whether to retrieve the paired (BT_DISCOVERY_PREKNOWN), found (BT_DISCOVERY_CACHED), or connected (BT_DISCOVERY_CONNECTED) devices.

device_count_ptr

(Optional) A pointer to an integer to store the number of retrieved devices. If you do not want to use this value, provide a value of NULL.

Library:

libbtapi (For the qcc command, use the -l btapi option to link against this library)

Description:

An array of devices from either the paired or found devices list. The following example shows you how to retrieve a list of devices:
 int device_count;
 if( ( device_count = bt_disc_retrieve_count( BT_DISCOVERY_CACHED ) ) > 0 ) {
   struct bt_remote_device_t **remote_device_array;
   if( ( remote_device_array = bt_disc_retrieve_devices(BT_DISCOVERY_CACHED, &device_count))
                                                                  != NULL ) {
      // do work with the devices
      bt_rdev_free_array( remote_device_arry );
   }
  }

Returns:

An allocated, NULL-terminated array of remote device structures upon success, or NULL with the errno set otherwise. Any errno value other than the following indicates that a system error has occurred:
  • EINVAL: An invalid option was passed in.
  • ENOMEM: There was insufficient memory to allocate required structures.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus