簡體   English   中英

iOS上的Qt藍牙

[英]Qt Bluetooth on iOS

我試圖為我的查詢尋找答案。 似乎微不足道,但我找不到答案。

我正在嘗試在iOS上使用Qt藍牙運行程序。 我可以在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());

}

給我一個空向量作為地址。

在iOS中運行它是否需要一些特定的設置。 我是否需要在info.plist文件上添加某些標志? 請提示。

有關信息,我正在使用Qt 5.7和xcode 8,在macOS Sierra MacBook上進行編程並將其構建為iOS10。

正如Paulw11所指出的,實際上,只能在iOS設備上使用低功耗藍牙版本。

盡管在Qt文檔中未特別提及,但我還是建議您嘗試將iOS設備編程為與外圍設備通信的BLE中央設備。

非常感謝Paulw11的投入。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM