gpt4 book ai didi

c++ - iOS 上的 Qt 蓝牙

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:56:29 24 4
gpt4 key购买 nike

我试图为我的查询寻找答案。这似乎微不足道,但我还找不到答案。

我正在尝试在 iOS 上使用 Qt Bluetooth 运行程序。我能够在 MacOS 上成功使用它。

但即使是最基本的代码功能,如:

QBluetoothLocalDevice localDevice;
QString localDeviceName;

// Check if Bluetooth is available on this device
if (localDevice.isValid()) {

// Turn Bluetooth on
localDevice.powerOn();

// Read local device name
localDeviceName = localDevice.name();

// Make it visible to others
localDevice.setHostMode(QBluetoothLocalDevice::HostDiscoverable);

// Get connected devices
QList<QBluetoothAddress> remotes;
remotes = localDevice.connectedDevices();
ui->textBrowser->setText(localDevice.name() + "\n" + localDevice.address().toString());

}

给我一​​个空 vector 作为地址。

在 iOS 中运行它是否需要一些特定的设置。我需要在 info.plist 文件上添加某些标志吗?请提出建议。

有关信息,我正在使用 Qt 5.7 和 xcode 8,在 macOS Sierra macbook 上编程并为 iOS10 构建它。

最佳答案

正如 Paulw11 所指出的,事实上,在 iOS 设备上只能使用低功耗蓝牙版本。

虽然 Qt 文档中没有具体提及,但我建议您尝试将 iOS 设备编程为与外围设备通信的 BLE 中央设备。

非常感谢 Paulw11 提供的信息。

关于c++ - iOS 上的 Qt 蓝牙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40258183/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com