List all discovered Bluetooth devices
Simple list of Bluetooth devices in range
// PRIVILEGE needed to be set in tizen-manifest.xml:
// http://tizen.org/privilege/bluetooth
#include <bluetooth.h>
#include <dlog.h> // for logging purposes
void
adapter_device_discovery_state_changed_cb(int result,
bt_adapter_device_discovery_state_e discovery_state,
bt_adapter_device_discovery_info_s *discovery_info,
void* user_data) {
if(result == BT_ERROR_NONE) {
if(discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FOUND)
LOGI("Found device name: %s", discovery_info->remote_name);
else if(discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED)
LOGI("Discovery done");
}
}
void
discovery_state_changed() {
int ret;
ret = bt_adapter_set_device_discovery_state_changed_cb(
adapter_device_discovery_state_changed_cb, NULL);
if(ret != BT_ERROR_NONE)
LOGE("Error occurred");
}
void test() {
bt_initialize();
discovery_state_changed();
bt_adapter_start_device_discovery();
}