本文整理汇总了C++中DataContainer::setDeviceCount方法的典型用法代码示例。如果您正苦于以下问题:C++ DataContainer::setDeviceCount方法的具体用法?C++ DataContainer::setDeviceCount怎么用?C++ DataContainer::setDeviceCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContainer
的用法示例。
在下文中一共展示了DataContainer::setDeviceCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findBleDevices
void DevicesManager::findBleDevices()
{
emit startedScanningForDevices();
bb::system::SystemToast toast;
toast.setBody("Searching for Bluetooth LE devices ... please wait until search has completed ...");
toast.setPosition(bb::system::SystemUiPosition::MiddleCenter);
toast.show();
if (!bt_initialised) {
// Initialise the Bluetooth device and allocate the required resources for the library. Specify a call back function for Bluetooth events.
bt_device_init(btEvent);
// make sure the Bluetooth radio is switched on
if (!bt_ldev_get_power()) {
bt_ldev_set_power(true);
}
bt_initialised = true;
}
DataContainer *dc = DataContainer::getInstance();
dc->clearDeviceList();
// note that this is a blocking call. For each device discovered however, a call back is made to btEvent with event type BT_EVT_DEVICE_ADDED
bt_disc_start_inquiry(BT_INQUIRY_GIAC);
bt_remote_device_t **remoteDeviceArray = 0;
bt_remote_device_t *remoteDevice = 0;
remoteDeviceArray = bt_disc_retrieve_devices(BT_DISCOVERY_ALL, 0);
int device_count;
device_count=0;
if (remoteDeviceArray) {
for (int i = 0; (remoteDevice = remoteDeviceArray[i]); ++i) {
const int deviceType = bt_rdev_get_type(remoteDevice);
if ((deviceType == BT_DEVICE_TYPE_LE_PUBLIC) || (deviceType == BT_DEVICE_TYPE_LE_PRIVATE)) {
device_count++;
DevicesManager::getDevicesManager()->extractAndStoreBleDeviceAttributes(remoteDevice);
}
bt_rdev_free(remoteDevice);
}
// qDebug() << "YYYY DevicesManager::findBleDevices() - freeing buffer";
// if (remoteDeviceArray) {
// bt_rdev_free_array(remoteDeviceArray);
// }
}
qDebug() << "XXXX number of devices found=" << device_count;
dc->setDeviceCount(device_count);
emit setDeviceCount(QVariant(device_count));
emit finishedScanningForDevices();
}