当前位置: 首页>>代码示例>>C++>>正文


C++ DataContainer::setDeviceCount方法代码示例

本文整理汇总了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();

}
开发者ID:26filip,项目名称:Cascades-Community-Samples,代码行数:55,代码来源:DevicesManager.cpp


注:本文中的DataContainer::setDeviceCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。